@@ -74,6 +74,16 @@ int mca_hook_comm_method_max = 12;
7474int mca_hook_comm_method_brief = 0 ;
7575char * mca_hook_comm_method_fakefile = NULL ;
7676
77+ mca_base_var_enum_value_t mca_hook_comm_method_modes [] = {
78+ {1 , "init" },
79+ {1 , "mpi_init" },
80+ {2 , "finalize" },
81+ {2 , "mpi_finalize" },
82+ {3 , "all" },
83+ {0 , NULL }
84+ };
85+
86+
7787static int ompi_hook_comm_method_component_open (void )
7888{
7989 // Nothing to do
@@ -88,6 +98,9 @@ static int ompi_hook_comm_method_component_close(void)
8898
8999static int ompi_hook_comm_method_component_register (void )
90100{
101+ int ret ;
102+ int mca_hook_comm_method_enabled = -1 ;
103+ mca_base_var_enum_t * new_enum = NULL ;
91104
92105 /*
93106 * Component verbosity level
@@ -132,19 +145,26 @@ static int ompi_hook_comm_method_component_register(void)
132145 & mca_hook_comm_method_enable_mpi_finalize );
133146
134147 // User can set the comm_method mca variable too
135- int hook_comm_method = -1 ;
136- (void ) mca_base_var_register ("ompi" , NULL , NULL , "comm_method" ,
137- "Enable comm_method behavior (1) mpi_init or (2) mpi_finalize" ,
138- MCA_BASE_VAR_TYPE_INT , NULL ,
139- 0 , 0 ,
140- OPAL_INFO_LVL_3 ,
141- MCA_BASE_VAR_SCOPE_READONLY ,
142- & hook_comm_method );
143-
144- if ( 1 == hook_comm_method ) {
148+ mca_base_var_enum_create ("ompi_comm_method" , mca_hook_comm_method_modes , & new_enum );
149+ ret = mca_base_var_register ("ompi" , NULL , NULL , "comm_method" ,
150+ "Enable comm_method behavior at mpi_init (using the '1', 'init', or 'mpi_init' values), mpi_finalize (using the '2', 'finalize', or 'mpi_finalize' values), or both (using the '3', or 'all' value)" ,
151+ MCA_BASE_VAR_TYPE_INT , new_enum ,
152+ 0 , 0 ,
153+ OPAL_INFO_LVL_3 ,
154+ MCA_BASE_VAR_SCOPE_READONLY ,
155+ & mca_hook_comm_method_enabled );
156+ OBJ_RELEASE (new_enum );
157+ if (OPAL_ERR_VALUE_OUT_OF_BOUNDS == ret ) {
158+ opal_output (0 , "hook:comm_method: Warning invalid prot mode specified: %d" , mca_hook_comm_method_enabled );
159+ }
160+ else if ( 1 == mca_hook_comm_method_enabled ) {
145161 mca_hook_comm_method_enable_mpi_init = true;
146162 }
147- else if ( 2 == hook_comm_method ) {
163+ else if ( 2 == mca_hook_comm_method_enabled ) {
164+ mca_hook_comm_method_enable_mpi_finalize = true;
165+ }
166+ else if ( 3 == mca_hook_comm_method_enabled ) {
167+ mca_hook_comm_method_enable_mpi_init = true;
148168 mca_hook_comm_method_enable_mpi_finalize = true;
149169 }
150170
0 commit comments