@@ -74,13 +74,21 @@ int mca_hook_comm_method_max = 12;
74
74
int mca_hook_comm_method_brief = 0 ;
75
75
char * mca_hook_comm_method_fakefile = NULL ;
76
76
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 }
77
+ enum mca_hook_comm_method_mode_flags_t {
78
+ /* Default: Display nothing */
79
+ OMPI_HOOK_COMM_METHOD_NONE = 0x01 ,
80
+ /* Display on MPI_INIT */
81
+ OMPI_HOOK_COMM_METHOD_INIT = 0x02 ,
82
+ /* Display on MPI_FINALIZE */
83
+ OMPI_HOOK_COMM_METHOD_FINALIZE = 0x04 ,
84
+ };
85
+
86
+ static mca_base_var_enum_value_flag_t mca_hook_comm_method_modes [] = {
87
+ {.flag = OMPI_HOOK_COMM_METHOD_NONE , .string = "none" ,
88
+ .conflicting_flag = OMPI_HOOK_COMM_METHOD_INIT | OMPI_HOOK_COMM_METHOD_FINALIZE },
89
+ {.flag = OMPI_HOOK_COMM_METHOD_INIT , .string = "mpi_init" },
90
+ {.flag = OMPI_HOOK_COMM_METHOD_FINALIZE , .string = "mpi_finalize" },
91
+ {0 , NULL , 0 }
84
92
};
85
93
86
94
@@ -99,8 +107,8 @@ static int ompi_hook_comm_method_component_close(void)
99
107
static int ompi_hook_comm_method_component_register (void )
100
108
{
101
109
int ret ;
102
- int mca_hook_comm_method_enabled = -1 ;
103
- mca_base_var_enum_t * new_enum = NULL ;
110
+ mca_base_var_enum_flag_t * mca_hook_comm_method_flags = NULL ;
111
+ uint32_t mca_hook_comm_method_enabled_flags = OMPI_HOOK_COMM_METHOD_NONE ;
104
112
105
113
/*
106
114
* Component verbosity level
@@ -145,27 +153,27 @@ static int ompi_hook_comm_method_component_register(void)
145
153
& mca_hook_comm_method_enable_mpi_finalize );
146
154
147
155
// User can set the comm_method mca variable too
148
- mca_base_var_enum_create ("ompi_comm_method" , mca_hook_comm_method_modes , & new_enum );
156
+ mca_base_var_enum_create_flag ("ompi_comm_method" , mca_hook_comm_method_modes , & mca_hook_comm_method_flags );
157
+
149
158
ret = mca_base_var_register ("ompi" , NULL , NULL , "comm_method" ,
150
- "Enable the communication protocol report: when MPI_INIT is invoked (using the '1', 'init', or 'mpi_init' values), when MPI_FINALIZE is inboked (using the '2', 'finalize', or 'mpi_finalize' values), or when both are invoked (using the '3', or 'all' values)" ,
151
- MCA_BASE_VAR_TYPE_INT , new_enum ,
159
+ "Enable the communication protocol report: when MPI_INIT is invoked (using the 'mpi_init' value) and/or when MPI_FINALIZE is invoked (using the 'mpi_finalize' value)." ,
160
+ MCA_BASE_VAR_TYPE_UNSIGNED_INT ,
161
+ & mca_hook_comm_method_flags -> super ,
152
162
0 , 0 ,
153
163
OPAL_INFO_LVL_3 ,
154
164
MCA_BASE_VAR_SCOPE_READONLY ,
155
- & mca_hook_comm_method_enabled );
156
- OBJ_RELEASE (new_enum );
165
+ & mca_hook_comm_method_enabled_flags );
166
+ OBJ_RELEASE (mca_hook_comm_method_flags );
157
167
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 ) {
161
- mca_hook_comm_method_enable_mpi_init = true;
168
+ opal_output (0 , "hook:comm_method: Warning invalid comm_method specified." );
162
169
}
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;
168
- mca_hook_comm_method_enable_mpi_finalize = true;
170
+ else {
171
+ if ( mca_hook_comm_method_enabled_flags & OMPI_HOOK_COMM_METHOD_INIT ) {
172
+ mca_hook_comm_method_enable_mpi_init = true;
173
+ }
174
+ if ( mca_hook_comm_method_enabled_flags & OMPI_HOOK_COMM_METHOD_FINALIZE ) {
175
+ mca_hook_comm_method_enable_mpi_finalize = true;
176
+ }
169
177
}
170
178
171
179
// comm_method_max
0 commit comments