Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ph5diff tests for MPIEXEC_MAX_NUMPROCS=1 #3407

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/CMakeTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL AND NOT WIN32)
add_test (NAME MPI_TEST_EXAMPLES-${parallel_example} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${parallel_example}> ${MPIEXEC_POSTFLAGS})
else ()
add_test (NAME MPI_TEST_EXAMPLES-${parallel_example} COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${NUMPROCS};${MPIEXEC_PREFLAGS};$<TARGET_FILE:${parallel_example}>;${MPIEXEC_POSTFLAGS}"
-D "TEST_ARGS:STRING="
-D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE}"
-D "TEST_ARGS:STRING=${MPIEXEC_NUMPROC_FLAG};${NUMPROCS};${MPIEXEC_PREFLAGS};$<TARGET_FILE:${parallel_example}>;${MPIEXEC_POSTFLAGS}"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having these test arguments as part of TEST_PROGRAM was causing CMake to incorrectly interpret the test command. I'm not sure that the ph5diff tests were running correctly to begin with. Setting MPIEXEC_MAX_NUMPROCS=1 shows this issue by making all the ph5diff tests fail.

-D "TEST_EXPECT=0"
-D "TEST_SKIP_COMPARE=TRUE"
-D "TEST_OUTPUT=${parallel_example}.out"
Expand Down
10 changes: 6 additions & 4 deletions tools/src/h5diff/ph5diff_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ main(int argc, char *argv[])
MPI_Comm_size(MPI_COMM_WORLD, &g_nTasks);

if (g_nTasks == 1) {
printf("Only 1 task available...doing serial diff\n");
fprintf(stderr, "Only 1 task available...doing serial diff\n");
Copy link
Collaborator Author

@jhendersonHDF jhendersonHDF Aug 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This output statement makes it so the same output diff reference files can't be used between h5diff and ph5diff testing. Move this print statement to stderr since it doesn't seem that important anyway.


g_Parallel = 0;

Expand Down Expand Up @@ -279,11 +279,13 @@ h5diff_exit(int status)
phdiff_dismiss_workers();
MPI_Barrier(MPI_COMM_WORLD);
}
MPI_Finalize();
status = EXIT_SUCCESS; /* Reset exit status, since some mpiexec commands generate output on failure
status */
}

MPI_Finalize();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call to MPI_Finalize() needed to be moved outside the above block. Otherwise it wouldn't be called when run with mpiexec -np 1 and would cause the program to abort with an abnormal termination message.


status =
EXIT_SUCCESS; /* Reset exit status, since some mpiexec commands generate output on failure status */

h5tools_close();

/* Always exit(0), since MPI implementations do weird stuff when they
Expand Down
8 changes: 5 additions & 3 deletions tools/test/h5diff/CMakeTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,13 @@
add_test (
NAME MPI_TEST_H5DIFF-${resultfile}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$<TARGET_FILE:ph5diff${tgt_file_ext}>;${MPIEXEC_POSTFLAGS}"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE}"
-D "TEST_ARGS:STRING=${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$<TARGET_FILE:ph5diff${tgt_file_ext}>;${MPIEXEC_POSTFLAGS};${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/PAR/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
-D "TEST_EXPECT=0"
#-D "TEST_EXPECT=${resultcode}"
-D "TEST_EXPECT=0" # ph5diff currently always exits with a zero status code due to
# output from some MPI implementations from a non-zero exit code
-D "TEST_REFERENCE=${resultfile}.txt"
-D "TEST_APPEND=EXIT CODE:"
-D "TEST_REF_APPEND=EXIT CODE: [0-9]"
Expand Down