From 7ef15a14849c4e8c745acc2a74cf6d8b2444f954 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Wed, 5 Feb 2025 15:16:17 -0700 Subject: [PATCH] mpirun: add cli option to turn off gpu support idea is that maybe one might want to build open mpi with gpu support, but there may be performance benefit of disabling all gpu related paths when using this library on systems without accelerators. Signed-off-by: Howard Pritchard --- src/mca/schizo/ompi/schizo-ompi-cli.rstxt | 2 ++ src/mca/schizo/ompi/schizo_ompi.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/mca/schizo/ompi/schizo-ompi-cli.rstxt b/src/mca/schizo/ompi/schizo-ompi-cli.rstxt index 54715360a7..d8cd380291 100644 --- a/src/mca/schizo/ompi/schizo-ompi-cli.rstxt +++ b/src/mca/schizo/ompi/schizo-ompi-cli.rstxt @@ -163,6 +163,8 @@ MPI Options attached to predefined communicators during the first MPI call. * ``--memory-alloc-kinds``: Value is a comma separated list of memory allocation kinds. +* ``--disable-gpu-support``: Specify to disable any accelerator support + built in to the Open MPI installation at run time. * ``--display-comm``: Display table of communication methods between MPI_COMM_WORLD ranks during MPI_Init * ``--display-comm-finalize``: Display table of communication methods diff --git a/src/mca/schizo/ompi/schizo_ompi.c b/src/mca/schizo/ompi/schizo_ompi.c index 3fb46e7ca6..d13e9f2aaa 100644 --- a/src/mca/schizo/ompi/schizo_ompi.c +++ b/src/mca/schizo/ompi/schizo_ompi.c @@ -19,7 +19,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2018-2022 IBM Corporation. All rights reserved. * Copyright (c) 2021-2024 Nanook Consulting All rights reserved. - * Copyright (c) 2022-2024 Triad National Security, LLC. All rights + * Copyright (c) 2022-2025 Triad National Security, LLC. All rights * reserved. * $COPYRIGHT$ * @@ -194,6 +194,7 @@ static struct option ompioptions[] = { PMIX_OPTION_DEFINE(PRTE_CLI_DISABLE_RECOVERY, PMIX_ARG_NONE), PMIX_OPTION_DEFINE(PRTE_CLI_CONTINUOUS, PMIX_ARG_NONE), PMIX_OPTION_DEFINE("with-ft", PMIX_ARG_REQD), + PMIX_OPTION_DEFINE("disable-gpu-support", PMIX_ARG_NONE), /* mpiexec mandated form launch key parameters - MPI 4.0 */ PMIX_OPTION_DEFINE("initial-errhandler", PMIX_ARG_REQD), @@ -1612,6 +1613,15 @@ static int parse_env(char **srcenv, char ***dstenv, } } + if (NULL != (opt = pmix_cmd_line_get_param(results, "disable-gpu-support"))) { + rc = check_cache(&cache, &cachevals, "disable_gpu_support", "true"); + if (PRTE_SUCCESS != rc) { + PMIX_ARGV_FREE_COMPAT(cache); + PMIX_ARGV_FREE_COMPAT(cachevals); + return rc; + } + } + if (pmix_cmd_line_is_taken(results, "display-comm") && pmix_cmd_line_is_taken(results, "display-comm-finalize")) { PMIX_SETENV_COMPAT("OMPI_MCA_ompi_display_comm", "mpi_init,mpi_finalize", true, dstenv);