Skip to content

Commit

Permalink
hdf5 parallel is optional. set compile-time if statements.
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamer2368 committed Mar 18, 2024
1 parent 09b8271 commit fdff1ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/utils/HDFDatabaseMPIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@
namespace CAROM {

HDFDatabaseMPIO::HDFDatabaseMPIO() :
#if HDF5_IS_PARALLEL
HDFDatabase(),
d_rank(-1),
d_comm(MPI_COMM_NULL)
#else
HDFDatabase()
#endif
{}

#if HDF5_IS_PARALLEL

bool
HDFDatabaseMPIO::create(
const std::string& file_name,
Expand Down Expand Up @@ -627,4 +633,6 @@ HDFDatabaseMPIO::writeAttribute(
#endif
}

#endif

}
2 changes: 2 additions & 0 deletions lib/utils/HDFDatabaseMPIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class HDFDatabaseMPIO : public HDFDatabase
virtual
~HDFDatabaseMPIO() {}

#if HDF5_IS_PARALLEL
/**
* @brief Creates a new HDF5 database file for distributed data
* with the supplied name.
Expand Down Expand Up @@ -416,6 +417,7 @@ class HDFDatabaseMPIO : public HDFDatabase
int block_offset_global,
int block_size_global,
int stride_global);
#endif
};

}
Expand Down
4 changes: 4 additions & 0 deletions unit_tests/test_HDFDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ TEST(GoogleTestFramework, GoogleTestFrameworkFound) {
SUCCEED();
}

#if HDF5_IS_PARALLEL

TEST(HDF5, Test_parallel_writing)
{
int nproc, rank;
Expand Down Expand Up @@ -537,6 +539,8 @@ TEST(HDF5, Test_selective_parallel_reading)
EXPECT_TRUE(data[d] == d + offsets[rank] * ncol);
}

#endif

TEST(BasisGeneratorIO, HDFDatabase)
{
// Get the rank of this process, and the number of processors.
Expand Down

0 comments on commit fdff1ff

Please sign in to comment.