20
20
* Copyright (c) 2014-2020 Research Organization for Information Science
21
21
* and Technology (RIST). All rights reserved.
22
22
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
23
- * Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
23
+ * Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
24
24
* Copyright (c) 2018-2022 Triad National Security, LLC. All rights
25
25
* reserved.
26
26
* Copyright (c) 2022 IBM Corporation. All rights reserved.
53
53
#include "opal/util/show_help.h"
54
54
#include "opal/util/printf.h"
55
55
#include "opal/mca/hwloc/base/base.h"
56
+ #include "opal/mca/installdirs/base/base.h"
56
57
#include "opal/mca/pmix/base/base.h"
57
58
58
59
#include "ompi/communicator/communicator.h"
@@ -1974,6 +1975,46 @@ static void set_handler_default(int sig)
1974
1975
sigaction (sig , & act , (struct sigaction * )0 );
1975
1976
}
1976
1977
1978
+ static char * find_prte (void )
1979
+ {
1980
+ char * filename = NULL ;
1981
+ #if !OMPI_USING_INTERNAL_PRRTE
1982
+ char * prrte_prefix = NULL ;
1983
+ #endif
1984
+
1985
+ /* 1) Did the user tell us exactly where to find prte? */
1986
+ filename = getenv ("OMPI_PRTERUN" );
1987
+ if (NULL != filename ) {
1988
+ return filename ;
1989
+ }
1990
+
1991
+ #if OMPI_USING_INTERNAL_PRRTE
1992
+ /* 2) If using internal PRRTE, use our bindir. Note that this
1993
+ * will obey OPAL_PREFIX and OPAL_DESTDIR */
1994
+ opal_asprintf (& filename , "%s%sprte" , opal_install_dirs .bindir , OPAL_PATH_SEP );
1995
+ return filename ;
1996
+ #else
1997
+
1998
+ /* 3) Look in ${PRTE_PREFIX}/bin */
1999
+ prrte_prefix = getenv ("PRTE_PREFIX" );
2000
+ if (NULL != prrte_prefix ) {
2001
+ opal_asprintf (& filename , "%s%sbin%sprte" , prrte_prefix , OPAL_PATH_SEP , OPAL_PATH_SEP );
2002
+ return filename ;
2003
+ }
2004
+
2005
+ /* 4) See if configure told us where to look, if set */
2006
+ #if defined(OMPI_PRTERUN_PATH )
2007
+ return strdup (OMPI_PRTERUN_PATH );
2008
+ #else
2009
+
2010
+ /* 5) Use path search */
2011
+ filename = opal_find_absolute_path ("prte" );
2012
+
2013
+ return filename ;
2014
+ #endif
2015
+ #endif
2016
+ }
2017
+
1977
2018
static int start_dvm (char * * hostfiles , char * * dash_host )
1978
2019
{
1979
2020
pmix_status_t pret ;
@@ -1987,11 +2028,23 @@ static int start_dvm(char **hostfiles, char **dash_host)
1987
2028
pmix_info_t info ;
1988
2029
int buffer_length , num_chars_read , chunk ;
1989
2030
char * uri ;
2031
+ char * opal_prefix = getenv ("OPAL_PREFIX" );
2032
+
2033
+ /* as a special case, if OPAL_PREFIX was set and either PRRTE or
2034
+ * PMIx are internal builds, set their prefix variables as well */
2035
+ if (NULL != opal_prefix ) {
2036
+ #if OMPI_USING_INTERNAL_PRRTE
2037
+ setenv ("PRTE_PREFIX" , opal_prefix , 1 );
2038
+ #endif
2039
+ #if OPAL_USING_INTERNAL_PMIX
2040
+ setenv ("PMIX_PREFIX" , opal_prefix , 1 );
2041
+ #endif
2042
+ }
1990
2043
1991
2044
/* find the prte binary using the install_dirs support - this also
1992
2045
* checks to ensure that we can see this executable and it *is* executable by us
1993
2046
*/
1994
- cmd = opal_find_absolute_path ( "prte" );
2047
+ cmd = find_prte ( );
1995
2048
if (NULL == cmd ) {
1996
2049
/* guess we couldn't do it - best to abort */
1997
2050
OMPI_ERROR_LOG (OMPI_ERROR );
0 commit comments