@@ -54,10 +54,10 @@ int orte_pmix_server_register_nspace(orte_job_t *jdata)
5454{
5555 int rc ;
5656 orte_proc_t * pptr ;
57- int i , k , n , nlocalprocs ;
57+ int i , k , n ;
5858 opal_list_t * info , * pmap ;
5959 opal_value_t * kv ;
60- orte_node_t * node , * n2 ;
60+ orte_node_t * node , * mynode ;
6161 opal_vpid_t vpid ;
6262 char * * list , * * procs , * * micro , * tmp , * regex , * cpulist , * peerlist ;
6363 orte_job_t * dmns ;
@@ -164,8 +164,8 @@ int orte_pmix_server_register_nspace(orte_job_t *jdata)
164164 OPAL_LIST_RELEASE (info );
165165 return ORTE_ERR_NOT_FOUND ;
166166 }
167- node = pptr -> node ;
168- if (NULL == node ) {
167+ mynode = pptr -> node ;
168+ if (NULL == mynode ) {
169169 /* cannot happen */
170170 ORTE_ERROR_LOG (ORTE_ERR_NOT_FOUND );
171171 OPAL_LIST_RELEASE (info );
@@ -175,14 +175,14 @@ int orte_pmix_server_register_nspace(orte_job_t *jdata)
175175 kv = OBJ_NEW (opal_value_t );
176176 kv -> key = strdup (OPAL_PMIX_NODEID );
177177 kv -> type = OPAL_UINT32 ;
178- kv -> data .uint32 = node -> index ;
178+ kv -> data .uint32 = mynode -> index ;
179179 opal_list_append (info , & kv -> super );
180180
181181 /* pass our node size */
182182 kv = OBJ_NEW (opal_value_t );
183183 kv -> key = strdup (OPAL_PMIX_NODE_SIZE );
184184 kv -> type = OPAL_UINT32 ;
185- kv -> data .uint32 = node -> num_procs ;
185+ kv -> data .uint32 = mynode -> num_procs ;
186186 opal_list_append (info , & kv -> super );
187187
188188 /* univ size */
@@ -220,43 +220,29 @@ int orte_pmix_server_register_nspace(orte_job_t *jdata)
220220 kv -> data .uint32 = jdata -> total_slots_alloc ;
221221 opal_list_append (info , & kv -> super );
222222
223- /* identify our local node object within the map,
224- * if we were included */
225- node = NULL ;
226- map = (orte_job_map_t * )jdata -> map ;
227- for (i = 0 ; i < map -> nodes -> size ; i ++ ) {
228- if (NULL == (n2 = (orte_node_t * )opal_pointer_array_get_item (map -> nodes , i ))) {
223+ /* register any local clients */
224+ vpid = ORTE_VPID_MAX ;
225+ for (i = 0 ; i < mynode -> procs -> size ; i ++ ) {
226+ if (NULL == (pptr = (orte_proc_t * )opal_pointer_array_get_item (mynode -> procs , i ))) {
229227 continue ;
230228 }
231- if (n2 == pptr -> node ) {
232- node = n2 ;
233- break ;
234- }
235- }
236- if (NULL != node ) {
237- vpid = ORTE_VPID_MAX ;
238- for (i = 0 ; i < node -> procs -> size ; i ++ ) {
239- if (NULL == (pptr = (orte_proc_t * )opal_pointer_array_get_item (node -> procs , i ))) {
240- continue ;
229+ if (pptr -> name .jobid == jdata -> jobid ) {
230+ if (pptr -> name .vpid < vpid ) {
231+ vpid = pptr -> name .vpid ;
241232 }
242- if (pptr -> name .jobid == jdata -> jobid ) {
243- if (pptr -> name .vpid < vpid ) {
244- vpid = pptr -> name .vpid ;
245- }
246- /* go ahead and register this client */
247- if (OPAL_SUCCESS != (rc = opal_pmix .server_register_client (& pptr -> name , uid , gid ,
248- (void * )pptr , NULL , NULL ))) {
249- ORTE_ERROR_LOG (rc );
250- }
233+ /* go ahead and register this client */
234+ if (OPAL_SUCCESS != (rc = opal_pmix .server_register_client (& pptr -> name , uid , gid ,
235+ (void * )pptr , NULL , NULL ))) {
236+ ORTE_ERROR_LOG (rc );
251237 }
252238 }
253- /* pass the local ldr */
254- kv = OBJ_NEW (opal_value_t );
255- kv -> key = strdup (OPAL_PMIX_LOCALLDR );
256- kv -> type = OPAL_VPID ;
257- kv -> data .name .vpid = vpid ;
258- opal_list_append (info , & kv -> super );
259239 }
240+ /* pass the local ldr */
241+ kv = OBJ_NEW (opal_value_t );
242+ kv -> key = strdup (OPAL_PMIX_LOCALLDR );
243+ kv -> type = OPAL_VPID ;
244+ kv -> data .name .vpid = vpid ;
245+ opal_list_append (info , & kv -> super );
260246
261247 /* for each proc in this job, create an object that
262248 * includes the info describing the proc so the recipient has a complete
@@ -276,13 +262,11 @@ int orte_pmix_server_register_nspace(orte_job_t *jdata)
276262 cpulist = NULL ;
277263 peerlist = NULL ;
278264 vpid = ORTE_VPID_MAX ;
279- nlocalprocs = 0 ;
280265 for (i = 0 ; i < node -> procs -> size ; i ++ ) {
281266 if (NULL == (pptr = (orte_proc_t * )opal_pointer_array_get_item (node -> procs , i ))) {
282267 continue ;
283268 }
284269 if (pptr -> name .jobid == jdata -> jobid ) {
285- ++ nlocalprocs ;
286270 opal_argv_append_nosize (& list , ORTE_VPID_PRINT (pptr -> name .vpid ));
287271 if (pptr -> name .vpid < vpid ) {
288272 vpid = pptr -> name .vpid ;
@@ -315,6 +299,26 @@ int orte_pmix_server_register_nspace(orte_job_t *jdata)
315299 procs = NULL ;
316300 }
317301
302+ /* if this is me, then pass the peers and cpusets to myself
303+ * in order to maintain backward compatibility for the non-pmix
304+ * components in OPAL/pmix */
305+ if (node == mynode ) {
306+ /* pass the list of peers */
307+ kv = OBJ_NEW (opal_value_t );
308+ kv -> key = strdup (OPAL_PMIX_LOCAL_PEERS );
309+ kv -> type = OPAL_STRING ;
310+ kv -> data .string = strdup (peerlist );
311+ opal_list_append (info , & kv -> super );
312+
313+ /* pass the list of cpusets */
314+ kv = OBJ_NEW (opal_value_t );
315+ kv -> key = strdup (OPAL_PMIX_LOCAL_CPUSETS );
316+ kv -> type = OPAL_STRING ;
317+ kv -> data .string = strdup (cpulist );
318+ opal_list_append (info , & kv -> super );
319+
320+ }
321+
318322 /* now cycle across each proc on this node, passing all data that
319323 * varies by proc */
320324 for (i = 0 ; i < node -> procs -> size ; i ++ ) {
0 commit comments