@@ -33,7 +33,7 @@ int MPIDI_OFI_vci_init(void)
3333}
3434
3535/* Address exchange within comm and setup multiple vcis */
36- static int addr_exchange_all_ctx (MPIR_Comm * comm );
36+ static int addr_exchange_all_ctx (MPIR_Comm * comm , int * all_num_vcis );
3737
3838int MPIDI_OFI_comm_set_vcis (MPIR_Comm * comm , int num_vcis , int * all_num_vcis )
3939{
@@ -50,7 +50,7 @@ int MPIDI_OFI_comm_set_vcis(MPIR_Comm * comm, int num_vcis, int *all_num_vcis)
5050 MPIR_ERR_CHECK (mpi_errno );
5151
5252 /* Since we allow different process to have different num_vcis, we always need run exchange. */
53- mpi_errno = addr_exchange_all_ctx (comm );
53+ mpi_errno = addr_exchange_all_ctx (comm , all_num_vcis );
5454 MPIR_ERR_CHECK (mpi_errno );
5555
5656 for (int vci = 1 ; vci < MPIDI_OFI_global .num_vcis ; vci ++ ) {
@@ -250,7 +250,7 @@ static int get_av_table_index(int rank, int nic, int vci, int *all_num_vcis)
250250 }
251251}
252252
253- static int addr_exchange_all_ctx (MPIR_Comm * comm )
253+ static int addr_exchange_all_ctx (MPIR_Comm * comm , int * all_num_vcis )
254254{
255255 int mpi_errno = MPI_SUCCESS ;
256256 MPIR_CHKLMEM_DECL ();
@@ -259,26 +259,12 @@ static int addr_exchange_all_ctx(MPIR_Comm * comm)
259259 int size = comm -> local_size ;
260260 int rank = comm -> rank ;
261261
262- int max_vcis ;
263- int * all_num_vcis ;
264-
265- #if !defined(MPIDI_OFI_VNI_USE_DOMAIN ) || MPIDI_CH4_MAX_VCIS == 1
266- max_vcis = 1 ;
267- all_num_vcis = NULL ;
268- #else
269- /* Allgather num_vcis */
270- MPIR_CHKLMEM_MALLOC (all_num_vcis , sizeof (int ) * size );
271- mpi_errno = MPIR_Allgather_fallback (& MPIDI_OFI_global .num_vcis , 1 , MPIR_INT_INTERNAL ,
272- all_num_vcis , 1 , MPIR_INT_INTERNAL , comm , MPIR_ERR_NONE );
273- MPIR_ERR_CHECK (mpi_errno );
274-
275- max_vcis = 0 ;
262+ int max_vcis = 0 ;
276263 for (int i = 0 ; i < size ; i ++ ) {
277264 if (max_vcis < NUM_VCIS_FOR_RANK (i )) {
278265 max_vcis = NUM_VCIS_FOR_RANK (i );
279266 }
280267 }
281- #endif
282268
283269 int num_vcis = NUM_VCIS_FOR_RANK (rank );
284270 int num_nics = MPIDI_OFI_global .num_nics ;
0 commit comments