2004-08-14 05:56:05 +04:00
|
|
|
/*
|
2004-11-22 04:38:40 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-08-14 05:56:05 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include "include/constants.h"
|
|
|
|
#include "mpi/runtime/mpiruntime.h"
|
|
|
|
#include "mpi/runtime/params.h"
|
2004-08-14 17:07:30 +04:00
|
|
|
#include "util/output.h"
|
2004-08-14 05:56:05 +04:00
|
|
|
#include "mca/base/mca_base_param.h"
|
2005-02-21 21:56:30 +03:00
|
|
|
#include "mca/base/mca_base_param_internal.h"
|
|
|
|
#include "class/ompi_value_array.h"
|
|
|
|
#include <time.h>
|
2004-08-14 05:56:05 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Global variables
|
|
|
|
*
|
|
|
|
* As a deviation from the norm, ompi_mpi_param_check is also
|
|
|
|
* extern'ed in src/mpi/interface/c/bindings.h because it is already
|
|
|
|
* included in all MPI function imlementation files
|
|
|
|
*
|
|
|
|
* The values below are the default values.
|
|
|
|
*/
|
|
|
|
bool ompi_mpi_param_check = true;
|
|
|
|
bool ompi_debug_show_handle_leaks = false;
|
|
|
|
bool ompi_debug_no_free_handles = false;
|
2005-02-21 21:56:30 +03:00
|
|
|
bool ompi_mpi_show_mca_params = false;
|
|
|
|
char *ompi_mpi_show_mca_params_file = NULL;
|
2004-08-14 05:56:05 +04:00
|
|
|
|
|
|
|
int ompi_mpi_register_params(void)
|
|
|
|
{
|
|
|
|
int param_check_param;
|
|
|
|
int show_leaks_param;
|
|
|
|
int no_free_param;
|
2005-02-21 21:56:30 +03:00
|
|
|
int show_mca_params;
|
|
|
|
int show_mca_params_file;
|
2004-08-14 05:56:05 +04:00
|
|
|
int value;
|
2004-08-14 17:07:30 +04:00
|
|
|
|
|
|
|
/* Whether we want MPI API function parameter checking or not */
|
2004-08-14 05:56:05 +04:00
|
|
|
|
|
|
|
param_check_param =
|
2004-10-15 14:52:08 +04:00
|
|
|
mca_base_param_register_int("mpi", NULL, "param_check", NULL,
|
2004-08-14 05:56:05 +04:00
|
|
|
(int) ompi_mpi_param_check);
|
|
|
|
mca_base_param_lookup_int(param_check_param, &value);
|
|
|
|
ompi_mpi_param_check = (bool) value;
|
2004-08-14 17:07:30 +04:00
|
|
|
if (ompi_mpi_param_check) {
|
|
|
|
value = 0;
|
|
|
|
if (MPI_PARAM_CHECK) {
|
|
|
|
value = 1;
|
|
|
|
}
|
|
|
|
if (0 == value) {
|
2004-08-14 17:09:19 +04:00
|
|
|
ompi_output(0, "WARNING: MCA parameter mpi_param_check set to true, but parameter checking");
|
2004-08-14 17:07:30 +04:00
|
|
|
ompi_output(0, "WARNING: has been compiled out of Open MPI. mpi_param_check value ignored.");
|
|
|
|
ompi_mpi_param_check = false;
|
|
|
|
}
|
|
|
|
}
|
Add a Stacktrace feature, which figures where/what signal has happened
after MPI-startup.
For this a new mpirun-parameter "mpi_signal" is added, one may specify a
comma-separated list of signals to grab, e.g. mpirun --mca mpi_signal 8,11
will check for SIGFPE and SIGSEGV.
It only finds the first fault (SA_ONESHOT), as after the return the same
fault will occur again.
As printout, the data provided by siginfo_t is printed to STDOUT (yes,
it calls printf ,-]).
Additionally, with glibc, it uses backtrace and backtrace_symbols to
print the calling stack up to the function in which the signal was raised:
(Rank:0) Going to write to RD_ONLY mmaped shared mem
Signal:11 info.si_errno:0(Success) si_code:2(SEGV_ACCERR)
Failing at addr:0x4020c000
[0] func:/home/rusraink/ompi-gcc/lib/libmpi.so.0 [0x40121afe]
[1] func:./t0 [0x42029180]
[2] func:./t0(__libc_start_main+0x95) [0x42017589]
[3] func:./t0(__libc_start_main+0x49) [0x8048691]
This commit was SVN r4170.
2005-01-26 22:11:46 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This string is going to be used in src/util/showstackframe.c
|
|
|
|
*/
|
|
|
|
mca_base_param_register_string("mpi", NULL, "signal", NULL, NULL);
|
2004-08-14 05:56:05 +04:00
|
|
|
|
|
|
|
/* Whether or not to show MPI handle leaks */
|
|
|
|
|
|
|
|
show_leaks_param =
|
2004-10-15 14:52:08 +04:00
|
|
|
mca_base_param_register_int("mpi", NULL, "show_handle_leaks", NULL,
|
2004-08-14 05:56:05 +04:00
|
|
|
(int) ompi_debug_show_handle_leaks);
|
|
|
|
mca_base_param_lookup_int(show_leaks_param, &value);
|
|
|
|
ompi_debug_show_handle_leaks = (bool) value;
|
|
|
|
|
2004-08-14 17:07:30 +04:00
|
|
|
/* Whether or not to free MPI handles. Useless without run-time
|
|
|
|
param checking, so implicitly set that to true if we don't want
|
|
|
|
to free the handles. */
|
2004-08-14 05:56:05 +04:00
|
|
|
|
|
|
|
no_free_param =
|
2004-10-15 14:52:08 +04:00
|
|
|
mca_base_param_register_int("mpi", NULL, "no_free_handles", NULL,
|
2004-08-14 05:56:05 +04:00
|
|
|
(int) ompi_debug_no_free_handles);
|
|
|
|
mca_base_param_lookup_int(no_free_param, &value);
|
|
|
|
ompi_debug_no_free_handles = (bool) value;
|
2004-08-14 17:07:30 +04:00
|
|
|
if (ompi_debug_no_free_handles) {
|
|
|
|
ompi_mpi_param_check = true;
|
|
|
|
value = 0;
|
|
|
|
if (MPI_PARAM_CHECK) {
|
|
|
|
value = 1;
|
|
|
|
}
|
|
|
|
if (0 == value) {
|
|
|
|
ompi_output(0, "WARNING: MCA parameter mpi_no_free_handles set to true, but MPI");
|
|
|
|
ompi_output(0, "WARNING: parameter checking has been compiled out of Open MPI.");
|
|
|
|
ompi_output(0, "WARNING: mpi_no_free_handles is therefore only partially effective!");
|
|
|
|
}
|
|
|
|
}
|
2004-08-14 05:56:05 +04:00
|
|
|
|
2005-02-21 21:56:30 +03:00
|
|
|
/* Whether or not to print all MCA parameters in MPI_INIT */
|
2004-08-14 05:56:05 +04:00
|
|
|
|
2005-02-21 21:56:30 +03:00
|
|
|
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 */
|
|
|
|
|
2004-08-14 05:56:05 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-02-21 21:56:30 +03:00
|
|
|
int ompi_show_all_mca_params(int32_t rank, int requested, char *nodename) {
|
|
|
|
ompi_list_t *info;
|
|
|
|
ompi_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")) ) {
|
|
|
|
ompi_output(0, "Unable to open file <%s> to write MCA parameters", ompi_mpi_show_mca_params_file);
|
|
|
|
return MPI_ERR_BAD_FILE;
|
|
|
|
}
|
|
|
|
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 = ompi_list_get_first(info); i != ompi_list_get_last(info);
|
|
|
|
i = ompi_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 {
|
|
|
|
ompi_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;
|
|
|
|
}
|