From e7a9041e93f64fcf9220e89d0db8e353871f48f6 Mon Sep 17 00:00:00 2001 From: Hui Zhou Date: Thu, 14 Apr 2022 11:30:31 -0500 Subject: [PATCH] ADI: add MPID_Allocate_vci 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.. --- src/mpid/ch3/include/mpidpre.h | 2 ++ src/mpid/ch3/src/mpid_init.c | 6 ++++++ src/mpid/ch4/include/mpidch4.h | 1 + src/mpid/ch4/src/ch4_init.c | 11 +++++++++++ 4 files changed, 20 insertions(+) diff --git a/src/mpid/ch3/include/mpidpre.h b/src/mpid/ch3/include/mpidpre.h index c2e21435593..af4ba57d0c6 100644 --- a/src/mpid/ch3/include/mpidpre.h +++ b/src/mpid/ch3/include/mpidpre.h @@ -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 ); diff --git a/src/mpid/ch3/src/mpid_init.c b/src/mpid/ch3/src/mpid_init.c index 3218c978ec7..1804f8392e0 100644 --- a/src/mpid/ch3/src/mpid_init.c +++ b/src/mpid/ch3/src/mpid_init.c @@ -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 diff --git a/src/mpid/ch4/include/mpidch4.h b/src/mpid/ch4/include/mpidch4.h index 59983db2cf0..4ea9cee59b9 100644 --- a/src/mpid/ch4/include/mpidch4.h +++ b/src/mpid/ch4/include/mpidch4.h @@ -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 *); diff --git a/src/mpid/ch4/src/ch4_init.c b/src/mpid/ch4/src/ch4_init.c index db7327f2abe..96787d52268 100644 --- a/src/mpid/ch4/src/ch4_init.c +++ b/src/mpid/ch4/src/ch4_init.c @@ -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;