ompi/hook: Add the hook/license framework
* Include a 'demo' component that shows some of the features. * Currently has hooks for: - MPI_Initialized - top, bottom - MPI_Init_thread - top, bottom - MPI_Finalized - top, bottom - MPI_Init - top (pre-opal_init), top (post-opal_init), error, bottom - MPI_Finalize - top, bottom * Other places in ompi can 'register' to hook into any one of these places by passing back a component structure filled with function pointers. * Add a `MCA_BASE_COMPONENT_FLAG_REQUIRED` flag to the MCA structure that is checked by the `hook` framework. If a required, static component has been excluded then the `hook` framework will fail to initialize. - See note in `opal/mca/mca.h` as to why this is checked in the `hook` framework and not in `opal/mca/base/mca_base_component_find.c` Signed-off-by: Joshua Hursey <jhursey@us.ibm.com>
Этот коммит содержится в:
@ -82,6 +82,7 @@
|
||||
#include "ompi/runtime/params.h"
|
||||
#include "ompi/dpm/dpm.h"
|
||||
#include "ompi/mpiext/mpiext.h"
|
||||
#include "ompi/mca/hook/base/base.h"
|
||||
|
||||
#if OPAL_ENABLE_FT_CR == 1
|
||||
#include "ompi/mca/crcp/crcp.h"
|
||||
@ -110,6 +111,8 @@ int ompi_mpi_finalize(void)
|
||||
OPAL_TIMING_DECLARE(tm);
|
||||
OPAL_TIMING_INIT_EXT(&tm, OPAL_TIMING_GET_TIME_OF_DAY);
|
||||
|
||||
ompi_hook_base_mpi_finalize_top();
|
||||
|
||||
/* Be a bit social if an erroneous program calls MPI_FINALIZE in
|
||||
two different threads, otherwise we may deadlock in
|
||||
ompi_comm_free() (or run into other nasty lions, tigers, or
|
||||
@ -487,6 +490,12 @@ int ompi_mpi_finalize(void)
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Now close the hook framework */
|
||||
if (OMPI_SUCCESS != (ret = mca_base_framework_close(&ompi_hook_base_framework) ) ) {
|
||||
OMPI_ERROR_LOG(ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != (ret = opal_finalize_util())) {
|
||||
goto done;
|
||||
}
|
||||
@ -506,6 +515,7 @@ int ompi_mpi_finalize(void)
|
||||
|
||||
done:
|
||||
opal_mutex_unlock(&ompi_mpi_bootstrap_mutex);
|
||||
ompi_hook_base_mpi_finalize_bottom();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Ссылка в новой задаче
Block a user