cp2k / dbcsr

DBCSR: Distributed Block Compressed Sparse Row matrix library
https://cp2k.github.io/dbcsr/
GNU General Public License v2.0
135 stars 46 forks source link

Wrap the MPI handles #677

Closed fstein93 closed 1 year ago

fstein93 commented 1 year ago

This PR wraps the MPI handles which used to be plain integers into their own derived types. The handle component is kept private to facilitate the transition to the new mpi_f08 bindings introducing their own types and allow to switch between serial/MPI 90 binding/MPI 2008 bindings. I implemented setters and getters and the comparison operators for convenience. Regarding the constants, the wrapper module will distinguish the handles (which are used for the default initializers) and the actual parameters exposed to the rest of the library. This refactoring improves the type safety within the library.

The new types are used only internally and are not meant to be exposed to users of DBCSR which is why some routines accessible via the dbcsr_api.F module need a wrapper routine to wrap the passed integer handles into the new types. Thus, the external APIs did not change.

Similar changes have already been applied to CP2K. I will continue this PR by adding support for the MPI 2008 bindings which should solve some issues with the old MPI 90 bindings.

jenkins-cscs commented 1 year ago

Can one of the admins verify this patch?

hfp commented 1 year ago

@alazzaro Any objection?

( I think this PR is meant to be the starting point for more contributions. )

alazzaro commented 1 year ago

I'm sorry, I cannot really follow on that this week... Please go ahead and merge it.

fstein93 commented 1 year ago

@hfp @alazzaro Gentle ping

hfp commented 1 year ago

Thank you, Frederick four your contribution!