Skip to content

Commit 0006f0d

Browse files
authored
Merge pull request #2773 from jjhursey/topic/hook-fwk
Add a 'hook' framework
2 parents cc23439 + c10bbfd commit 0006f0d

21 files changed

+984
-2
lines changed

ompi/mca/hook/Makefile.am

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# Copyright (c) 2017 IBM Corporation. All rights reserved.
3+
# $COPYRIGHT$
4+
#
5+
# Additional copyrights may follow
6+
#
7+
# $HEADER$
8+
#
9+
10+
# main library setup
11+
noinst_LTLIBRARIES = libmca_hook.la
12+
libmca_hook_la_SOURCES =
13+
14+
# local files
15+
headers = hook.h
16+
libmca_hook_la_SOURCES += $(headers)
17+
18+
# Conditionally install the header files
19+
if WANT_INSTALL_HEADERS
20+
ompidir = $(ompiincludedir)/$(subdir)
21+
nobase_ompi_HEADERS = $(headers)
22+
endif
23+
24+
include base/Makefile.am
25+
26+
distclean-local:
27+
rm -f base/static-components.h

ompi/mca/hook/base/Makefile.am

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# Copyright (c) 2017 IBM Corporation. All rights reserved.
3+
# $COPYRIGHT$
4+
#
5+
# Additional copyrights may follow
6+
#
7+
# $HEADER$
8+
#
9+
10+
dist_ompidata_DATA = base/help-mca-hook-base.txt
11+
12+
headers += \
13+
base/base.h
14+
15+
libmca_hook_la_SOURCES += \
16+
base/hook_base.c

ompi/mca/hook/base/base.h

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright (c) 2017 IBM Corporation. All rights reserved.
3+
* $COPYRIGHT$
4+
*
5+
* Additional copyrights may follow
6+
*
7+
* $HEADER$
8+
*/
9+
10+
#ifndef OMPI_HOOK_BASE_H
11+
#define OMPI_HOOK_BASE_H
12+
13+
#include "ompi_config.h"
14+
15+
#include "ompi/mca/mca.h"
16+
#include "opal/mca/base/mca_base_framework.h"
17+
18+
#include "ompi/mca/hook/hook.h"
19+
20+
BEGIN_C_DECLS
21+
22+
/**
23+
* Framework struct declaration for this framework
24+
*/
25+
OMPI_DECLSPEC extern mca_base_framework_t ompi_hook_base_framework;
26+
27+
28+
/**
29+
* Dynamically register function pointers to be called from outside of the hook
30+
* framework. For example, a collective component could register a callback
31+
* at the bottom of init to perform some action.
32+
*/
33+
OMPI_DECLSPEC int ompi_hook_base_register_callbacks(ompi_hook_base_component_t *comp);
34+
OMPI_DECLSPEC int ompi_hook_base_deregister_callbacks(ompi_hook_base_component_t *comp);
35+
36+
/**
37+
* Wrapper functions matching the interface functions
38+
*/
39+
OMPI_DECLSPEC void ompi_hook_base_mpi_initialized_top(int *flag);
40+
OMPI_DECLSPEC void ompi_hook_base_mpi_initialized_bottom(int *flag);
41+
42+
OMPI_DECLSPEC void ompi_hook_base_mpi_init_thread_top(int *argc, char ***argv, int required, int *provided);
43+
OMPI_DECLSPEC void ompi_hook_base_mpi_init_thread_bottom(int *argc, char ***argv, int required, int *provided);
44+
45+
OMPI_DECLSPEC void ompi_hook_base_mpi_finalized_top(int *flag);
46+
OMPI_DECLSPEC void ompi_hook_base_mpi_finalized_bottom(int *flag);
47+
48+
OMPI_DECLSPEC void ompi_hook_base_mpi_init_top(int argc, char **argv, int requested, int *provided);
49+
OMPI_DECLSPEC void ompi_hook_base_mpi_init_top_post_opal(int argc, char **argv, int requested, int *provided);
50+
OMPI_DECLSPEC void ompi_hook_base_mpi_init_bottom(int argc, char **argv, int requested, int *provided);
51+
OMPI_DECLSPEC void ompi_hook_base_mpi_init_error(int argc, char **argv, int requested, int *provided);
52+
53+
OMPI_DECLSPEC void ompi_hook_base_mpi_finalize_top(void);
54+
OMPI_DECLSPEC void ompi_hook_base_mpi_finalize_bottom(void);
55+
56+
END_C_DECLS
57+
58+
#endif /* OMPI_BASE_HOOK_H */
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -*- text -*-
2+
#
3+
# Copyright (c) 2017 IBM Corporation. All rights reserved.
4+
# $COPYRIGHT$
5+
#
6+
# Additional copyrights may follow
7+
#
8+
# $HEADER$
9+
#
10+
# This is the US/English help file for Open MPI MCA hook-specific
11+
# error messages.
12+
#
13+
[hook:missing-required-component]
14+
Error: A request was made to exclude a hook component from consideration that
15+
is required to be included. This component (noted below) can -not- be excluded
16+
from consideration. The program will fail at this time.
17+
18+
Framework: %s
19+
Component: %s

0 commit comments

Comments
 (0)