@@ -1784,22 +1784,22 @@ int ompi_intercomm_create_from_groups (ompi_group_t *local_group, int local_lead
1784
1784
leader_procs [1 ] = tmp ;
1785
1785
}
1786
1786
1787
- /* create a unique tag for allocating the leader communicator. we can eliminate this step
1788
- * if we take a CID from the newly allocated block belonging to local_comm. this is
1789
- * a note to make this change at a later time. */
1790
- opal_asprintf (& sub_tag , "%s-OMPIi-LC" , tag );
1791
- if (OPAL_UNLIKELY (NULL == sub_tag )) {
1792
- ompi_comm_free (& local_comm );
1787
+ leader_group = ompi_group_allocate_plist_w_procs (NULL , leader_procs , 2 );
1788
+ ompi_set_group_rank (leader_group , my_proc );
1789
+ if (OPAL_UNLIKELY (NULL == leader_group )) {
1793
1790
free (leader_procs );
1791
+ ompi_comm_free (& local_comm );
1794
1792
return OMPI_ERR_OUT_OF_RESOURCE ;
1795
1793
}
1796
1794
1797
- leader_group = ompi_group_allocate_plist_w_procs (NULL , leader_procs , 2 );
1798
- ompi_set_group_rank (leader_group , my_proc );
1799
- if (OPAL_UNLIKELY (NULL == leader_group )) {
1800
- free (sub_tag );
1795
+ /* create a unique tag for allocating the leader communicator. we can eliminate this step
1796
+ * if we take a CID from the newly allocated block belonging to local_comm. this is
1797
+ * a note to make this change at a later time. */
1798
+ opal_asprintf (& sub_tag , "%s-OMPIi-LC-%s" , tag , OPAL_NAME_PRINT (ompi_group_get_proc_name (leader_group , 0 )));
1799
+ if (OPAL_UNLIKELY (NULL == sub_tag )) {
1801
1800
free (leader_procs );
1802
1801
ompi_comm_free (& local_comm );
1802
+ OBJ_RELEASE (leader_group );
1803
1803
return OMPI_ERR_OUT_OF_RESOURCE ;
1804
1804
}
1805
1805
@@ -1809,6 +1809,7 @@ int ompi_intercomm_create_from_groups (ompi_group_t *local_group, int local_lead
1809
1809
rc = ompi_comm_create_from_group (leader_group , sub_tag , info , errhandler , & leader_comm );
1810
1810
OBJ_RELEASE (leader_group );
1811
1811
free (sub_tag );
1812
+ sub_tag = NULL ;
1812
1813
if (OPAL_UNLIKELY (OMPI_SUCCESS != rc )) {
1813
1814
free (leader_procs );
1814
1815
ompi_comm_free (& local_comm );
@@ -1864,7 +1865,16 @@ int ompi_intercomm_create_from_groups (ompi_group_t *local_group, int local_lead
1864
1865
return rc ;
1865
1866
}
1866
1867
1867
- rc = ompi_comm_nextcid (newcomp , NULL , NULL , (void * ) tag , NULL , false, OMPI_COMM_CID_GROUP_NEW );
1868
+ /*
1869
+ * append the pmix CONTEXT_ID obtained when creating the leader comm as discriminator
1870
+ */
1871
+ opal_asprintf (& sub_tag , "%s-%ld" , tag , data [1 ]);
1872
+ if (OPAL_UNLIKELY (NULL == sub_tag )) {
1873
+ return OMPI_ERR_OUT_OF_RESOURCE ;
1874
+ }
1875
+
1876
+ rc = ompi_comm_nextcid (newcomp , NULL , NULL , (void * ) sub_tag , NULL , false, OMPI_COMM_CID_GROUP_NEW );
1877
+ free (sub_tag );
1868
1878
if ( OMPI_SUCCESS != rc ) {
1869
1879
OBJ_RELEASE (newcomp );
1870
1880
return rc ;
0 commit comments