@@ -69,6 +69,48 @@ static char *find_prterun(void)
69
69
#endif
70
70
}
71
71
72
+ static void append_prefixes (char * * * out , const char * in )
73
+ {
74
+ if (NULL == in ) {
75
+ return ;
76
+ }
77
+
78
+ char * * tokenized ;
79
+ tokenized = opal_argv_split (in , ' ' );
80
+
81
+ int count = opal_argv_count (* out );
82
+ for (int i = 0 ; tokenized [i ] != NULL ; ++ i ) {
83
+ // Skip adding the names "common" and "pmix" to the list
84
+ if (strcmp (tokenized [i ], "common" ) == 0 ||
85
+ strcmp (tokenized [i ], "pmix" ) == 0 ) {
86
+ continue ;
87
+ }
88
+ opal_argv_append (& count , out , tokenized [i ]);
89
+ }
90
+
91
+ opal_argv_free (tokenized );
92
+ }
93
+
94
+ static void setup_mca_prefixes (void )
95
+ {
96
+ int count = 0 ;
97
+ char * * tmp = NULL ;
98
+
99
+ opal_argv_append (& count , & tmp , "mca" );
100
+ opal_argv_append (& count , & tmp , "opal" );
101
+ opal_argv_append (& count , & tmp , "ompi" );
102
+
103
+ append_prefixes (& tmp , MCA_oshmem_FRAMEWORKS );
104
+ append_prefixes (& tmp , MCA_ompi_FRAMEWORKS );
105
+ append_prefixes (& tmp , MCA_opal_FRAMEWORKS );
106
+
107
+ char * env_str = opal_argv_join (tmp , ',' );
108
+ opal_setenv ("OMPI_MCA_PREFIXES" , env_str , true,
109
+ & environ );
110
+
111
+ opal_argv_free (tmp );
112
+ }
113
+
72
114
73
115
int main (int argc , char * argv [])
74
116
{
@@ -121,6 +163,9 @@ int main(int argc, char *argv[])
121
163
122
164
setenv ("OMPI_LIBDIR_LOC" , opal_install_dirs .libdir , 1 );
123
165
166
+ // Set environment variable to tell PRTE what MCA prefixes belong
167
+ // to Open MPI.
168
+ setup_mca_prefixes ();
124
169
125
170
/* calling mpirun (and now prterun) with a full path has a special
126
171
* meaning in terms of -prefix behavior, so copy that behavior
0 commit comments