1
1

A patch from UTK to allow orte_init(), opal_init(), and associated

friends also receive &argc and &argv (George asked Jeff to Ralph to
review before committing).  The thought is that passing argv and argc
to opal/orte_init be useful to other projects outside of OMPI that are
using OPAL and/or ORTE (especially in conjunction with some other
bootstrapping code where it is helpful to modify argv).  It's such a
small thing that it's easy to apply here to make others' lives a
little easier.

Ask George for more details; I'm just the messenger.  :-)

Judging by the copyrights on this patch, it's been around for a
while.  :-)

This commit was SVN r22260.
Этот коммит содержится в:
Jeff Squyres 2009-12-04 00:51:15 +00:00
родитель ae3e9f2aee
Коммит 16b100219d
20 изменённых файлов: 46 добавлений и 45 удалений

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

@ -299,7 +299,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
/* Setup enough to check get/set MCA params */
if (ORTE_SUCCESS != (ret = opal_init_util())) {
if (ORTE_SUCCESS != (ret = opal_init_util(&argc, &argv))) {
error = "ompi_mpi_init: opal_init_util failed";
goto error;
}
@ -347,7 +347,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
}
/* Setup ORTE - note that we are an MPI process */
if (ORTE_SUCCESS != (ret = orte_init(ORTE_PROC_MPI))) {
if (ORTE_SUCCESS != (ret = orte_init(NULL, NULL, ORTE_PROC_MPI))) {
error = "ompi_mpi_init: orte_init failed";
goto error;
}

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

@ -54,7 +54,7 @@ int main(int argc, char *argv[])
char * tmp_env_var = NULL;
/* init enough of opal to use a few utilities */
if (OPAL_SUCCESS != opal_init_util()) {
if (OPAL_SUCCESS != opal_init_util(&argc, &argv)) {
fprintf(stderr, "OPAL failed to initialize -- ompi-probe aborting\n");
exit(1);
}

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

@ -166,7 +166,7 @@ int main(int argc, char *argv[])
}
/* init enough of opal to use a few utilities */
if (OPAL_SUCCESS != opal_init_util()) {
if (OPAL_SUCCESS != opal_init_util(&argc, &argv)) {
fprintf(stderr, "OPAL failed to initialize -- ompi-profiler aborting\n");
exit(1);
}

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

@ -110,7 +110,7 @@ int main(int argc, char *argv[])
char * tmp_env_var = NULL;
/* init enough of opal to process cmd lines */
if (OPAL_SUCCESS != opal_init_util()) {
if (OPAL_SUCCESS != opal_init_util(&argc, &argv)) {
fprintf(stderr, "OPAL failed to initialize -- orted aborting\n");
exit(1);
}
@ -188,7 +188,7 @@ int main(int argc, char *argv[])
* so that we only open up the communications infrastructure. No
* session directories will be created.
*/
if (ORTE_SUCCESS != (ret = orte_init(ORTE_PROC_TOOL))) {
if (ORTE_SUCCESS != (ret = orte_init(&argc, &argv, ORTE_PROC_TOOL))) {
fprintf(stderr, "ompi-server: failed to initialize -- aborting\n");
exit(1);
}

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

@ -73,7 +73,7 @@ int main(int argc, char *argv[])
char *str;
/* Initialize the argv parsing handle */
if (OMPI_SUCCESS != opal_init_util()) {
if (OMPI_SUCCESS != opal_init_util(&argc, &argv)) {
orte_show_help("help-ompi_info.txt", "lib-call-fail", true,
"opal_init_util", __FILE__, __LINE__, NULL);
exit(ret);

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

@ -2,7 +2,7 @@
* 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
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -42,7 +42,7 @@ OPAL_DECLSPEC extern char *opal_profile_file;
* \note If this function is called, opal_init_util() should *not* be
* called.
*/
OPAL_DECLSPEC int opal_init(void);
OPAL_DECLSPEC int opal_init(int* pargc, char*** pargv);
/**
* Finalize the OPAL layer, including the MCA system.
@ -64,7 +64,7 @@ OPAL_DECLSPEC int opal_finalize(void);
* \note If this function is called, opal_init() should *not*
* be called.
*/
OPAL_DECLSPEC int opal_init_util(void);
OPAL_DECLSPEC int opal_init_util(int* pargc, char*** pargv);
/**
* Finalize the OPAL layer, excluding the MCA system.

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

@ -177,7 +177,7 @@ opal_err2str(int errnum)
int
opal_init_util(void)
opal_init_util(int* pargc, char*** pargv)
{
int ret;
char *error = NULL;
@ -273,7 +273,7 @@ opal_init_util(void)
int
opal_init(void)
opal_init(int* pargc, char*** pargv)
{
int ret;
char *error = NULL;
@ -286,7 +286,7 @@ opal_init(void)
}
/* initialize util code */
if (OPAL_SUCCESS != (ret = opal_init_util())) {
if (OPAL_SUCCESS != (ret = opal_init_util(pargc, pargv))) {
return ret;
}

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

@ -2,7 +2,7 @@
* Copyright (c) 2004-2009 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
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -208,7 +208,7 @@ static int initialize(int argc, char *argv[]) {
* to ensure installdirs is setup properly
* before calling mca_base_open();
*/
if( OPAL_SUCCESS != (ret = opal_init_util()) ) {
if( OPAL_SUCCESS != (ret = opal_init_util(&argc, &argv)) ) {
return ret;
}
@ -252,7 +252,7 @@ static int initialize(int argc, char *argv[]) {
/*
* Initialize OPAL
*/
if (OPAL_SUCCESS != (ret = opal_init())) {
if (OPAL_SUCCESS != (ret = opal_init(&argc, &argv))) {
exit_status = ret;
goto cleanup;
}

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

@ -2,7 +2,7 @@
* Copyright (c) 2004-2009 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
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -305,7 +305,7 @@ static int initialize(int argc, char *argv[])
* to ensure installdirs is setup properly
* before calling mca_base_open();
*/
if( OPAL_SUCCESS != (ret = opal_init_util()) ) {
if( OPAL_SUCCESS != (ret = opal_init_util(&argc, &argv)) ) {
return ret;
}
@ -341,7 +341,7 @@ static int initialize(int argc, char *argv[])
/*
* Initialize the OPAL layer
*/
if (OPAL_SUCCESS != (ret = opal_init())) {
if (OPAL_SUCCESS != (ret = opal_init(&argc, &argv))) {
exit_status = ret;
goto cleanup;
}

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

@ -477,7 +477,7 @@ main(int argc, char *argv[])
bool disable_flags = true;
bool real_flag = false;
if (OPAL_SUCCESS != (ret = opal_init_util())) {
if (OPAL_SUCCESS != (ret = opal_init_util(&argc, &argv))) {
return ret;
}

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

@ -283,7 +283,7 @@ int orte_daemon(int argc, char *argv[])
* opal_init_util() since mca_base_cmd_line_process_args() does *not*
* depend upon opal_init_util() functionality.
*/
if (OPAL_SUCCESS != opal_init_util()) {
if (OPAL_SUCCESS != opal_init_util(&argc, &argv)) {
fprintf(stderr, "OPAL failed to initialize -- orted aborting\n");
exit(1);
}
@ -325,7 +325,6 @@ int orte_daemon(int argc, char *argv[])
#endif /* !defined(__WINDOWS__) */
/* see if they want us to spin until they can connect a debugger to us */
i=0;
/*orted_globals.spin = 1;*/
while (orted_spin_flag) {
i++;
if (1000 < i) i=0;
@ -347,12 +346,12 @@ int orte_daemon(int argc, char *argv[])
* require.
*/
if (orted_globals.hnp) {
if (ORTE_SUCCESS != (ret = orte_init(ORTE_PROC_HNP))) {
if (ORTE_SUCCESS != (ret = orte_init(&argc, &argv, ORTE_PROC_HNP))) {
ORTE_ERROR_LOG(ret);
return ret;
}
} else {
if (ORTE_SUCCESS != (ret = orte_init(ORTE_PROC_DAEMON))) {
if (ORTE_SUCCESS != (ret = orte_init(&argc, &argv, ORTE_PROC_DAEMON))) {
ORTE_ERROR_LOG(ret);
return ret;
}

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

@ -65,7 +65,7 @@ orte_process_name_t orte_name_invalid = {ORTE_JOBID_INVALID, ORTE_VPID_INVALID};
#endif
const char orte_version_string[] = ORTE_IDENT_STRING;
int orte_init(orte_proc_type_t flags)
int orte_init(int* pargc, char*** pargv, orte_proc_type_t flags)
{
int ret;
char *error = NULL;
@ -75,7 +75,7 @@ int orte_init(orte_proc_type_t flags)
}
/* initialize the opal layer */
if (ORTE_SUCCESS != (ret = opal_init())) {
if (ORTE_SUCCESS != (ret = opal_init(pargc, pargv))) {
ORTE_ERROR_LOG(ret);
return ret;
}

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

@ -55,9 +55,11 @@ ORTE_DECLSPEC extern bool orte_debug_flag;
* be called by every application using the RTE interface, including
* MPI applications and mpirun.
*
* @param tool Whether we are ORTE tool or not
* @param pargc Pointer to the number of arguments in the pargv array
* @param pargv The list of arguments.
* @param flags Whether we are ORTE tool or not
*/
ORTE_DECLSPEC int orte_init(orte_proc_type_t flags);
ORTE_DECLSPEC int orte_init(int*pargc, char*** pargv, orte_proc_type_t flags);
/**
* Initialize parameters for ORTE.

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

@ -2,7 +2,7 @@
* Copyright (c) 2004-2009 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
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -508,7 +508,7 @@ static int ckpt_init(int argc, char *argv[]) {
* to ensure installdirs is setup properly
* before calling mca_base_open();
*/
if( ORTE_SUCCESS != (ret = opal_init_util()) ) {
if( ORTE_SUCCESS != (ret = opal_init_util(&argc, &argv)) ) {
ORTE_ERROR_LOG(ret);
return ret;
}
@ -539,7 +539,7 @@ static int ckpt_init(int argc, char *argv[]) {
* We need all of OPAL and the TOOLS portion of ORTE - this
* sets us up so we can talk to any HNP over the wire
***************************/
if (ORTE_SUCCESS != (ret = orte_init(ORTE_PROC_TOOL))) {
if (ORTE_SUCCESS != (ret = orte_init(&argc, &argv, ORTE_PROC_TOOL))) {
ORTE_ERROR_LOG(ret);
exit_status = ret;
goto cleanup;

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

@ -127,7 +127,7 @@ main(int argc, char *argv[])
char *tmp_env_var;
/* This is needed so we can print the help message */
if (ORTE_SUCCESS != (ret = opal_init_util())) {
if (ORTE_SUCCESS != (ret = opal_init_util(&argc, &argv))) {
return ret;
}
@ -157,7 +157,7 @@ main(int argc, char *argv[])
#endif
tmp_env_var = NULL; /* Silence compiler warning */
if (ORTE_SUCCESS != (ret = orte_init(ORTE_PROC_TOOL))) {
if (ORTE_SUCCESS != (ret = orte_init(&argc, &argv, ORTE_PROC_TOOL))) {
return ret;
}

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

@ -171,7 +171,7 @@ main(int argc, char *argv[])
* to ensure installdirs is setup properly
* before calling mca_base_open();
*/
if( ORTE_SUCCESS != (ret = opal_init_util()) ) {
if( ORTE_SUCCESS != (ret = opal_init_util(&argc, &argv)) ) {
return ret;
}
@ -212,7 +212,7 @@ main(int argc, char *argv[])
/***************************
* We need all of OPAL and the TOOL portion of ORTE
***************************/
if (ORTE_SUCCESS != orte_init(ORTE_PROC_TOOL)) {
if (ORTE_SUCCESS != orte_init(&argc, &argv, ORTE_PROC_TOOL)) {
orte_finalize();
return 1;
}

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

@ -2,7 +2,7 @@
* Copyright (c) 2004-2009 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
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -337,7 +337,7 @@ static int orte_ps_init(int argc, char *argv[]) {
* to ensure installdirs is setup properly
* before calling mca_base_open();
*/
if( ORTE_SUCCESS != (ret = opal_init_util()) ) {
if( ORTE_SUCCESS != (ret = opal_init_util(&argc, &argv)) ) {
return ret;
}
@ -384,7 +384,7 @@ static int orte_ps_init(int argc, char *argv[]) {
/***************************
* We need all of OPAL and the TOOL portion of ORTE
***************************/
ret = orte_init(ORTE_PROC_TOOL);
ret = orte_init(&argc, &argv, ORTE_PROC_TOOL);
return ret;
}

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

@ -2,7 +2,7 @@
* Copyright (c) 2004-2009 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
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -271,7 +271,7 @@ static int initialize(int argc, char *argv[]) {
* to ensure installdirs is setup properly
* before calling mca_base_open();
*/
if( ORTE_SUCCESS != (ret = opal_init_util()) ) {
if( ORTE_SUCCESS != (ret = opal_init_util(&argc, &argv)) ) {
return ret;
}
@ -310,7 +310,7 @@ static int initialize(int argc, char *argv[]) {
/*
* Setup any ORTE stuff we might need
*/
if (OPAL_SUCCESS != (ret = orte_init(ORTE_PROC_TOOL))) {
if (OPAL_SUCCESS != (ret = orte_init(&argc, &argv, ORTE_PROC_TOOL))) {
exit_status = ret;
goto cleanup;
}

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

@ -223,7 +223,7 @@ main(int argc, char *argv[])
* to ensure installdirs is setup properly
* before calling mca_base_open();
*/
if( ORTE_SUCCESS != (ret = opal_init_util()) ) {
if( ORTE_SUCCESS != (ret = opal_init_util(&argc, &argv)) ) {
return ret;
}
@ -257,7 +257,7 @@ main(int argc, char *argv[])
/***************************
* We need all of OPAL and the TOOL portion of ORTE
***************************/
if (ORTE_SUCCESS != orte_init(ORTE_PROC_TOOL)) {
if (ORTE_SUCCESS != orte_init(&argc, &argv, ORTE_PROC_TOOL)) {
orte_finalize();
return 1;
}

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

@ -491,7 +491,7 @@ int orterun(int argc, char *argv[])
* depend upon opal_init_util() functionality.
*/
/* Need to initialize OPAL so that install_dirs are filled in */
if (OPAL_SUCCESS != opal_init_util()) {
if (OPAL_SUCCESS != opal_init_util(&argc, &argv)) {
exit(1);
}
@ -566,7 +566,7 @@ int orterun(int argc, char *argv[])
* up incorrect infrastructure that only a singleton would
* require
*/
if (ORTE_SUCCESS != (rc = orte_init(ORTE_PROC_HNP))) {
if (ORTE_SUCCESS != (rc = orte_init(&argc, &argv, ORTE_PROC_HNP))) {
ORTE_ERROR_LOG(rc);
return rc;
}