Skip to content
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

Interest in reading/writing Armadillo? #505

Open
berquist opened this issue Aug 31, 2021 · 13 comments
Open

Interest in reading/writing Armadillo? #505

berquist opened this issue Aug 31, 2021 · 13 comments

Comments

@berquist
Copy link

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.

@eugenwintersberger
Copy link
Collaborator

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?

@berquist
Copy link
Author

berquist commented Sep 4, 2021

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.

@shivupa
Copy link
Contributor

shivupa commented Sep 8, 2021

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

@planetmarshall
Copy link
Contributor

I already have an Eigen adaptor, I'm happy to contribute if no one else gets there first.

@jkotan jkotan mentioned this issue Dec 6, 2021
3 tasks
@jkotan
Copy link
Collaborator

jkotan commented Dec 10, 2021

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?

@eugenwintersberger
Copy link
Collaborator

I absolutely do.

@eugenwintersberger
Copy link
Collaborator

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.

@planetmarshall
Copy link
Contributor

For what it's worth, here's my implementation of datatype support for Eigen.

https://gist.github.com/planetmarshall/a74ebc78be871a69aacd5e3dfb38b092

@eugenwintersberger
Copy link
Collaborator

@planetmarshall merci. I will have a look at it.

@mathieu-reymond
Copy link

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 :)

@jkotan
Copy link
Collaborator

jkotan commented Dec 16, 2021

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

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.

@planetmarshall
Copy link
Contributor

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.

@jkotan
Copy link
Collaborator

jkotan commented Jan 31, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants