1
1

Improve the new MPI_INFO_ENV to better handle Java applications and to correctly report the info for singletons.

This commit was SVN r27025.
Этот коммит содержится в:
Ralph Castain 2012-08-13 22:13:49 +00:00
родитель 3938ec5361
Коммит 589acf550c
7 изменённых файлов: 144 добавлений и 17 удалений

21
contrib/platform/lanl/macosx-dynamic-java Обычный файл
Просмотреть файл

@ -0,0 +1,21 @@
with_memory_manager=no
enable_mem_debug=yes
enable_mem_profile=no
enable_debug_symbols=yes
enable_binaries=yes
with_devel_headers=yes
enable_heterogeneous=no
enable_picky=yes
enable_debug=yes
enable_shared=yes
enable_static=no
enable_contrib_no_build=libnbc,vt
with_xgrid=no
enable_io_romio=no
enable_ipv6=no
enable_mpi_fortran=no
enable_mpi_cxx=no
enable_mpi_cxx_seek=no
enable_mpi_java=yes
enable_memchecker=no
enable_mca_no_build=pml-dr,pml-crcp2,pml-cm,crcp,filem,pml-v

Просмотреть файл

@ -0,0 +1,63 @@
#
# 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) 2006 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# This is the default system-wide MCA parameters defaults file.
# Specifically, the MCA parameter "mca_param_files" defaults to a
# value of
# "$HOME/.openmpi/mca-params.conf:$sysconf/openmpi-mca-params.conf"
# (this file is the latter of the two). So if the default value of
# mca_param_files is not changed, this file is used to set system-wide
# MCA parameters. This file can therefore be used to set system-wide
# default MCA parameters for all users. Of course, users can override
# these values if they want, but this file is an excellent location
# for setting system-specific MCA parameters for those users who don't
# know / care enough to investigate the proper values for them.
# Note that this file is only applicable where it is visible (in a
# filesystem sense). Specifically, MPI processes each read this file
# during their startup to determine what default values for MCA
# parameters should be used. mpirun does not bundle up the values in
# this file from the node where it was run and send them to all nodes;
# the default value decisions are effectively distributed. Hence,
# these values are only applicable on nodes that "see" this file. If
# $sysconf is a directory on a local disk, it is likely that changes
# to this file will need to be propagated to other nodes. If $sysconf
# is a directory that is shared via a networked filesystem, changes to
# this file will be visible to all nodes that share this $sysconf.
# The format is straightforward: one per line, mca_param_name =
# rvalue. Quoting is ignored (so if you use quotes or escape
# characters, they'll be included as part of the value). For example:
# Disable run-time MPI parameter checking
# mpi_param_check = 0
# Note that the value "~/" will be expanded to the current user's home
# directory. For example:
# Change component loading path
# component_path = /usr/local/lib/openmpi:~/my_openmpi_components
# See "ompi_info --param all all" for a full listing of Open MPI MCA
# parameters available and their default values.
#
# Basic behavior to smooth startup
orte_abort_timeout = 10

Просмотреть файл

