diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2000-12-02 22:53:02 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2000-12-02 22:53:02 (GMT) |
commit | 8a3dc0fad80859a805b14dfba31d44781c1ec22d (patch) | |
tree | 40b0fe6e3c49db8c4ab5c8370ddf521666425a71 /src | |
parent | 17a906445b2dc60ba2cdd2b039daf3f8af8420a7 (diff) | |
download | hdf5-8a3dc0fad80859a805b14dfba31d44781c1ec22d.zip hdf5-8a3dc0fad80859a805b14dfba31d44781c1ec22d.tar.gz hdf5-8a3dc0fad80859a805b14dfba31d44781c1ec22d.tar.bz2 |
[svn-r3070] Purpose:
Feature
Description:
H5Eprint used to print "thread 0" even in MPI-application.
Added code to print MPI-process rank ID (as in MPI_COMM_WORLD) to
give more information of which process is printing the messages.
Platforms tested:
IRIX64-64, both serial and parallel.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5E.c | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -343,6 +343,8 @@ H5Eclear(void) * Friday, February 27, 1998 * * Modifications: + * Albert Cheng, 2000/12/02 + * Show MPI process rank id if applicable. * *------------------------------------------------------------------------- */ @@ -357,11 +359,21 @@ H5Eprint(FILE *stream) /*NO TRACE*/ if (!stream) stream = stderr; -#ifdef H5_HAVE_THREADSAFE - fprintf (stream, "HDF5-DIAG: Error detected in thread %d." - ,(int)pthread_self()); + fprintf (stream, "HDF5-DIAG: Error detected in "); + /* try show the process or thread id in multiple processes cases*/ +#ifdef H5_HAVE_PARALLEL + { int mpi_rank, mpi_initialized; + MPI_Initialized(&mpi_initialized); + if (mpi_initialized){ + MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); + fprintf (stream, "MPI-process %d.", mpi_rank); + }else + fprintf (stream, "thread 0."); + } +#elif defined(H5_HAVE_THREADSAFE) + fprintf (stream, "thread %d.", (int)pthread_self()); #else - fprintf (stream, "HDF5-DIAG: Error detected in thread 0."); + fprintf (stream, "thread 0."); #endif if (estack && estack->nused>0) fprintf (stream, " Back trace follows."); HDfputc ('\n', stream); |