(Re-)Added two MCA Parameters that must have been lost in the merge way back when:
* mpi_show_mca_params If set to true, this turns on the dumping of all MCA parameters when MPI_INIT is called. Only the 'rank 0' processes will print the parameters. * mpi_show_mca_params_file (This value is only used if the first argument is set to true) If this value is non-NULL it specifies the file to put the dump into. This file can then be used as input to mpirun for debugging purposes. If this value is not set (and mpi_show_mca_params is set) then the parameters are dumped to stdout. This commit was SVN r6401.
Этот коммит содержится в:
родитель
d4151fa9fd
Коммит
de5e0d4f2c
@ -393,6 +393,15 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dump all MCA parameters if requested
|
||||
*/
|
||||
if (ompi_mpi_show_mca_params) {
|
||||
ompi_show_all_mca_params(ompi_mpi_comm_world.c_my_rank,
|
||||
nprocs,
|
||||
orte_system_info.nodename);
|
||||
}
|
||||
|
||||
/* Let system know we are at STG2 Barrier */
|
||||
|
||||
if (ORTE_SUCCESS != (ret = orte_soh.set_proc_soh(orte_process_info.my_name,
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "ompi/runtime/params.h"
|
||||
#include "opal/util/output.h"
|
||||
#include "mca/base/mca_base_param.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
@ -35,13 +35,16 @@
|
||||
bool ompi_mpi_param_check = true;
|
||||
bool ompi_debug_show_handle_leaks = false;
|
||||
bool ompi_debug_no_free_handles = false;
|
||||
|
||||
bool ompi_mpi_show_mca_params = false;
|
||||
char *ompi_mpi_show_mca_params_file = NULL;
|
||||
|
||||
int ompi_mpi_register_params(void)
|
||||
{
|
||||
int param_check_param;
|
||||
int show_leaks_param;
|
||||
int no_free_param;
|
||||
int show_mca_params;
|
||||
int show_mca_params_file;
|
||||
int value;
|
||||
|
||||
/* Whether we want MPI API function parameter checking or not */
|
||||
@ -106,9 +109,88 @@ int ompi_mpi_register_params(void)
|
||||
opal_output(0, "WARNING: mpi_no_free_handles is therefore only partially effective!");
|
||||
}
|
||||
}
|
||||
|
||||
/* Whether or not to print all MCA parameters in MPI_INIT */
|
||||
show_mca_params =
|
||||
mca_base_param_register_int("mpi", NULL,
|
||||
"show_mca_params", NULL,
|
||||
(int) ompi_mpi_show_mca_params);
|
||||
mca_base_param_lookup_int(show_mca_params, &value);
|
||||
ompi_mpi_show_mca_params = (bool) value;
|
||||
mca_base_param_set_internal(show_mca_params, false);
|
||||
|
||||
/* File to use when dumping the parameters */
|
||||
ompi_mpi_show_mca_params_file = strdup("");
|
||||
show_mca_params_file =
|
||||
mca_base_param_register_string("mpi", NULL, "show_mca_params_file", NULL,
|
||||
ompi_mpi_show_mca_params_file);
|
||||
mca_base_param_lookup_string(show_mca_params_file, &ompi_mpi_show_mca_params_file);
|
||||
mca_base_param_set_internal(show_mca_params_file, false);
|
||||
|
||||
/* All done */
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
int ompi_show_all_mca_params(int32_t rank, int requested, char *nodename) {
|
||||
opal_list_t *info;
|
||||
opal_list_item_t *i;
|
||||
mca_base_param_info_t *item;
|
||||
char *value_string;
|
||||
int value_int;
|
||||
FILE *fp;
|
||||
time_t timestamp;
|
||||
|
||||
if (rank != 0) {
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
timestamp = time(NULL);
|
||||
|
||||
/* Open the file if one is specified */
|
||||
if (0 != strlen(ompi_mpi_show_mca_params_file)) {
|
||||
if ( NULL == (fp = fopen(ompi_mpi_show_mca_params_file, "w")) ) {
|
||||
opal_output(0, "Unable to open file <%s> to write MCA parameters", ompi_mpi_show_mca_params_file);
|
||||
return OMPI_ERR_FILE_OPEN_FAILURE;
|
||||
}
|
||||
fprintf(fp, "#\n");
|
||||
fprintf(fp, "# This file was automatically generated on %s", ctime(×tamp));
|
||||
fprintf(fp, "# by MPI_COMM_WORLD rank %d (out of a total of %d) on %s\n", rank, requested, nodename );
|
||||
fprintf(fp, "#\n");
|
||||
}
|
||||
|
||||
mca_base_param_dump(&info, false);
|
||||
for (i = opal_list_get_first(info);
|
||||
i != opal_list_get_last(info);
|
||||
i = opal_list_get_next(i)) {
|
||||
item = (mca_base_param_info_t*) i;
|
||||
|
||||
/* Get the parameter name, and convert it to a printable string */
|
||||
if (MCA_BASE_PARAM_TYPE_STRING == item->mbpp_type) {
|
||||
mca_base_param_lookup_string(item->mbpp_index, &value_string);
|
||||
if (NULL == value_string) {
|
||||
value_string = strdup("");
|
||||
}
|
||||
} else {
|
||||
mca_base_param_lookup_int(item->mbpp_index, &value_int);
|
||||
asprintf(&value_string, "%d", value_int);
|
||||
}
|
||||
|
||||
/* Print the parameter */
|
||||
if (0 != strlen(ompi_mpi_show_mca_params_file)) {
|
||||
fprintf(fp, "%s=%s\n", item->mbpp_full_name, value_string);
|
||||
} else {
|
||||
opal_output(0, "%s=%s", item->mbpp_full_name, value_string);
|
||||
}
|
||||
|
||||
free(value_string);
|
||||
}
|
||||
|
||||
/* Close file, cleanup allocated memory*/
|
||||
if (0 != strlen(ompi_mpi_show_mca_params_file)) {
|
||||
fclose(fp);
|
||||
}
|
||||
mca_base_param_dump_release(info);
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
@ -67,9 +67,11 @@ int orte_proc_info(void)
|
||||
|
||||
id = mca_base_param_register_string("gpr", "replica", "uri", NULL, orte_process_info.gpr_replica_uri);
|
||||
mca_base_param_lookup_string(id, &(orte_process_info.gpr_replica_uri));
|
||||
mca_base_param_set_internal(id, true);
|
||||
|
||||
id = mca_base_param_register_string("ns", "replica", "uri", NULL, orte_process_info.ns_replica_uri);
|
||||
mca_base_param_lookup_string(id, &(orte_process_info.ns_replica_uri));
|
||||
mca_base_param_set_internal(id, true);
|
||||
|
||||
id = mca_base_param_register_string("tmpdir", "base", NULL, NULL, orte_process_info.tmpdir_base);
|
||||
mca_base_param_lookup_string(id, &(orte_process_info.tmpdir_base));
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user