summaryrefslogtreecommitdiffstats
path: root/testpar
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2023-10-28 04:18:24 (GMT)
committerGitHub <noreply@github.com>2023-10-28 04:18:24 (GMT)
commit1bcef50b864fb1ea6e00900b3982e71d183cfda5 (patch)
tree4f88bd92088de8e0def6b93e6419c5307076ed0d /testpar
parent119e694f971470b26876d227ceedbaab36eef275 (diff)
downloadhdf5-1bcef50b864fb1ea6e00900b3982e71d183cfda5.zip
hdf5-1bcef50b864fb1ea6e00900b3982e71d183cfda5.tar.gz
hdf5-1bcef50b864fb1ea6e00900b3982e71d183cfda5.tar.bz2
Print some messages in parallel tests on MPI rank 0 only (#3785)
Avoids overly verbose output from all processes emitting progress, etc. info.
Diffstat (limited to 'testpar')
-rw-r--r--testpar/t_2Gio.c6
-rw-r--r--testpar/t_mpi.c46
-rw-r--r--testpar/t_shapesame.c17
3 files changed, 35 insertions, 34 deletions
diff --git a/testpar/t_2Gio.c b/testpar/t_2Gio.c
index c2aac77..48abf8e 100644
--- a/testpar/t_2Gio.c
+++ b/testpar/t_2Gio.c
@@ -4291,9 +4291,10 @@ main(int argc, char **argv)
printf("2 GByte IO TESTS START\n");
printf("2 MPI ranks will run the tests...\n");
printf("===================================\n");
- h5_show_hostname();
}
+ h5_show_hostname();
+
if (H5dont_atexit() < 0) {
printf("Failed to turn off atexit processing. Continue.\n");
};
@@ -4345,8 +4346,7 @@ main(int argc, char **argv)
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Display testing information */
- if (MAINPROCESS)
- TestInfo(argv[0]);
+ TestInfo(argv[0]);
/* setup file access property list */
fapl = H5Pcreate(H5P_FILE_ACCESS);
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c
index eff39d0..0f1e27b 100644
--- a/testpar/t_mpi.c
+++ b/testpar/t_mpi.c
@@ -53,14 +53,14 @@ test_mpio_overlap_writes(char *filename)
MPI_Offset mpi_off;
MPI_Status mpi_stat;
- if (VERBOSE_MED)
- printf("MPIO independent overlapping writes test on file %s\n", filename);
-
nerrs = 0;
/* set up MPI parameters */
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+ if (VERBOSE_MED && MAINPROCESS)
+ printf("MPIO independent overlapping writes test on file %s\n", filename);
+
/* Need at least 2 processes */
if (mpi_size < 2) {
if (MAINPROCESS)
@@ -211,7 +211,7 @@ test_mpio_gb_file(char *filename)
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- if (VERBOSE_MED)
+ if (VERBOSE_MED && MAINPROCESS)
printf("MPI_Offset range test\n");
/* figure out the signness and sizeof MPI_Offset */
@@ -274,12 +274,13 @@ test_mpio_gb_file(char *filename)
/*
* Verify if we can write to a file of multiple GB sizes.
*/
- if (VERBOSE_MED)
+ if (VERBOSE_MED && MAINPROCESS)
printf("MPIO GB file test %s\n", filename);
if (sizeof_mpi_offset <= 4) {
- printf("Skipped GB file range test "
- "because MPI_Offset cannot support it\n");
+ if (MAINPROCESS)
+ printf("Skipped GB file range test "
+ "because MPI_Offset cannot support it\n");
}
else {
buf = (char *)malloc(MB);
@@ -294,7 +295,8 @@ test_mpio_gb_file(char *filename)
mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh);
VRFY((mrc == MPI_SUCCESS), "MPI_FILE_OPEN");
- printf("MPIO GB file write test %s\n", filename);
+ if (MAINPROCESS)
+ printf("MPIO GB file write test %s\n", filename);
/* instead of writing every bytes of the file, we will just write
* some data around the 2 and 4 GB boundaries. That should cover
@@ -333,7 +335,8 @@ test_mpio_gb_file(char *filename)
*/
/* open it again to verify the data written */
/* but only if there was no write errors */
- printf("MPIO GB file read test %s\n", filename);
+ if (MAINPROCESS)
+ printf("MPIO GB file read test %s\n", filename);
if (errors_sum(writerrs) > 0) {
printf("proc %d: Skip read test due to previous write errors\n", mpi_rank);
goto finish;
@@ -377,7 +380,8 @@ test_mpio_gb_file(char *filename)
mrc = MPI_Barrier(MPI_COMM_WORLD);
VRFY((mrc == MPI_SUCCESS), "Sync before leaving test");
- printf("Test if MPI_File_get_size works correctly with %s\n", filename);
+ if (MAINPROCESS)
+ printf("Test if MPI_File_get_size works correctly with %s\n", filename);
mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh);
VRFY((mrc == MPI_SUCCESS), "");
@@ -432,7 +436,6 @@ finish:
static int
test_mpio_1wMr(char *filename, int special_request)
{
- char hostname[128];
int mpi_size, mpi_rank;
MPI_File fh;
char mpi_err_str[MPI_MAX_ERROR_STRING];
@@ -456,19 +459,8 @@ test_mpio_1wMr(char *filename, int special_request)
}
/* show the hostname so that we can tell where the processes are running */
- if (VERBOSE_DEF) {
-#ifdef H5_HAVE_GETHOSTNAME
- if (gethostname(hostname, sizeof(hostname)) < 0) {
- printf("gethostname failed\n");
- hostname[0] = '\0';
- }
-#else
- printf("gethostname unavailable\n");
- hostname[0] = '\0';
-#endif
- PRINTID;
- printf("hostname=%s\n", hostname);
- }
+ if (VERBOSE_DEF)
+ h5_show_hostname();
/* Delete any old file in order to start anew. */
/* Must delete because MPI_File_open does not have a Truncate mode. */
@@ -1005,6 +997,10 @@ test_mpio_special_collective(char *filename)
static int
parse_options(int argc, char **argv)
{
+ int mpi_rank;
+
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+
while (--argc) {
if (**(++argv) != '-') {
break;
@@ -1053,7 +1049,7 @@ parse_options(int argc, char **argv)
return (1);
}
H5Pclose(plist);
- if (VERBOSE_MED) {
+ if (VERBOSE_MED && MAINPROCESS) {
printf("Test filenames are:\n");
for (i = 0; i < n; i++)
printf(" %s\n", filenames[i]);
diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c
index 98e3077..0a3d3d0 100644
--- a/testpar/t_shapesame.c
+++ b/testpar/t_shapesame.c
@@ -4089,7 +4089,8 @@ parse_options(int argc, char **argv)
case 'h': /* print help message--return with nerrors set */
return (1);
default:
- printf("Illegal option(%s)\n", *argv);
+ if (MAINPROCESS)
+ printf("Illegal option(%s)\n", *argv);
nerrors++;
return (1);
}
@@ -4098,12 +4099,14 @@ parse_options(int argc, char **argv)
/* check validity of dimension and chunk sizes */
if (dim0 <= 0 || dim1 <= 0) {
- printf("Illegal dim sizes (%d, %d)\n", dim0, dim1);
+ if (MAINPROCESS)
+ printf("Illegal dim sizes (%d, %d)\n", dim0, dim1);
nerrors++;
return (1);
}
if (chunkdim0 <= 0 || chunkdim1 <= 0) {
- printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1);
+ if (MAINPROCESS)
+ printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1);
nerrors++;
return (1);
}
@@ -4128,9 +4131,11 @@ parse_options(int argc, char **argv)
nerrors++;
return (1);
}
- printf("Test filenames are:\n");
- for (i = 0; i < n; i++)
- printf(" %s\n", filenames[i]);
+ if (MAINPROCESS) {
+ printf("Test filenames are:\n");
+ for (i = 0; i < n; i++)
+ printf(" %s\n", filenames[i]);
+ }
}
return (0);