From 9b7b0a45fb5fbce6caeadadc9266d12b30a8155a Mon Sep 17 00:00:00 2001 From: Gerardo Garcia Date: Sun, 10 Nov 2024 22:56:35 -0500 Subject: [PATCH] modified mpirun to longer fork/exec prterun but now to instead call the function directly in the process Note this commit will need to be adjusted to reset .gitmodules before merging into Open MPI main Signed-off-by: Gerardo Garcia Signed-off-by: Howard Pritchard --- .gitmodules | 4 +- 3rd-party/prrte | 2 +- ompi/dpm/dpm.c | 5 ++- ompi/tools/mpirun/Makefile.am | 6 ++- ompi/tools/mpirun/help-mpirun.txt | 14 ++---- ompi/tools/mpirun/main.c | 73 ++++--------------------------- 6 files changed, 24 insertions(+), 80 deletions(-) diff --git a/.gitmodules b/.gitmodules index 6914849f45a..717bdaf0dc3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,7 @@ [submodule "prrte"] path = 3rd-party/prrte - url = ../../open-mpi/prrte - branch = master + url = ../../uofl-capstone-open-mpi/prrte + branch = capstone-devel [submodule "openpmix"] path = 3rd-party/openpmix url = ../../openpmix/openpmix.git diff --git a/3rd-party/prrte b/3rd-party/prrte index 0f0a90006cb..95c240ef136 160000 --- a/3rd-party/prrte +++ b/3rd-party/prrte @@ -1 +1 @@ -Subproject commit 0f0a90006cbc880d499b2356d6076e785e7868ba +Subproject commit 95c240ef136aa7f03ccdb888deca7f847445c4e0 diff --git a/ompi/dpm/dpm.c b/ompi/dpm/dpm.c index 8e4057daffb..599317017cb 100644 --- a/ompi/dpm/dpm.c +++ b/ompi/dpm/dpm.c @@ -1991,7 +1991,10 @@ static char *find_prte(void) #if OMPI_USING_INTERNAL_PRRTE /* 2) If using internal PRRTE, use our bindir. Note that this * will obey OPAL_PREFIX and OPAL_DESTDIR */ - opal_asprintf(&filename, "%s%sprte", opal_install_dirs.bindir, OPAL_PATH_SEP); +/* + * TODO: HPP replace hard-wired prrte prefix with something configurable + */ + opal_asprintf(&filename, "%s%sompi-prte", opal_install_dirs.bindir, OPAL_PATH_SEP); return filename; #else diff --git a/ompi/tools/mpirun/Makefile.am b/ompi/tools/mpirun/Makefile.am index e5e7836ded5..021b59c7010 100644 --- a/ompi/tools/mpirun/Makefile.am +++ b/ompi/tools/mpirun/Makefile.am @@ -20,8 +20,12 @@ dist_ompidata_DATA = help-mpirun.txt mpirun_SOURCES = \ main.c +# +# TODO: HPP replace hard-wired prrte prefix with something configurable +# mpirun_LDADD = \ - $(top_builddir)/opal/libopen-pal_core.la + $(top_builddir)/opal/libopen-pal_core.la \ + $(top_builddir)/3rd-party/prrte/src/libompi-prrte.la mpirun_CPPFLAGS = \ -DMCA_oshmem_FRAMEWORKS="\"$(MCA_oshmem_FRAMEWORKS)\"" \ diff --git a/ompi/tools/mpirun/help-mpirun.txt b/ompi/tools/mpirun/help-mpirun.txt index 7df77c785cf..d68133e3a76 100644 --- a/ompi/tools/mpirun/help-mpirun.txt +++ b/ompi/tools/mpirun/help-mpirun.txt @@ -10,14 +10,8 @@ # This is the US/English help file for Open MPI wrapper compiler error # messages. # -[no-prterun-found] -Open MPI's mpirun command was unable to find an underlying prterun -command to execute. Consider setting the OMPI_PRTERUN environment -variable to help mpirun find the correct underlying prterun. -[prterun-exec-failed] -Open MPI's mpirun command could not execute the underlying prterun -command. The prterun command we tried to execute and the error -message from exec() are below: +[prte-launch-failed] +Open MPI's mpirun command was unable to launch the user's application. +This may indicate an issue with the environment or incorrect configuration. - Command: %s - Error Message: %s +Error Message: %s \ No newline at end of file diff --git a/ompi/tools/mpirun/main.c b/ompi/tools/mpirun/main.c index 3a4e18dced9..dc31f0220b5 100644 --- a/ompi/tools/mpirun/main.c +++ b/ompi/tools/mpirun/main.c @@ -28,46 +28,8 @@ #include "opal/util/printf.h" #include "opal/util/show_help.h" #include "ompi/constants.h" +#include "3rd-party/prrte/include/prte.h" -static char *find_prterun(void) -{ - char *filename = NULL; -#if !OMPI_USING_INTERNAL_PRRTE - char *prrte_prefix = NULL; -#endif - - /* 1) Did the user tell us exactly where to find prterun? */ - filename = getenv("OMPI_PRTERUN"); - if (NULL != filename) { - return filename; - } - -#if OMPI_USING_INTERNAL_PRRTE - /* 2) If using internal PRRTE, use our bindir. Note that this - * will obey OPAL_PREFIX and OPAL_DESTDIR */ - opal_asprintf(&filename, "%s%sprterun", opal_install_dirs.bindir, OPAL_PATH_SEP); - return filename; -#else - - /* 3) Look in ${PRTE_PREFIX}/bin */ - prrte_prefix = getenv("PRTE_PREFIX"); - if (NULL != prrte_prefix) { - opal_asprintf(&filename, "%s%sbin%sprterun", prrte_prefix, OPAL_PATH_SEP, OPAL_PATH_SEP); - return filename; - } - - /* 4) See if configure told us where to look, if set */ -#if defined(OMPI_PRTERUN_PATH) - return strdup(OMPI_PRTERUN_PATH); -#else - - /* 5) Use path search */ - filename = opal_find_absolute_path("prterun"); - - return filename; -#endif -#endif -} static void append_prefixes(char ***out, const char *in) { @@ -119,10 +81,7 @@ static void setup_mca_prefixes(void) int main(int argc, char *argv[]) { char *opal_prefix = getenv("OPAL_PREFIX"); - char *full_prterun_path = NULL; - char **prterun_args = NULL; int ret; - size_t i; ret = opal_init_util(&argc, &argv); if (OMPI_SUCCESS != ret) { @@ -154,12 +113,6 @@ int main(int argc, char *argv[]) #endif } - full_prterun_path = find_prterun(); - if (NULL == full_prterun_path) { - opal_show_help("help-mpirun.txt", "no-prterun-found", 1); - exit(1); - } - /* * set environment variable for our install location * used within the OMPI prrte schizo component @@ -171,24 +124,14 @@ int main(int argc, char *argv[]) // to Open MPI. setup_mca_prefixes(); - /* calling mpirun (and now prterun) with a full path has a special - * meaning in terms of -prefix behavior, so copy that behavior - * into prterun */ - if (opal_path_is_absolute(argv[0])) { - opal_argv_append_nosize(&prterun_args, full_prterun_path); - } else { - opal_argv_append_nosize(&prterun_args, "prterun"); + + ret = prte_launch(argc, argv); + if (OMPI_SUCCESS != ret) { + opal_show_help("help-mpirun.txt", "prte-launch-failed", 1, strerror(errno)); + exit(1); } - /* Copy all the mpirun arguments to prterun. - * TODO: Need to handle --prefix rationally here. */ - for (i = 1; NULL != argv[i]; i++) { - opal_argv_append_nosize(&prterun_args, argv[i]); - } - ret = execv(full_prterun_path, prterun_args); - opal_show_help("help-mpirun.txt", "prterun-exec-failed", - 1, full_prterun_path, strerror(errno)); - exit(1); + return 0; } /* @@ -214,4 +157,4 @@ int main(int argc, char *argv[]) * Additional copyrights may follow * * $HEADER$ - */ + */ \ No newline at end of file