-
Notifications
You must be signed in to change notification settings - Fork 125
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
Hdf5 #101
Hdf5 #101
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs most member variables renamed. Also please fix the HDF5 Write test
myCLongDoubles.data() + complexOffset); | ||
int ts = 0; | ||
int totalts = 2; | ||
while (true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while(true) is clunky here. Should be a for loop. Try:
for(int ts = 0; ts < totalts; ++ts)
source/adios2/ADIOS.cpp
Outdated
|
||
else if (type == "HDF5Reader") // -Junmin | ||
{ | ||
#if defined(ADIOS_HAVE_PHDF5) && defined(ADIOS_HAVE_MPI) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should just be #ifdef ADIOS2_HAVE_HDF5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
H5Pclose(_plist_id); | ||
} | ||
|
||
HDF5Common::~HDF5Common() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The empty destructor can be left out completely and a default destructor will be inserted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
*/ | ||
HDF5Common(); | ||
|
||
virtual ~HDF5Common(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No inheritance so no need to make this virtual. Also can be removed entirely since the implementation is empty and just let the compiler generate a default destructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
int GetNumTimeSteps(); | ||
void WriteTimeSteps(); | ||
|
||
hid_t _plist_id, _file_id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All member variables should be named as m_VarName
not _var_name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
Variable<void> *HDF5Reader::InquireVariable(const std::string &variableName, | ||
const bool readIn) | ||
{ | ||
std::cout << "Not implemented: HDF5Reder::InquireVariable()" << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing return value. Add return nullptr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
|
||
Variable<double> * | ||
HDF5Reader::InquireVariableDouble(const std::string &variableName, const bool) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't actually return anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added null return, for now.
This function has a body now, because I noticed ReadMe(), which is not inherited from any parent class, was not touched during compilation, unless I call it from a parent class function, like InquireVariableDouble().
Do you know why?
|
||
virtual ~HDF5Reader(); | ||
|
||
Variable<void> *InquireVariable(const std::string &variableName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these InquireVariableTypeName
member functions would be better suited to a single template function with specializations for each type.
void ReadMe(Variable<T> variable, T *values, hid_t h5type); | ||
|
||
private: | ||
HDF5Common _H5File; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use m_VarName
for all data members, not _var_name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All access in user-facing code to the engines should be through the abstract engine class, not through the HDF5Writer class directly.
I think you misunderstood what I meant in the test. For the ADIOS2HDF5WriteHDF5Read tests, we want to use the ADIOS2 HDF5Writer engine to write the data but then use HDF5 directly to read the data, i.e. not the HDF5Reader engine. The ADIOS2 Read API is still in quite a bit of flux so I don't want to build tests on it yet. Besides, those will be seperate tests: Write with hdf5 -> read with adios2+hdf5, write with adios2+hdf5 -> read with adios2+hdf5, but don't bother with those yet. Currently we jsut want write with adios2+hdf5 -> read with hdf5.
Also, most of the comments from the previos review remain unaddressed.
Hi Chuck, I understood your request. I just put the function ReadMe() in HDF5Reader for convenience. I assume this hdf5 direct access check will disappear after ADIOS2 read is in place. At the time, I will just simply remove that function. |
To be precise, ReadMe() is invoked directly through HDR5Reader, not going through the ADIOS engine at all. |
It will remain as a permanent test. It's part of ensuring correctness for the interoperability aspect. We need to make sure that all of the following situations work:
Currently the second two will remain empty until the adios2 read API settles, but the first one needs to be in place now. Having the read validation test not using adios2 at all ensures that we don't create hdf5 files that are incompatible with apps only using hdf5 and not adios2. |
I will put a read function in the HDF5Common class. It is better? |
The read validation should be directly in the test and directly using hdf5, not as any component of the engine. Basically you should be able to read the data back and verify it's dimensions and contents without using anything from adios2. |
hdf5 read engine will call hdf5 interface too, and that is what HDF5Common is for. It has nothing to do with engine, just make hdf5 calls. |
to read hdf directly
never mind. I put a simple hdf5 read class in the TestHDF5WriteRead.cpp |
The ADIOSWriteInterfcace test now fails. I assume this has to do with the swapping for global and local dimension parameters in the variable class.
|
I am fixing that test in my pull request.
Norbert
…On Fri, May 5, 2017 at 2:56 PM, Chuck Atkins ***@***.***> wrote:
The ADIOSWriteInterfcace test now fails. I assume this has to do with the
swapping for global and local dimension parameters in the variable class.
$ ./bin/TestADIOSInterfaceWrite
[==========] Running 20 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 20 tests from ADIOSInterfaceWriteTest
[ RUN ] ADIOSInterfaceWriteTest.DefineVarChar1x10
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:36: Failure
Expected: var_i8.m_LocalDimensions.size()
Which is: 0
To be equal to: 1
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarChar1x10 (1 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarShort1x10
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:53: Failure
Expected: var_i16.m_LocalDimensions.size()
Which is: 0
To be equal to: 1
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarShort1x10 (0 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarInt1x10
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:67: Failure
Expected: var_i32.m_LocalDimensions.size()
Which is: 0
To be equal to: 1
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarInt1x10 (1 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarLong1x10
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:81: Failure
Expected: var_i64.m_LocalDimensions.size()
Which is: 0
To be equal to: 1
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarLong1x10 (0 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarUChar1x10
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:97: Failure
Expected: var_u8.m_LocalDimensions.size()
Which is: 0
To be equal to: 1
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarUChar1x10 (0 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarUShort1x10
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:114: Failure
Expected: var_u16.m_LocalDimensions.size()
Which is: 0
To be equal to: 1
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarUShort1x10 (0 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarUInt1x10
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:130: Failure
Expected: var_u32.m_LocalDimensions.size()
Which is: 0
To be equal to: 1
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarUInt1x10 (1 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarULong1x10
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:146: Failure
Expected: var_u64.m_LocalDimensions.size()
Which is: 0
To be equal to: 1
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarULong1x10 (0 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarFloat1x10
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:162: Failure
Expected: var_r32.m_LocalDimensions.size()
Which is: 0
To be equal to: 1
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarFloat1x10 (0 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarDouble1x10
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:178: Failure
Expected: var_r64.m_LocalDimensions.size()
Which is: 0
To be equal to: 1
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarDouble1x10 (0 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarChar2x5
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:193: Failure
Expected: var_i8.m_LocalDimensions.size()
Which is: 0
To be equal to: 2
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarChar2x5 (1 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarShort2x5
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:210: Failure
Expected: var_i16.m_LocalDimensions.size()
Which is: 0
To be equal to: 2
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarShort2x5 (0 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarInt2x5
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:226: Failure
Expected: var_i32.m_LocalDimensions.size()
Which is: 0
To be equal to: 2
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarInt2x5 (0 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarLong2x5
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:242: Failure
Expected: var_i64.m_LocalDimensions.size()
Which is: 0
To be equal to: 2
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarLong2x5 (0 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarUChar2x5
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:259: Failure
Expected: var_u8.m_LocalDimensions.size()
Which is: 0
To be equal to: 2
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarUChar2x5 (0 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarUShort2x5
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:277: Failure
Expected: var_u16.m_LocalDimensions.size()
Which is: 0
To be equal to: 2
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarUShort2x5 (0 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarUInt2x5
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:295: Failure
Expected: var_u32.m_LocalDimensions.size()
Which is: 0
To be equal to: 2
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarUInt2x5 (0 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarULong2x5
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:313: Failure
Expected: var_u64.m_LocalDimensions.size()
Which is: 0
To be equal to: 2
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarULong2x5 (0 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarFloat2x5
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:330: Failure
Expected: var_r32.m_LocalDimensions.size()
Which is: 0
To be equal to: 2
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarFloat2x5 (0 ms)
[ RUN ] ADIOSInterfaceWriteTest.DefineVarDouble2x5
/home/khq.kitware.com/chuck.atkins/Code/adios/source/hdf5/testing/adios2/interface/TestADIOSInterfaceWrite.cpp:347: Failure
Expected: var_r64.m_LocalDimensions.size()
Which is: 0
To be equal to: 2
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarDouble2x5 (0 ms)
[----------] 20 tests from ADIOSInterfaceWriteTest (5 ms total)
[----------] Global test environment tear-down
[==========] 20 tests from 1 test case ran. (5 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 20 tests, listed below:
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarChar1x10
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarShort1x10
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarInt1x10
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarLong1x10
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarUChar1x10
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarUShort1x10
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarUInt1x10
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarULong1x10
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarFloat1x10
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarDouble1x10
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarChar2x5
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarShort2x5
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarInt2x5
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarLong2x5
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarUChar2x5
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarUShort2x5
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarUInt2x5
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarULong2x5
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarFloat2x5
[ FAILED ] ADIOSInterfaceWriteTest.DefineVarDouble2x5
20 FAILED TESTS
$
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#101 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADGMLWXH51aVsIDHhXoge0lywydUuhulks5r23DwgaJpZM4NOdKj>
.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it looks like a lot, but really it's mostly just formatting a changes for variable names and removing large blocks of disabled code. Almost there!
@@ -10,7 +10,10 @@ | |||
|
|||
#include <mpi.h> | |||
|
|||
#include <adios2.h> | |||
#define ADIOS_HAVE_PHDF5 // so hdf5 related items are loaded in ADIOS_CPP.h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User-code doesn't see the internal ADIOS headers anymore. This whole include block should just be #include <adios2.h>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
*/ | ||
|
||
#ifndef NEVER | ||
adios::HDF5Common myReader; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove #ifdef'd out code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
source/adios2/ADIOS.cpp
Outdated
else if (type == "HDF5Reader") // -Junmin | ||
{ | ||
//#if defined(ADIOS_HAVE_PHDF5) && defined(ADIOS_HAVE_MPI) | ||
#ifdef ADIOS_HAVE_PHDF5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ADIADIOS2_HAVE_HDF5
, not ADIOS_HAVE_PHDF5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
source/adios2/core/VariableBase.h
Outdated
const std::size_t elementSize, const Dims localDimensions, | ||
const Dims globalDimensions, const Dims offsets, | ||
const std::size_t elementSize, const Dims globalDimensions, | ||
const Dims localDimensions, const Dims offsets, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this ordering makes more sense but now it's not consistent with Variable.h. Please revert.
} | ||
|
||
#ifdef NEVER | ||
template <class T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove #ifdef
'd code block
// H5Sclose(_memspace); | ||
// H5Pclose(_plist_id); | ||
H5Fclose(_file_id); | ||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented out code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
|
||
_filespace = H5Screate_simple(dimSize, dimsf.data(), NULL); | ||
hid_t _filespace = H5Screate_simple(dimSize, dimsf.data(), NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://github.com/ornladios/ADIOS2/wiki/Variables-Scope,-Functions,-and-Namespaces for local variables using camelCase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -86,22 +85,30 @@ class HDF5Writer : public Engine | |||
void Write(const std::string variableName, | |||
const std::complex<long double> *values); | |||
|
|||
void Advance(float timeout_sec = 0.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://github.com/ornladios/ADIOS2/wiki/Variables-Scope,-Functions,-and-Namespaces for function parameters using camelCase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
HDF5Common _H5File; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_H5File
-> m_H5File
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
HDF5Common _H5File; | ||
|
||
/* | ||
hid_t _plist_id, _file_id, _dset_id; | ||
hid_t _memspace, _filespace; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented out code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Fixes #96 |
added timestep and read write.
looks like I need to merge with master? structure was changed
for using reader in current write-read test, see helloHDF5Writer.cpp at the end of write section, there is a few lines to read what was written.