h5cpp
h5cpp copied to clipboard
Interest in reading/writing Armadillo?
Once nice thing about https://github.com/steven-varga/h5cpp is that it works with matrix libraries (Armadillo, Eigen, ...) out of the box. I 'm writing a uniform HDF5 interface with h5cpp and prefer to read/write Armadillo using it rather than their interface, and came up with https://github.com/berquist/eg/blob/1f176dca5e122720c1ba74dc8840d769f3692c64/cpp/h5cpp/h5cpp_arma.hpp as a first pass at bindings. Is this something that you would be interested in including with h5cpp, so that others don't have to rewrite this boilerplate?
I'm not sure the above bindings are done yet, since I haven't confirmed the data layout (column- vs. row-major) is correct, and maybe more specializations should be added, but it seems like the general approach.
I think this is a great idea. You also did plenty of work. We definitely should support some of the major libraries with traits so that their types can easily be used with h5cpp. As a matter of fact there is already quite some support for 3rd parties in particular for h5py (thanks to Jan). The only thing we should do in advance is to move all the third party support to dedicated directories in the source and install tree. This would allow maintainers of this code to do their work without interfering with the core of the library.
I will open a new ticket for the cleanup (at least I have some idea how this should look like) for the 3rd party support code and once this is done we can add Armadillo as a first use case.
Would this procedure be acceptable for you?
Would this procedure be acceptable for you?
Yes, of course.
I won't be using h5cpp after all for my application (I want to statically link inside of a commercial program), so I'm not in a rush, but keep me notified and I'll prepare a PR.
I'd like to express my interest in an Eigen interface. I could possibly contribute this following the above armadillo implementation as a guide, but I can't make any promises on the timeline
I already have an Eigen adaptor, I'm happy to contribute if no one else gets there first.
I will open a new ticket for the cleanup (at least I have some idea how this should look like) for the 3rd party support code and once this is done we can add Armadillo as a first use case.
Hi @eugenwintersberger , would you like to open a new ticket for the cleanup for the 3rd party support code?
I absolutely do.
I hope I can finish #548 quickly during my holidays starting next week. The only thing users would have to do is to add some more header files when they want to use the STL or h5py support code. Everything else remains as it is. The ticket it not perfectly written yet. Will clean this up sometime today.
For what it's worth, here's my implementation of datatype support for Eigen.
https://gist.github.com/planetmarshall/a74ebc78be871a69aacd5e3dfb38b092
@planetmarshall merci. I will have a look at it.
Hi,
I'm also interested in using h5cpp with Eigen. I've used the snipped of @planetmarshall (thank you for this!) but the get functions were missing. I added this:
const static TypeClass & get(const Type & = Type()) { const static TypeClass & cref_ = create(); return cref_; }
and this:
static const Dataspace & get(const Matrix& matrix, DataspacePool & pool) {
return pool.getSimple(matrix.size());
}
To the snippet, and it seems to work. But I am new to the library and was wondering if I did anything wrong :)
I'm also interested in using h5cpp with Eigen. I've used the snipped of @planetmarshall (thank you for this!) but the
getfunctions were missing. I added this
Hi @mathieu-reymond, yes, you probably use the master branch version (not released yet). To speed-up Dataset.write/Dataset.read I've added the get() method to Traits which should return a reference to const static Datatype or Dataspace object. If there is no unique const static object i.e. returned value may depend on get parameter it should return a default (empty) Datatype() or Dataspace() object.
I won't be using h5cpp after all for my application (I want to statically link inside of a commercial program), so I'm not in a rush, but keep me notified and I'll prepare a PR.
@berquist static linking of h5cpp is implemented in #501 and will hopefully make it into the next release.
Hi @eugenwintersberger @planetmarshall @berquist @shivupa @mathieu-reymond,
since #566 is merged I think we are ready to add the 3rd party support code i.e. TypeTraits for Armadillo and Eigen, to new directories in the src/h5cpp/contrib directory. What do you think?