Skip to content

Commit

Permalink
updated h5fuse naming in HDF5
Browse files Browse the repository at this point in the history
  • Loading branch information
brtnfld committed Jan 8, 2024
1 parent 58fcd42 commit 6b145df
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
5 changes: 5 additions & 0 deletions example/core_tutorial/13_hdf5_output_advanced/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@

add_executable(AdvancedHDF5Output advanced_hdf5_output_example.cpp)
target_link_libraries(AdvancedHDF5Output cabanacore)
if(EXISTS ${HDF5_C_INCLUDE_DIRS}/../bin/h5fuse.sh)
file(COPY ${HDF5_C_INCLUDE_DIRS}/../bin/h5fuse.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
elseif(EXISTS ${HDF5_C_INCLUDE_DIRS}/../bin/h5fuse)
file(COPY ${HDF5_C_INCLUDE_DIRS}/../bin/h5fuse DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endif()
add_test(NAME Core_tutorial_13_subfiling COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG}
${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:AdvancedHDF5Output> ${MPIEXEC_POSTFLAGS})
set_tests_properties(Core_tutorial_13_subfiling PROPERTIES PROCESSORS ${MPIEXEC_MAX_NUMPROCS})
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
#include <sys/wait.h>
#include <unistd.h>

// "h5fuse.sh" was changed to "h5fuse" in later HDF5 versions.
#if H5_VERSION_GE(1,14,4)
#define H5FUSE_EXEC "h5fuse"
#else
#define H5FUSE_EXEC "h5fuse.sh"
#endif

//---------------------------------------------------------------------------//
// HDF5 output example with subfiling
//---------------------------------------------------------------------------//
Expand Down Expand Up @@ -170,14 +177,13 @@ void hdf5OutputSubfiling()
std::cout << "Output for step " << step << "/" << steps
<< std::endl;

// h5fuse.sh is a tool for generating a hdf5 file from the subfiles
// Set the enviroment variable H5FUSE to enable this feature,
// h5fuse.sh needs to be located in the same directory as the
// h5fuse is a tool for generating a hdf5 file from the subfiles.
// h5fuse needs to be located in the same directory as the
// executable.

struct stat file_info;

if ( stat( "h5fuse.sh", &file_info ) == 0 )
if ( stat( H5FUSE_EXEC, &file_info ) == 0 )
{
if ( h5_config.subfiling )
{
Expand All @@ -188,7 +194,7 @@ void hdf5OutputSubfiling()

MPI_Comm_rank( shmcomm, &shmrank );

// One rank from each node executes h5fuse.sh
// One rank from each node executes h5fuse
if ( shmrank == 0 )
{
pid_t pid = 0;
Expand Down Expand Up @@ -224,7 +230,7 @@ void hdf5OutputSubfiling()

// Call the h5fuse utility
// Removes the subfiles in the process
char* args[] = { strdup( "./h5fuse.sh" ),
char* args[] = { strdup( H5FUSE_EXEC ),
strdup( "-r" ), strdup( "-f" ),
config_filename, NULL };

Expand Down

0 comments on commit 6b145df

Please sign in to comment.