1
1

Sigh - of course, they changed the name of the silly MPI_Info object in the final standard, but not in the proposal. So change to the new MPI_INFO_ENV name. Also, don't set unknown values to "N/A", but just leave them unset.

This commit was SVN r27012.
Этот коммит содержится в:
Ralph Castain 2012-08-12 05:00:57 +00:00
родитель cb48fd52d4
Коммит c90b7380c1
4 изменённых файлов: 47 добавлений и 41 удалений

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

@ -643,9 +643,9 @@ enum {
#endif #endif
/* /*
* GET_ENV handle * MPI_INFO_ENV handle
*/ */
#define MPI_INFO_GET_ENV OMPI_PREDEFINED_GLOBAL(MPI_Info, ompi_mpi_info_get_env) #define MPI_INFO_ENV OMPI_PREDEFINED_GLOBAL(MPI_Info, ompi_mpi_info_env)
#define MPI_STATUS_IGNORE ((MPI_Status *) 0) #define MPI_STATUS_IGNORE ((MPI_Status *) 0)
#define MPI_STATUSES_IGNORE ((MPI_Status *) 0) #define MPI_STATUSES_IGNORE ((MPI_Status *) 0)
@ -890,7 +890,7 @@ OMPI_DECLSPEC extern struct ompi_predefined_win_t ompi_mpi_win_null;
OMPI_DECLSPEC extern struct ompi_predefined_file_t ompi_mpi_file_null; OMPI_DECLSPEC extern struct ompi_predefined_file_t ompi_mpi_file_null;
OMPI_DECLSPEC extern struct ompi_predefined_info_t ompi_mpi_info_null; OMPI_DECLSPEC extern struct ompi_predefined_info_t ompi_mpi_info_null;
OMPI_DECLSPEC extern struct ompi_predefined_info_t ompi_mpi_info_get_env; OMPI_DECLSPEC extern struct ompi_predefined_info_t ompi_mpi_info_env;
OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUS_IGNORE; OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUS_IGNORE;
OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUSES_IGNORE; OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUSES_IGNORE;

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

@ -54,7 +54,7 @@
*/ */
ompi_predefined_info_t ompi_mpi_info_null; ompi_predefined_info_t ompi_mpi_info_null;
ompi_predefined_info_t *ompi_mpi_info_null_addr = &ompi_mpi_info_null; ompi_predefined_info_t *ompi_mpi_info_null_addr = &ompi_mpi_info_null;
ompi_predefined_info_t ompi_mpi_info_get_env; ompi_predefined_info_t ompi_mpi_info_env;
/* /*
@ -112,60 +112,66 @@ int ompi_info_init(int argc, char **argv)
ompi_mpi_info_null.info.i_f_to_c_index = 0; ompi_mpi_info_null.info.i_f_to_c_index = 0;
/* Create MPI_INFO_GET_ENV */ /* Create MPI_INFO_GET_ENV */
OBJ_CONSTRUCT(&ompi_mpi_info_get_env.info, ompi_info_t); OBJ_CONSTRUCT(&ompi_mpi_info_env.info, ompi_info_t);
ompi_mpi_info_get_env.info.i_f_to_c_index = 1; ompi_mpi_info_env.info.i_f_to_c_index = 1;
/* fill the get_env info object */ /* fill the get_env info object */
/* command for this app_context */ /* command for this app_context */
ompi_info_set(&ompi_mpi_info_get_env.info, "command", argv[0]); ompi_info_set(&ompi_mpi_info_env.info, "command", argv[0]);
/* space-separated list of argv for this command */ /* space-separated list of argv for this command */
if (1 < argc) { if (1 < argc) {
cptr = opal_argv_join(&argv[1], ' '); cptr = opal_argv_join(&argv[1], ' ');
ompi_info_set(&ompi_mpi_info_get_env.info, "argv", cptr); ompi_info_set(&ompi_mpi_info_env.info, "argv", cptr);
free(cptr); free(cptr);
} else {
ompi_info_set(&ompi_mpi_info_get_env.info, "argv", "N/A");
} }
/* max procs for the entire job */ /* max procs for the entire job */
if (NULL == (cptr = getenv("OMPI_MCA_orte_ess_num_procs"))) { if (NULL != (cptr = getenv("OMPI_MCA_orte_ess_num_procs"))) {
cptr = "1"; ompi_info_set(&ompi_mpi_info_env.info, "maxprocs", cptr);
} }
ompi_info_set(&ompi_mpi_info_get_env.info, "maxprocs", cptr);
ompi_info_set(&ompi_mpi_info_get_env.info, "soft", "N/A"); #if 0
/* Open MPI does not support the "soft" option */
ompi_info_set(&ompi_mpi_info_env.info, "soft", "N/A");
#endif
/* local host name */ /* local host name */
gethostname(tmp, MPI_MAX_INFO_KEY); gethostname(tmp, MPI_MAX_INFO_KEY);
ompi_info_set(&ompi_mpi_info_get_env.info, "host", tmp); ompi_info_set(&ompi_mpi_info_env.info, "host", tmp);
/* architecture name */ /* architecture name */
if (NULL == (cptr = getenv("OMPI_MCA_orte_cpu_type"))) { if (NULL != (cptr = getenv("OMPI_MCA_orte_cpu_type"))) {
ompi_info_set(&ompi_mpi_info_env.info, "arch", cptr);
}
#ifdef HAVE_SYS_UTSNAME_H #ifdef HAVE_SYS_UTSNAME_H
{ else {
struct utsname sysname; struct utsname sysname;
uname(&sysname); uname(&sysname);
cptr = sysname.machine; cptr = sysname.machine;
ompi_info_set(&ompi_mpi_info_env.info, "arch", cptr);
} }
#else
cptr = "unknown";
#endif #endif
}
ompi_info_set(&ompi_mpi_info_get_env.info, "arch", cptr);
/* working directory of this process */ /* working directory of this process */
opal_getcwd(tmp, MPI_MAX_INFO_KEY); opal_getcwd(tmp, MPI_MAX_INFO_KEY);
ompi_info_set(&ompi_mpi_info_get_env.info, "wdir", tmp); ompi_info_set(&ompi_mpi_info_env.info, "wdir", tmp);
/* the number of app_contexts in this job */ /* the number of app_contexts in this job */
if (NULL == (cptr = getenv("OMPI_NUM_APP_CTX"))) { if (NULL != (cptr = getenv("OMPI_NUM_APP_CTX"))) {
cptr = "1"; ompi_info_set(&ompi_mpi_info_env.info, "num_app_ctx", cptr);
} }
ompi_info_set(&ompi_mpi_info_get_env.info, "num_app_ctx", cptr);
/* space-separated list of first MPI rank of each app_context */ /* space-separated list of first MPI rank of each app_context */
if (NULL == (cptr = getenv("OMPI_FIRST_RANKS"))) { if (NULL != (cptr = getenv("OMPI_FIRST_RANKS"))) {
cptr = "0"; ompi_info_set(&ompi_mpi_info_env.info, "first_rank", cptr);
} }
ompi_info_set(&ompi_mpi_info_get_env.info, "first_rank", cptr);
/* space-separated list of num procs for each app_context */ /* space-separated list of num procs for each app_context */
if (NULL == (cptr = getenv("OMPI_APP_CTX_NUM_PROCS"))) { if (NULL != (cptr = getenv("OMPI_APP_CTX_NUM_PROCS"))) {
cptr = "1"; ompi_info_set(&ompi_mpi_info_env.info, "np", cptr);
} }
ompi_info_set(&ompi_mpi_info_get_env.info, "np", cptr);
/* All done */ /* All done */
@ -427,7 +433,7 @@ int ompi_info_finalize(void)
opal_pointer_array_set_item(&ompi_info_f_to_c_table, 0, NULL); opal_pointer_array_set_item(&ompi_info_f_to_c_table, 0, NULL);
/* ditto for MPI_INFO_GET_ENV */ /* ditto for MPI_INFO_GET_ENV */
OBJ_DESTRUCT(&ompi_mpi_info_get_env.info); OBJ_DESTRUCT(&ompi_mpi_info_env.info);
opal_pointer_array_set_item(&ompi_info_f_to_c_table, 1, NULL); opal_pointer_array_set_item(&ompi_info_f_to_c_table, 1, NULL);
/* Go through the f2c table and see if anything is left. Free them /* Go through the f2c table and see if anything is left. Free them

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

@ -106,9 +106,9 @@ OMPI_DECLSPEC extern ompi_predefined_info_t ompi_mpi_info_null;
OMPI_DECLSPEC extern ompi_predefined_info_t *ompi_mpi_info_null_addr; OMPI_DECLSPEC extern ompi_predefined_info_t *ompi_mpi_info_null_addr;
/** /**
* Global instance for MPI_INFO_GET_ENV * Global instance for MPI_INFO_ENV
*/ */
OMPI_DECLSPEC extern ompi_predefined_info_t ompi_mpi_info_get_env; OMPI_DECLSPEC extern ompi_predefined_info_t ompi_mpi_info_env;
/** /**
* \internal * \internal

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

@ -31,9 +31,9 @@ int main(int argc, char* argv[])
nk = sizeof(keys) / sizeof(char*); nk = sizeof(keys) / sizeof(char*);
for (i=0; i < nk; i++) { for (i=0; i < nk; i++) {
MPI_Info_get(MPI_INFO_GET_ENV, keys[i], MPI_MAX_INFO_KEY, MPI_Info_get(MPI_INFO_ENV, keys[i], MPI_MAX_INFO_KEY,
value, &flag); value, &flag);
fprintf(stderr, "%s: %s\n", keys[i], value); fprintf(stderr, "%s: %s\n", keys[i], (flag) ? value : "Not found");
} }
MPI_Finalize(); MPI_Finalize();