diff --git a/configure.ac b/configure.ac index 286972132d..8489ad8da9 100644 --- a/configure.ac +++ b/configure.ac @@ -1114,6 +1114,11 @@ AC_SUBST(CXXCPPFLAGS) AC_SUBST(FFLAGS) AC_SUBST(FCFLAGS) +# +# Aggregate MCA parameters directory +# +AC_SUBST([AMCA_PARAM_SETS_DIR], ['$(pkgdatadir)/amca-param-sets']) + ############################################################################ # final wrapper compiler config ############################################################################ diff --git a/contrib/Makefile.am b/contrib/Makefile.am index ca69221820..830fa050ad 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# Copyright (c) 2004-2007 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 @@ -16,7 +16,8 @@ # $HEADER$ # - +amca_paramdir = $(AMCA_PARAM_SETS_DIR) +dist_amca_param_DATA = amca-param-sets/example.conf EXTRA_DIST = \ dist/make_dist_tarball \ diff --git a/contrib/amca-param-sets/example.conf b/contrib/amca-param-sets/example.conf new file mode 100644 index 0000000000..f9fa6cd95f --- /dev/null +++ b/contrib/amca-param-sets/example.conf @@ -0,0 +1,5 @@ +# +# This is an example file illustrating how to setup an Aggregate MCA parameters +# file. +# +# diff --git a/ompi/mca/btl/openib/Makefile.am b/ompi/mca/btl/openib/Makefile.am index ab554b3554..83e4230caa 100644 --- a/ompi/mca/btl/openib/Makefile.am +++ b/ompi/mca/btl/openib/Makefile.am @@ -9,6 +9,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. +# Copyright (c) 2007 Cisco, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -22,6 +23,9 @@ AM_CPPFLAGS = $(btl_openib_CPPFLAGS) -DPKGDATADIR=\"$(pkgdatadir)\" AM_LFLAGS = -Pbtl_openib_ini_yy LEX_OUTPUT_ROOT = lex.btl_openib_ini_yy +amca_paramdir = $(AMCA_PARAM_SETS_DIR) +dist_amca_param_DATA = btl-openib-benchmark + dist_pkgdata_DATA = \ help-mpi-btl-openib.txt \ mca-btl-openib-hca-params.ini diff --git a/ompi/mca/btl/openib/btl-openib-benchmark b/ompi/mca/btl/openib/btl-openib-benchmark new file mode 100644 index 0000000000..3798c333b5 --- /dev/null +++ b/ompi/mca/btl/openib/btl-openib-benchmark @@ -0,0 +1,19 @@ +# +# These values are suitable for benchmarking with the openib and sm +# btls with a small number of MPI processes. If you're only going to +# use one process per node, remove "sm". These values are *NOT* +# scalable to large numbers of processes! +# +btl=openib,self,sm +btl_openib_max_btls=20 +btl_openib_rd_num=128 +btl_openib_rd_low=75 +btl_openib_rd_win=50 +btl_openib_max_eager_rdma=32 +mpool_base_use_mem_hooks=1 +mpi_leave_pinned=1 +# +# Note that we are not limiting the max free list size, so for netpipe +# (for example), this is no problem. But we may want to explore the +# parameter space for other popular benchmarks. +# diff --git a/ompi/mca/btl/template/Makefile.am b/ompi/mca/btl/template/Makefile.am index dea31fafa5..545f7f809a 100644 --- a/ompi/mca/btl/template/Makefile.am +++ b/ompi/mca/btl/template/Makefile.am @@ -18,6 +18,8 @@ # Use the top-level Makefile.options +amca_paramdir = $(AMCA_PARAM_SETS_DIR) +dist_amca_param_DATA = netpipe-btl-template.txt sources = \ diff --git a/ompi/mca/btl/template/sample-btl-template.conf b/ompi/mca/btl/template/sample-btl-template.conf new file mode 100644 index 0000000000..e6f38d6bbb --- /dev/null +++ b/ompi/mca/btl/template/sample-btl-template.conf @@ -0,0 +1,5 @@ +# +# To use: +# -am sample-btl-template.conf +# +btl_template_verbose=42 diff --git a/opal/mca/base/help-mca-param.txt b/opal/mca/base/help-mca-param.txt index 8fa2c128af..f69d06ddb6 100644 --- a/opal/mca/base/help-mca-param.txt +++ b/opal/mca/base/help-mca-param.txt @@ -23,3 +23,6 @@ WARNING: A user-supplied value attempted to override the read-only MCA parameter named "%s". The user-supplied value was ignored. +[missing-param-file] +Process %d Unable to locate the parameter file "%s" in the following search path: + %s diff --git a/opal/mca/base/mca_base_cmd_line.c b/opal/mca/base/mca_base_cmd_line.c index 18aeb5db73..0e085e794a 100644 --- a/opal/mca/base/mca_base_cmd_line.c +++ b/opal/mca/base/mca_base_cmd_line.c @@ -45,7 +45,8 @@ static void add_to_env(char **params, char **values, char ***env); */ int mca_base_cmd_line_setup(opal_cmd_line_t *cmd) { - int ret; + int ret = OPAL_SUCCESS; + ret = opal_cmd_line_make_opt3(cmd, '\0', "mca", "mca", 2, "Pass context-specific MCA parameters; they are considered global if --gmca is not used and only one context is specified (arg0 is the parameter name; arg1 is the parameter value)"); if (OPAL_SUCCESS != ret) { @@ -54,6 +55,23 @@ int mca_base_cmd_line_setup(opal_cmd_line_t *cmd) ret = opal_cmd_line_make_opt3(cmd, '\0', "gmca", "gmca", 2, "Pass global MCA parameters that are applicable to all contexts (arg0 is the parameter name; arg1 is the parameter value)"); + + if (OPAL_SUCCESS != ret) { + return ret; + } + + { + opal_cmd_line_init_t entry = + {"mca", "base", "param_file_prefix", '\0', "am", NULL, 1, + NULL, OPAL_CMD_LINE_TYPE_STRING, + "Aggregate MCA parameter set file list" + }; + ret = opal_cmd_line_make_opt_mca(cmd, entry); + if (OPAL_SUCCESS != ret) { + return ret; + } + } + return ret; } diff --git a/opal/mca/base/mca_base_param.c b/opal/mca/base/mca_base_param.c index edc97624c4..c2159b67e8 100644 --- a/opal/mca/base/mca_base_param.c +++ b/opal/mca/base/mca_base_param.c @@ -21,9 +21,16 @@ #include #include #include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SYS_PARAM_H +#include +#endif #include "opal/install_dirs.h" #include "opal/util/os_path.h" +#include "opal/util/path.h" #include "opal/class/opal_value_array.h" #include "opal/util/show_help.h" #include "opal/class/opal_hash_table.h" @@ -40,6 +47,16 @@ #include "opal/constants.h" #include "opal/util/output.h" +/* + * A boolean to temporarily skip over the Aggregate MCA Paramater Set + * reading. + * We need to do this as a global variable since all other entry + * functions to the _param_ funcitons make sure that the init function + * has been called. By calling init the system will pick up the + * wrong files + */ +bool opal_mca_base_param_use_amca_sets = true; + /* * Public variables * @@ -55,6 +72,7 @@ opal_list_t mca_base_param_file_values; static opal_value_array_t mca_base_params; static const char *mca_prefix = "OMPI_MCA_"; static char *home = NULL; +static char *cwd = NULL; static bool initialized = false; @@ -64,6 +82,7 @@ static bool initialized = false; #if defined(__WINDOWS__) static int read_keys_from_registry(HKEY hKey, char *sub_key, char *current_key); #endif /* defined(__WINDOWS__) */ +static int fixup_files(char **file_list, char * path, bool rel_path_search); static int read_files(char *file_list); static int param_register(const char *type_name, const char *component_name, @@ -117,9 +136,6 @@ OBJ_CLASS_INSTANCE(mca_base_param_info_t, opal_list_item_t, */ int mca_base_param_init(void) { - int id; - char *files, *new_files = NULL; - if (!initialized) { /* Init the value array for the param storage */ @@ -135,33 +151,92 @@ int mca_base_param_init(void) initialized = true; - /* We may need this later */ + mca_base_param_recache_files(false); + } + + return OPAL_SUCCESS; +} + +int mca_base_param_recache_files(bool rel_path_search) +{ + int id; + char *files, *new_files = NULL, *new_agg_files = NULL; + char * new_agg_path = NULL, *agg_default_path = NULL; + + /* We may need this later */ #if !defined(__WINDOWS__) - home = getenv("HOME"); - asprintf(&files, - "%s"OPAL_PATH_SEP".openmpi"OPAL_PATH_SEP"mca-params.conf:%s"OPAL_PATH_SEP"openmpi-mca-params.conf", - home, OPAL_SYSCONFDIR); + home = getenv("HOME"); #else - home = getenv("USERPROFILE"); - asprintf(&files, - "%s"OPAL_PATH_SEP".openmpi"OPAL_PATH_SEP"mca-params.conf;%s"OPAL_PATH_SEP"openmpi-mca-params.conf", - home, OPAL_SYSCONFDIR); + home = getenv("USERPROFILE"); #endif /* !defined(__WINDOWS__) */ - - /* Initialize a parameter that says where MCA param files can - be found */ - - id = mca_base_param_reg_string_name("mca", "param_files", - "Path for MCA configuration files containing default parameter values", - false, false, files, &new_files); - read_files(new_files); -#if defined(__WINDOWS__) - read_keys_from_registry(HKEY_CURRENT_USER, "SOFTWARE\\Open MPI", NULL); -#endif /* defined(__WINDOWS__) */ + cwd = (char *) malloc(sizeof(char) * MAXPATHLEN); + if( NULL == (cwd = getcwd(cwd, MAXPATHLEN) )) { + opal_output(0, "Error: Unable to get the current working directory\n"); + cwd = strdup("."); + } - free(files); - free(new_files); + asprintf(&files, + "%s"OPAL_PATH_SEP".openmpi"OPAL_PATH_SEP"mca-params.conf%c%s"OPAL_PATH_SEP"openmpi-mca-params.conf", + home, OPAL_ENV_SEP, OPAL_SYSCONFDIR); + + + /* Initialize a parameter that says where MCA param files can + be found */ + + id = mca_base_param_reg_string_name("mca", "param_files", + "Path for MCA configuration files containing default parameter values", + false, false, files, &new_files); + + /* Aggregate MCA parameter files + * A prefix search path to look up aggregate MCA parameter file + * requests that do not specify an absolute path + */ + id = mca_base_param_reg_string_name("mca", "base_param_file_prefix", + "Aggregate MCA parameter file sets", + false, false, NULL, &new_agg_files); + + asprintf(&agg_default_path, + "%s"OPAL_PATH_SEP"amca-param-sets%c%s", + OPAL_PKGDATADIR, OPAL_ENV_SEP, cwd); + id = mca_base_param_reg_string_name("mca", "base_param_file_path", + "Aggregate MCA parameter Search path", + false, false, agg_default_path, &new_agg_path); + + if( opal_mca_base_param_use_amca_sets && NULL != new_agg_files ) { + char *tmp_str = NULL; + + /* + * Resolve all relative paths. + * the file list returned will contain only absolute paths + */ + if( OPAL_SUCCESS != fixup_files(&new_agg_files, new_agg_path, rel_path_search) ) { +#if 0 + /* JJH We need to die! */ + abort(); +#else + ; +#endif + } + else { + /* Prepend the files to the search list */ + asprintf(&tmp_str, "%s%c%s", new_agg_files, OPAL_ENV_SEP, new_files); + free(new_files); + new_files = strdup(tmp_str); + free(tmp_str); + } + } + + read_files(new_files); + +#if defined(__WINDOWS__) + read_keys_from_registry(HKEY_CURRENT_USER, "SOFTWARE\\Open MPI", NULL); +#endif /* defined(__WINDOWS__) */ + + free(files); + free(new_files); + if( NULL != new_agg_files ) { + free(new_agg_files); } return OPAL_SUCCESS; @@ -786,6 +861,93 @@ int mca_base_param_finalize(void) /*************************************************************************/ +static int fixup_files(char **file_list, char * path, bool rel_path_search) { + int exit_status = OPAL_SUCCESS; + char **files = NULL; + char **search_path = NULL; + char * tmp_file = NULL; + char **argv = NULL; + int mode = R_OK; /* The file exists, and we can read it */ + int count, i, argc = 0; + + search_path = opal_argv_split(path, OPAL_ENV_SEP); + files = opal_argv_split(*file_list, OPAL_ENV_SEP); + count = opal_argv_count(files); + + /* Read in reverse order, so we can preserve the original ordering */ + for (i = 0 ; i < count; ++i) { + /* Absolute paths preserved */ + if ( opal_path_is_absolute(files[i]) ) { + if( NULL == opal_path_access(files[i], NULL, mode) ) { + opal_show_help("help-mca-param.txt", "missing-param-file", + true, getpid(), files[i], path); + exit_status = OPAL_ERROR; + goto cleanup; + } + else { + opal_argv_append(&argc, &argv, files[i]); + } + } + /* Resolve all relative paths: + * - If filename contains a "/" (e.g., "./foo" or "foo/bar") + * - look for it relative to cwd + * - if exists, use it + * - ow warn/error + */ + else if (!rel_path_search && NULL != strchr(files[i], OPAL_PATH_SEP[0]) ) { + if( NULL == (tmp_file = opal_path_access(files[i], cwd, mode) ) ) { + opal_show_help("help-mca-param.txt", "missing-param-file", + true, getpid(), files[i], cwd); + exit_status = OPAL_ERROR; + goto cleanup; + } + else { + opal_argv_append(&argc, &argv, tmp_file); + } + } + /* Resolve all relative paths: + * - Use path resolution + * - if found and readable, use it + * - otherwise, warn/error + */ + else { + if( NULL != (tmp_file = opal_path_find(files[i], search_path, mode, NULL)) ) { + opal_argv_append(&argc, &argv, tmp_file); + free(tmp_file); + tmp_file = NULL; + } + else { + opal_show_help("help-mca-param.txt", "missing-param-file", + true, getpid(), files[i], path); + exit_status = OPAL_ERROR; + goto cleanup; + } + } + } + + free(*file_list); + *file_list = opal_argv_join(argv, OPAL_ENV_SEP); + + cleanup: + if( NULL != files ) { + opal_argv_free(files); + files = NULL; + } + if( NULL != argv ) { + opal_argv_free(argv); + argv = NULL; + } + if( NULL != search_path ) { + opal_argv_free(search_path); + search_path = NULL; + } + if( NULL != tmp_file ) { + free(tmp_file); + tmp_file = NULL; + } + + return exit_status; +} static int read_files(char *file_list) { diff --git a/opal/mca/base/mca_base_param.h b/opal/mca/base/mca_base_param.h index 4ad161ae0c..dbb45b6cd6 100644 --- a/opal/mca/base/mca_base_param.h +++ b/opal/mca/base/mca_base_param.h @@ -119,6 +119,14 @@ typedef struct mca_base_param_info_t mca_base_param_info_t; #if defined(c_plusplus) || defined(__cplusplus) extern "C" { #endif + + /* + * Whether or not to temporarily skip over the Aggregate MCA Paramater Set + * reading. This is useful when we know the MCA parameters it will use + * are incorrect which occurs with some support tools. + */ + OPAL_DECLSPEC extern bool opal_mca_base_param_use_amca_sets; + /** * Make a real object for the info */ @@ -135,6 +143,16 @@ extern "C" { */ OPAL_DECLSPEC int mca_base_param_init(void); + /** + * Recache the MCA param files + * + * @param rel_path_search If a relative path is found, search the path even + * if the relative path in pointing to the current working directory. + * @retval OPAL_SUCCESS + * + */ + OPAL_DECLSPEC int mca_base_param_recache_files(bool rel_path_search); + /** * Register an integer MCA parameter. * diff --git a/opal/util/cmd_line.c b/opal/util/cmd_line.c index e10d9b2394..a6a7dff6dd 100644 --- a/opal/util/cmd_line.c +++ b/opal/util/cmd_line.c @@ -178,6 +178,26 @@ int opal_cmd_line_create(opal_cmd_line_t *cmd, return OPAL_SUCCESS; } +/* + * Append a command line entry to the previously constructed command line + */ +int opal_cmd_line_make_opt_mca(opal_cmd_line_t *cmd, + opal_cmd_line_init_t entry) +{ + int ret; + + /* Ensure we got an entry */ + if ('\0' == entry.ocl_cmd_short_name && + NULL == entry.ocl_cmd_single_dash_name && + NULL == entry.ocl_cmd_long_name) { + return OPAL_SUCCESS; + } + + ret = make_opt(cmd, &entry); + + return OPAL_SUCCESS; +} + /* * Create a command line option, --long-name and/or -s (short name). diff --git a/opal/util/cmd_line.h b/opal/util/cmd_line.h index 945c937481..123f7950b4 100644 --- a/opal/util/cmd_line.h +++ b/opal/util/cmd_line.h @@ -277,6 +277,18 @@ extern "C" { OPAL_DECLSPEC int opal_cmd_line_create(opal_cmd_line_t *cmd, opal_cmd_line_init_t *table); + /** + * Create a command line option. + * + * @param cmd OPAL command line handle. + * @param entry Command line entry to add to the command line. + * + * @retval OPAL_SUCCESS Upon success. + * + */ + OPAL_DECLSPEC int opal_cmd_line_make_opt_mca(opal_cmd_line_t *cmd, + opal_cmd_line_init_t entry); + /** * \deprecated * diff --git a/opal/util/path.c b/opal/util/path.c index 5e420239d7..cced8a6556 100644 --- a/opal/util/path.c +++ b/opal/util/path.c @@ -29,7 +29,6 @@ #include "opal/util/output.h" static void path_env_load(char *path, int *pargc, char ***pargv); -static char *path_access(char *fname, char *path, int mode); static char *list_env_get(char *var, char **list); bool opal_path_is_absolute( const char *path ) @@ -60,7 +59,7 @@ char *opal_path_find(char *fname, char **pathv, int mode, char **envv) /* If absolute path is given, return it without searching. */ if( opal_path_is_absolute(fname) ) { - return path_access(fname, "", mode); + return opal_path_access(fname, "", mode); } /* Initialize. */ @@ -85,7 +84,7 @@ char *opal_path_find(char *fname, char **pathv, int mode, char **envv) } if (NULL != env) { if (!delimit) { - fullpath = path_access(fname, env, mode); + fullpath = opal_path_access(fname, env, mode); } else { pfix = (char*) malloc(strlen(env) + strlen(delimit) + 1); if (NULL == pfix) { @@ -93,13 +92,13 @@ char *opal_path_find(char *fname, char **pathv, int mode, char **envv) } strcpy(pfix, env); strcat(pfix, delimit); - fullpath = path_access(fname, pfix, mode); + fullpath = opal_path_access(fname, pfix, mode); free(pfix); } } } else { - fullpath = path_access(fname, pathv[i], mode); + fullpath = opal_path_access(fname, pathv[i], mode); } i++; } @@ -170,12 +169,17 @@ char *opal_path_findv(char *fname, int mode, char **envv, char *wrkdir) * -Full pathname of located file Success * -NULL Failure */ -static char *path_access(char *fname, char *path, int mode) +char *opal_path_access(char *fname, char *path, int mode) { - char *fullpath; + char *fullpath = NULL; /* Allocate space for the full pathname. */ - fullpath = opal_os_path( false, path, fname, NULL ); + if( NULL == path ) { + fullpath = opal_os_path( false, fname, NULL ); + } + else { + fullpath = opal_os_path( false, path, fname, NULL ); + } if( NULL == fullpath ) return NULL; diff --git a/opal/util/path.h b/opal/util/path.h index bc06bd4244..91d0cbfa15 100644 --- a/opal/util/path.h +++ b/opal/util/path.h @@ -83,6 +83,19 @@ extern "C" { */ OPAL_DECLSPEC bool opal_path_is_absolute( const char *path ); + /** + * Forms a complete pathname and checks it for existance and + * permissions + * + * @param fname File name + * @param path Path prefix, if NULL then fname is an absolute path + * @param mode Target permissions which must be satisfied (see access(2)) + * + * @retval NULL Failure + * @retval Full pathname of the located file on Success + */ + OPAL_DECLSPEC char *opal_path_access(char *fname, char *path, int mode); + #if defined(c_plusplus) || defined(__cplusplus) } #endif diff --git a/orte/mca/pls/rsh/pls_rsh_module.c b/orte/mca/pls/rsh/pls_rsh_module.c index ccb77bf637..d990460755 100644 --- a/orte/mca/pls/rsh/pls_rsh_module.c +++ b/orte/mca/pls/rsh/pls_rsh_module.c @@ -712,6 +712,52 @@ int orte_pls_rsh_launch(orte_jobid_t jobid) free(uri); free(param); + /* pass along the Aggregate MCA Parameter Sets */ + { + int loc_id; + char * amca_param_path = NULL; + char * amca_param_prefix = NULL; + + /* Add the 'prefix' param */ + loc_id = mca_base_param_find("mca", NULL, "base_param_file_prefix"); + mca_base_param_lookup_string(loc_id, &amca_param_prefix); + if( NULL != amca_param_prefix ) { + /* Could also use the short version '-am' + * but being verbose has some value + */ + opal_argv_append(&argc, &argv, "-mca"); + opal_argv_append(&argc, &argv, "mca_base_param_file_prefix"); + opal_argv_append(&argc, &argv, amca_param_prefix); + } + + /* Add the 'path' param */ + loc_id = mca_base_param_find("mca", NULL, "base_param_file_path"); + mca_base_param_lookup_string(loc_id, &amca_param_path); + if( NULL != amca_param_path ) { + opal_argv_append(&argc, &argv, "-mca"); + opal_argv_append(&argc, &argv, "mca_base_param_file_path"); + opal_argv_append(&argc, &argv, amca_param_path); + } + + /* Add the ORTED hint 'path' param */ + loc_id = mca_base_param_find("mca", NULL, "base_param_file_path_orted"); + mca_base_param_lookup_string(loc_id, &amca_param_path); + if( NULL != amca_param_path ) { + opal_argv_append(&argc, &argv, "-mca"); + opal_argv_append(&argc, &argv, "mca_base_param_file_path_orted"); + opal_argv_append(&argc, &argv, amca_param_path); + } + + if( NULL != amca_param_path ) { + free(amca_param_path); + amca_param_path = NULL; + } + if( NULL != amca_param_prefix ) { + free(amca_param_prefix); + amca_param_prefix = NULL; + } + } + local_exec_index_end = argc; if (!(remote_csh || remote_sh)) { opal_argv_append(&argc, &argv, ")"); diff --git a/orte/tools/orted/orted.c b/orte/tools/orted/orted.c index 8bcbbbe04c..f9dcb69970 100644 --- a/orte/tools/orted/orted.c +++ b/orte/tools/orted/orted.c @@ -200,6 +200,7 @@ int main(int argc, char *argv[]) char *segment; int i; orte_buffer_t answer; + char * orted_amca_param_path = NULL; /* initialize the globals */ memset(&orted_globals, 0, sizeof(orted_globals_t)); @@ -207,12 +208,17 @@ int main(int argc, char *argv[]) /* save the environment for use when launching application processes */ orted_globals.saved_environ = opal_argv_copy(environ); - /* setup mca param system */ + /* setup mca param system + * Do not parse the Aggregate Parameter Sets in this pass. + * we will get to them in a moment + */ + opal_mca_base_param_use_amca_sets = false; mca_base_param_init(); /* setup to check common command line options that just report and die */ cmd_line = OBJ_NEW(opal_cmd_line_t); opal_cmd_line_create(cmd_line, orte_cmd_line_opts); + mca_base_cmd_line_setup(cmd_line); if (ORTE_SUCCESS != (ret = opal_cmd_line_parse(cmd_line, false, argc, argv))) { char *args = NULL; @@ -223,6 +229,64 @@ int main(int argc, char *argv[]) return ret; } + /* + * Since this process can now handle MCA/GMCA parameters, make sure to + * process them. + */ + mca_base_cmd_line_process_args(cmd_line, &environ, &environ); + + /* + * orterun may have given us an additional path to use when looking for + * Aggregate MCA parameter sets. Look it up, and prepend it to the + * search list. + */ + mca_base_param_reg_string_name("mca", "base_param_file_path_orted", + "[INTERNAL] Current working directory from MPIRUN to help in finding Aggregate MCA parameters", + true, false, + NULL, + &orted_amca_param_path); + + if( NULL != orted_amca_param_path ) { + int loc_id; + char * amca_param_path = NULL; + char * tmp_str = NULL; + + /* Lookup the current Aggregate MCA Parameter set path */ + loc_id = mca_base_param_find("mca", NULL, "base_param_file_path"); + mca_base_param_lookup_string(loc_id, &amca_param_path); + + asprintf(&tmp_str, "%s%c%s", orted_amca_param_path, OPAL_ENV_SEP, amca_param_path); + + mca_base_param_set_string(loc_id, tmp_str); + + loc_id = mca_base_param_find("mca", NULL, "base_param_file_path"); + mca_base_param_lookup_string(loc_id, &amca_param_path); + + if( NULL != amca_param_path) { + free(amca_param_path); + amca_param_path = NULL; + } + if( NULL != orted_amca_param_path) { + free(orted_amca_param_path); + orted_amca_param_path = NULL; + } + if( NULL != tmp_str) { + free(tmp_str); + tmp_str = NULL; + } + + /* + * Need to recache the files since the user might have given us + * Aggregate MCA parameters that need to be reinitalized. + */ + opal_mca_base_param_use_amca_sets = true; + mca_base_param_recache_files(true); + } + else { + opal_mca_base_param_use_amca_sets = true; + mca_base_param_recache_files(false); + } + /* check for help request */ if (orted_globals.help) { char *args = NULL; diff --git a/orte/tools/orterun/orterun.c b/orte/tools/orterun/orterun.c index 128a64d213..661acc596c 100644 --- a/orte/tools/orterun/orterun.c +++ b/orte/tools/orterun/orterun.c @@ -317,9 +317,13 @@ int orterun(int argc, char *argv[]) opal_list_t attributes; opal_list_item_t *item; uint8_t flow; + char * cwd = NULL; - /* Setup MCA params */ - + /* Setup MCA params + * Do not parse the Aggregate Parameter Sets in this pass. + * we will get to them in a moment + */ + opal_mca_base_param_use_amca_sets = true; mca_base_param_init(); orte_register_params(false); @@ -335,6 +339,29 @@ int orterun(int argc, char *argv[]) parse_locals(argc, argv); + /* + * Get the current working directory + */ + cwd = (char *) malloc(sizeof(char) * MAXPATHLEN); + if( NULL == (cwd = getcwd(cwd, MAXPATHLEN) )) { + cwd = strdup(""); + } + + /* + * Need to recache the files since the user might have given us + * Aggregate MCA parameters that need to be reinitalized. + * In addition we need to let the orted know about the current working + * directory so that it has another place to look for any Aggregate MCA + * parameter set files + */ + mca_base_param_reg_string_name("mca", "base_param_file_path_orted", + "[INTERNAL] Current working directory from MPIRUN to help in finding Aggregate MCA parameters", + true, false, + cwd, + &cwd); + opal_mca_base_param_use_amca_sets = true; + mca_base_param_recache_files(false); + /* Convert the list of apps to an array of orte_app_context_t pointers */ array_size = orte_pointer_array_get_size(apps_pa);