Skip to content
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
24 changes: 14 additions & 10 deletions source/adios2/engine/hdf5/HDF5ReaderP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ HDF5ReaderP::HDF5ReaderP(IO &io, const std::string &name, const Mode openMode, h
m_IsOpen = true;
}

HDF5ReaderP::~HDF5ReaderP()
{
if (IsValid())
DoClose();
}
HDF5ReaderP::~HDF5ReaderP() { DestructorClose(m_FailVerbose); }

bool HDF5ReaderP::IsValid()
{
Expand Down Expand Up @@ -132,6 +128,7 @@ size_t HDF5ReaderP::ReadDataset(hid_t dataSetId, hid_t h5Type, Variable<T> &vari
std::vector<hsize_t> start(ndims), count(ndims), stride(ndims);
bool isOrderC = (m_IO.m_ArrayOrder == ArrayOrdering::RowMajor);

size_t total_size = 1;
for (size_t i = 0u; i < ndims; i++)
{
if (isOrderC)
Expand All @@ -146,6 +143,7 @@ size_t HDF5ReaderP::ReadDataset(hid_t dataSetId, hid_t h5Type, Variable<T> &vari
}
slabsize *= count[i];
stride[i] = 1;
total_size *= variable.m_Shape[i];
}
hid_t ret = H5Sselect_hyperslab(fileSpace, H5S_SELECT_SET, start.data(), stride.data(),
count.data(), NULL);
Expand All @@ -166,7 +164,10 @@ size_t HDF5ReaderP::ReadDataset(hid_t dataSetId, hid_t h5Type, Variable<T> &vari
elementsRead *= count[i];
}

bool useRemote = CheckRemote();
/* FIXME: Right now it's baked into campaign management that HDF5 metadata files contain
data for arrays of <= 128 elements. This code must be in sync with what the
hpc_campaign_hdf5_metadata.py script does */
bool useRemote = (total_size > 128 && CheckRemote());

if (useRemote)
{
Expand Down Expand Up @@ -399,12 +400,15 @@ ADIOS2_FOREACH_STDTYPE_1ARG(declare_type)

void HDF5ReaderP::DoClose(const int transportIndex)
{
/*
*/
EndStep();
/*
*/
m_H5File.Close();
m_IsOpen = false;
}

void HDF5ReaderP::DestructorClose(bool Verbose) noexcept
{
if (IsValid())
DoClose();
}

size_t HDF5ReaderP::DoSteps() const { return m_H5File.GetAdiosStep(); }
Expand Down
2 changes: 2 additions & 0 deletions source/adios2/engine/hdf5/HDF5ReaderP.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ class HDF5ReaderP : public Engine

size_t DoSteps() const final;

void DestructorClose(bool Verbose) noexcept final;

// Remote data access variables and functions
std::unique_ptr<Remote> m_Remote;
bool CheckRemote();
Expand Down
Loading