Skip to content

Commit

Permalink
ADI: add MPID_Allocate_vci
Browse files Browse the repository at this point in the history
This ADI allows MPIR layer to request for explicit vcis. The return must
be greater than 0 or inidicate failure. VCI 0 is the default global vci,
that is always used for implicit vci hashing..
  • Loading branch information
hzhou committed Apr 15, 2022
1 parent 4ced485 commit e7a9041
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mpid/ch3/include/mpidpre.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,8 @@ int MPID_Init(int required, int *provided);

int MPID_InitCompleted( void );

int MPID_Allocate_vci(void);

int MPID_Finalize(void);

int MPID_Abort( MPIR_Comm *comm, int mpi_errno, int exit_code, const char *error_msg );
Expand Down
6 changes: 6 additions & 0 deletions src/mpid/ch3/src/mpid_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ int MPID_InitCompleted( void )
/* --END ERROR HANDLING-- */
}

int MPID_Allocate_vci(void)
{
/* not supported, return 0 as failure */
return 0;
}

/*
* Initialize the process group structure by using PMI calls.
* This routine initializes PMI and uses PMI calls to setup the
Expand Down
1 change: 1 addition & 0 deletions src/mpid/ch4/include/mpidch4.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

int MPID_Init(int, int *);
int MPID_InitCompleted(void);
int MPID_Allocate_vci(void);
MPL_STATIC_INLINE_PREFIX int MPID_Cancel_recv(MPIR_Request *) MPL_STATIC_INLINE_SUFFIX;
MPL_STATIC_INLINE_PREFIX int MPID_Cancel_send(MPIR_Request *) MPL_STATIC_INLINE_SUFFIX;
int MPID_Comm_disconnect(MPIR_Comm *);
Expand Down
11 changes: 11 additions & 0 deletions src/mpid/ch4/src/ch4_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,17 @@ int MPID_InitCompleted(void)
goto fn_exit;
}

int MPID_Allocate_vci(void)
{
if (MPIDI_global.n_vcis + MPIDI_global.n_reserved_vcis >= MPIDI_global.n_total_vcis) {
return 0;
} else {
MPIDI_global.n_reserved_vcis++;
/* we allocate from the back */
return (MPIDI_global.n_total_vcis - MPIDI_global.n_reserved_vcis);
}
}

int MPID_Finalize(void)
{
int mpi_errno;
Expand Down

0 comments on commit e7a9041

Please sign in to comment.