@ -93,7 +93,7 @@ opal_pointer_array_t ompi_info_f_to_c_table;
* fortran to C translation table. It also fills in the values
* for the MPI_INFO_GET_ENV object
*/
int ompi_info_init(int argc, char **argv)
int ompi_info_init(void)
{
char tmp[MPI_MAX_INFO_KEY];
char *cptr;
@ -117,18 +117,13 @@ int ompi_info_init(int argc, char **argv)
/* fill the env info object */
/* command for this app_context */
if (NULL != argv[0]) {
/* Java eats the name of the cmd, so argv will
* be empty
*/
ompi_info_set(&ompi_mpi_info_env.info, "command", argv[0]);
if (NULL != (cptr = getenv("OMPI_COMMAND"))) {
ompi_info_set(&ompi_mpi_info_env.info, "command", cptr);
}
/* space-separated list of argv for this command */
if (1 < argc) {
cptr = opal_argv_join(&argv[1], ' ');
if (NULL != (cptr = getenv("OMPI_ARGV"))) {
ompi_info_set(&ompi_mpi_info_env.info, "argv", cptr);
free(cptr);
}
/* max procs for the entire job */

Просмотреть файл

@ -126,7 +126,7 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_info_entry_t);
* This function is invoked during ompi_mpi_init() and sets up
* MPI_Info handling.
*/
int ompi_info_init(int argc, char **argv);
int ompi_info_init(void);
/**
* This functions is called during ompi_mpi_finalize() and shuts

Просмотреть файл

@ -324,6 +324,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
char *event_val = NULL;
bool orte_setup = false;
orte_grpcomm_collective_t *coll;
char *cmd=NULL, *av=NULL;
/* bitflag of the thread level support provided. To be used
* for the modex in order to work in heterogeneous environments. */
@ -383,6 +384,22 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
gettimeofday(&ompistart, NULL);
}
/* if we were not externally started, then we need to setup
* two envars so the MPI_INFO_ENV can get the cmd name
* and argv
*/
if (NULL == getenv("OMPI_COMMAND")) {
asprintf(&cmd, "OMPI_COMMAND=%s", argv[0]);
putenv(cmd);
}
if (NULL == getenv("OMPI_ARGV") && 1 < argc) {
char *tmp;
tmp = opal_argv_join(&argv[1], ' ');
asprintf(&av, "OMPI_ARGV=%s", tmp);
free(tmp);
putenv(av);
}
/* Setup ORTE - note that we are an MPI process */
if (ORTE_SUCCESS != (ret = orte_init(NULL, NULL, ORTE_PROC_MPI))) {
error = "ompi_mpi_init: orte_init failed";
@ -638,7 +655,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
}
/* initialize info */
if (OMPI_SUCCESS != (ret = ompi_info_init(argc, argv))) {
if (OMPI_SUCCESS != (ret = ompi_info_init())) {
error = "ompi_info_init() failed";
goto error;
}

Просмотреть файл

@ -241,6 +241,12 @@ static int rte_init(void)
orte_process_info.peer_init_barrier = 1;
orte_process_info.peer_fini_barrier = 2;
/* set some envars */
putenv("OMPI_NUM_APP_CTX=1");
putenv("OMPI_FIRST_RANKS=0");
putenv("OMPI_APP_CTX_NUM_PROCS=1");
putenv("OMPI_MCA_orte_ess_num_procs=1");
return ORTE_SUCCESS;
}

Просмотреть файл

@ -1787,7 +1787,7 @@ static int create_app(int argc, char* argv[],
if (0 == strcmp(appname, "java")) {
/* see if we were given a library path */
found = false;
for (i=0; NULL != app->argv[i]; i++) {
for (i=1; NULL != app->argv[i]; i++) {
if (NULL != strstr(app->argv[i], "java.library.path")) {
/* yep - but does it include the path to the mpi libs? */
found = true;
@ -1801,6 +1801,7 @@ static int create_app(int argc, char* argv[],
free(app->argv[i]);
app->argv[i] = value;
}
break;
}
}
if (!found) {
@ -1812,7 +1813,7 @@ static int create_app(int argc, char* argv[],
/* see if we were given a class path */
found = false;
for (i=0; NULL != app->argv[i]; i++) {
for (i=1; NULL != app->argv[i]; i++) {
if (NULL != strstr(app->argv[i], "cp") ||
NULL != strstr(app->argv[i], "classpath")) {
/* yep - but does it include the path to the mpi libs? */
@ -1871,12 +1872,36 @@ static int create_app(int argc, char* argv[],
opal_argv_insert_element(&app->argv, 1, "-cp");
}
}
/* try to find the actual command - may not be perfect */
for (i=1; i < opal_argv_count(app->argv); i++) {
if (NULL != strstr(app->argv[i], "java.library.path")) {
continue;
} else if (NULL != strstr(app->argv[i], "cp") ||
NULL != strstr(app->argv[i], "classpath")) {
/* skip the next field */
i++;
continue;
}
/* declare this the winner */
opal_setenv("OMPI_COMMAND", app->argv[i], true, &app->env);
/* collect everything else as the cmd line */
if ((i+1) < opal_argv_count(app->argv)) {
value = opal_argv_join(&app->argv[i+1], ' ');
opal_setenv("OMPI_ARGV", value, true, &app->env);
free(value);
}
break;
}
} else {
/* add the cmd to the environment for MPI_Info to pickup */
opal_setenv("OMPI_COMMAND", appname, true, &app->env);
if (1 < opal_argv_count(app->argv)) {
value = opal_argv_join(&app->argv[i+1], ' ');
opal_setenv("OMPI_ARGV", value, true, &app->env);
free(value);
}
}
free(appname);
if (orterun_globals.verbose) {
value = opal_argv_join(app->argv, ' ');
free(value);
}
*app_ptr = app;
app = NULL;