Skip to content

uofl: changes to Open MPI and move prrte/pmix shas #13299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "prrte"]
path = 3rd-party/prrte
url = ../../open-mpi/prrte
branch = master
branch = ompi_main
[submodule "openpmix"]
path = 3rd-party/openpmix
url = ../../openpmix/openpmix.git
Expand Down
2 changes: 1 addition & 1 deletion 3rd-party/openpmix
Submodule openpmix updated 407 files
2 changes: 1 addition & 1 deletion 3rd-party/prrte
Submodule prrte updated 418 files
16 changes: 16 additions & 0 deletions config/ompi_setup_prrte.m4
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ dnl Copyright (c) 2021 Nanook Consulting. All rights reserved.
dnl Copyright (c) 2021-2022 IBM Corporation. All rights reserved.
dnl Copyright (c) 2023-2024 Jeffrey M. Squyres. All rights reserved.
dnl Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved.
dnl Copyright (c) 2025 Triad National Security, LLC. All rights
dnl reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
Expand Down Expand Up @@ -98,6 +100,7 @@ OPAL_VAR_SCOPE_PUSH([prrte_setup_internal_happy prrte_setup_external_happy targe
AS_IF([test "$prrte_setup_external_happy" = "0" -a "$prrte_setup_internal_happy" = "1"],
[opal_prrte_mode="internal"
OMPI_USING_INTERNAL_PRRTE=1
OMPI_HAVE_PRTE_LAUNCH=1
_OMPI_SETUP_PRRTE_INTERNAL_POST()],
[OMPI_USING_INTERNAL_PRRTE=0])

Expand All @@ -118,10 +121,15 @@ OPAL_VAR_SCOPE_PUSH([prrte_setup_internal_happy prrte_setup_external_happy targe
[$OMPI_USING_INTERNAL_PRRTE],
[Whether or not we are using the internal PRRTE])

AM_CONDITIONAL(OMPI_USING_INTERNAL_PRRTE, [test $OMPI_USING_INTERNAL_PRRTE -eq 1])

AC_SUBST(OMPI_PRRTE_RST_CONTENT_DIR)
AC_SUBST(OMPI_SCHIZO_OMPI_RST_CONTENT_DIR)
AM_CONDITIONAL(OMPI_HAVE_PRRTE_RST, [test $OMPI_HAVE_PRRTE_RST -eq 1])

AC_DEFINE_UNQUOTED([OMPI_HAVE_PRTE_LAUNCH], $OMPI_HAVE_PRTE_LAUNCH,
[Whether prte_launch support available])

OPAL_SUMMARY_ADD([Miscellaneous], [PRRTE], [], [$opal_prrte_mode])

OPAL_VAR_SCOPE_POP
Expand Down Expand Up @@ -195,6 +203,9 @@ AC_DEFUN([_OMPI_SETUP_PRRTE_INTERNAL], [
opal_prrte_CPPFLAGS_save="${CPPFLAGS}"
OPAL_FLAGS_APPEND_UNIQ([CPPFLAGS], [${opal_pmix_CPPFLAGS}])

AC_DEFINE_UNQUOTED([OMPI_HAVE_PRTE_LAUNCH], [1],
[prte_launch support available in ompi (aka internal) prrte])

AC_MSG_CHECKING([if PMIx version is 4.0.0 or greater])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <pmix_version.h>]],
[[
Expand Down Expand Up @@ -297,6 +308,11 @@ AC_DEFUN([_OMPI_SETUP_PRRTE_EXTERNAL], [
AS_IF([test "${ompi_setup_prrte_cv_version_happy}" = "no"],
[setup_prrte_external_happy="no"])])

AS_IF([test "${setup_prrte_external_happy}" = "yes"],
[AC_CHECK_DECL([prte_launch],
[OMPI_HAVE_PRTE_LAUNCH=1], [OMPI_HAVE_PRTE_LAUNCH=0],
[#include "prte.h"])],[])

CPPFLAGS="$opal_prrte_CPPFLAGS_save"

# If an external build and the user told us where to find PRRTE,
Expand Down
5 changes: 4 additions & 1 deletion ompi/dpm/dpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1975,7 +1975,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

Expand Down
13 changes: 13 additions & 0 deletions ompi/tools/mpirun/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,28 @@

if OMPI_WANT_PRRTE

#
# to help VPATH'd builds find prrte_version.h
#
AM_CFLAGS = \
-I$(top_builddir)/3rd-party/prrte/include

bin_PROGRAMS = mpirun

EXTRA_DIST = 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
if OMPI_USING_INTERNAL_PRRTE
mpirun_LDADD += \
$(top_builddir)/3rd-party/prrte/src/libompi-prrte.la
endif

mpirun_CPPFLAGS = \
-DMCA_oshmem_FRAMEWORKS="\"$(MCA_oshmem_FRAMEWORKS)\"" \
Expand Down
6 changes: 6 additions & 0 deletions ompi/tools/mpirun/help-mpirun.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
# This is the US/English help file for Open MPI wrapper compiler error
# messages.
#
[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.

Error Message: %s

[no-prterun-found]
Open MPI's mpirun command was unable to find an underlying prterun
command to execute. Consider setting the OMPI_PRTERUN environment
Expand Down
161 changes: 97 additions & 64 deletions ompi/tools/mpirun/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,46 +28,10 @@
#include "opal/util/printf.h"
#include "opal/util/show_help.h"
#include "ompi/constants.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
#include "3rd-party/prrte/include/prte.h"
#endif
}


static void append_prefixes(char ***out, const char *in)
{
Expand Down Expand Up @@ -116,6 +80,98 @@ static void setup_mca_prefixes(void)
}


#if OMPI_HAVE_PRTE_LAUNCH

/* we can use prte_launch */

int main(int argc, char *argv[])
{
char *opal_prefix = getenv("OPAL_PREFIX");
int ret;

ret = opal_init_util(&argc, &argv);
if (OMPI_SUCCESS != ret) {
fprintf(stderr, "Failed initializing opal: %d\n", ret);
exit(1);
}

/* note that we just modify our environment rather than create a
* child environment because it is easier and we're not going to
* be around long enough for it to matter (since we exec prterun
* asap */
setenv("PRTE_MCA_schizo_proxy", "ompi", 1);
setenv("OMPI_VERSION", OMPI_VERSION, 1);
char *base_tool_name = opal_basename(argv[0]);
setenv("OMPI_TOOL_NAME", base_tool_name, 1);
free(base_tool_name);

/* TODO: look for --prefix and compare with OPAL_PREFIX and pick
* one */

/* as a special case, if OPAL_PREFIX was set and either PRRTE or
* PMIx are internal builds, set their prefix variables as well */
if (NULL != opal_prefix) {
#if OMPI_USING_INTERNAL_PRRTE
setenv("PRTE_PREFIX", opal_prefix, 1);
#endif
#if OPAL_USING_INTERNAL_PMIX
setenv("PMIX_PREFIX", opal_prefix, 1);
#endif
}

/*
* set environment variable for our install location
* used within the OMPI prrte schizo component
*/

setenv("OMPI_LIBDIR_LOC", opal_install_dirs.libdir, 1);

// Set environment variable to tell PRTE what MCA prefixes belong
// to Open MPI.
setup_mca_prefixes();


ret = prte_launch(argc, argv);
if (OMPI_SUCCESS != ret) {
opal_show_help("help-mpirun.txt", "prte-launch-failed", 1, strerror(errno));
exit(1);
}

return 0;
}

#else

static char *find_prterun(void)
{
char *filename = NULL;
char *prrte_prefix = NULL;

/* 1) Did the user tell us exactly where to find prterun? */
filename = getenv("OMPI_PRTERUN");
if (NULL != filename) {
return filename;
}

/* 2) 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
}

int main(int argc, char *argv[])
{
char *opal_prefix = getenv("OPAL_PREFIX");
Expand Down Expand Up @@ -188,30 +244,7 @@ int main(int argc, char *argv[])
ret = execv(full_prterun_path, prterun_args);
opal_show_help("help-mpirun.txt", "prterun-exec-failed",
1, full_prterun_path, strerror(errno));
exit(1);
}
exit(1);
}
#endif /* OMPI_HAVE_PRTE_LAUNCH */

/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2017-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2020-2022 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
* Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
* Copyright (c) 2022 Triad National Security, LLC. All rights
* reserved.

* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/