From 087a18aae0c46e8c7ad60f68463a601dac210606 Mon Sep 17 00:00:00 2001 From: Min Si Date: Fri, 7 May 2021 13:57:33 -0500 Subject: [PATCH] mpit: add an env var to optionally disable MPI_T usage Set OSHMPI_ENABLE_MPI_T=0 to disable MPI_T usage in OSHMPI. It is 1 (enabled) by default --- src/include/oshmpi_impl.h | 3 +++ src/internal/setup_impl.c | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/include/oshmpi_impl.h b/src/include/oshmpi_impl.h index 74334ae..776565b 100644 --- a/src/include/oshmpi_impl.h +++ b/src/include/oshmpi_impl.h @@ -279,6 +279,9 @@ typedef struct { * Invalid when OSHMPI_DISABLE_AM_ASYNC_THREAD is set. * Default value is 1 if either AMO or RMA is AM based; * otherwise 0.*/ + unsigned int enable_mpit; /* OSHMPI_ENABLE_MPI_T: Control mpi_t utilization at shmem_init. + * Value: 0 or 1. Default is 1, enables MPI_T setting. + * Set OSHMPI_ENABLE_MPI_T=0 to disable. */ uint32_t mpi_gpu_features; /* OSHMPI_MPI_GPU_FEATURES: Arbitrary combination with bit shift defined in * OSHMPI_mpi_gpu_feature_shift_t. none and all are two special values. */ #ifndef OSHMPI_DISABLE_DEBUG diff --git a/src/internal/setup_impl.c b/src/internal/setup_impl.c index 7594aae..717f3f7 100644 --- a/src/internal/setup_impl.c +++ b/src/internal/setup_impl.c @@ -567,6 +567,7 @@ static void print_env(void) " OSHMPI_AMO_OPS %s\n" " OSHMPI_ENABLE_ASYNC_THREAD %d\n" " OSHMPI_MPI_GPU_FEATURES %s\n" + " OSHMPI_ENABLE_MPI_T %d\n" #ifndef OSHMPI_DISABLE_DEBUG " (Invalid options if OSHMPI is built with --enable-fast=ndebug)\n" " OSHMPI_AMO_DBG_MODE %s\n" @@ -574,7 +575,8 @@ static void print_env(void) #endif ,OSHMPI_env.verbose, amo_ops_str, OSHMPI_env.enable_async_thread, - mpi_gpu_features_str + mpi_gpu_features_str, + OSHMPI_env.enable_mpit #ifndef OSHMPI_DISABLE_DEBUG ,getstr_env_dbg_mode(OSHMPI_env.amo_dbg_mode) ,getstr_env_dbg_mode(OSHMPI_env.rma_dbg_mode) @@ -673,6 +675,11 @@ static void initialize_env(void) if (OSHMPI_env.enable_async_thread != 0) OSHMPI_env.enable_async_thread = 1; #endif + + OSHMPI_env.enable_mpit = 1; + val = getenv("OSHMPI_ENABLE_MPI_T"); + if (val && strlen(val) && atoi(val) == 0) + OSHMPI_env.enable_mpit = 0; } static void set_mpit_cvar(const char *cvar_name, const void *val) @@ -705,6 +712,9 @@ static void set_mpit_cvar(const char *cvar_name, const void *val) static void initialize_mpit(void) { + if (!OSHMPI_env.enable_mpit) + return; + int val = 1; set_mpit_cvar("MPIR_CVAR_CH4_RMA_ENABLE_DYNAMIC_AM_PROGRESS", &val); }