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

Suggestions on wrapping a code #219

Open
Fratorhe opened this issue Jun 4, 2024 · 4 comments
Open

Suggestions on wrapping a code #219

Fratorhe opened this issue Jun 4, 2024 · 4 comments

Comments

@Fratorhe
Copy link

Fratorhe commented Jun 4, 2024

Hello,

First, I'd like to thank for this great package!
I am trying to wrap a relatively large F90 code that has also a few dependences.
I started using the examples provided for Makefile and made it work for a limited number of functions (see attachment).
The issue comes when I try to extend it to a larger part of the codebase for two main reasons:

  • Order of the dependencies: I do not know how to ensure the order to compile the modules to respect the dependency tree.
  • External dependencies: this code uses dependencies (for example SUNDIALS), and when I try to wrap parts that contain them, I get the error that they are not found.

I would like to get some advice on how to approach these two issues.

Thanks in advance,
Francisco

Makefile.txt

@jameskermode
Copy link
Owner

Both of these should be solvable. Satisfying dependencies just required compiling modules in the right order, while linking to external libraries is best done by adding linker options (e.g. of the form -L/path/to/library -llibrary) to the command ine passed to f2py-f90wrap rather than by attempting to generate wrappers all the way down into the dependencies. Here's the Makefile for a moderately complex example which may give you insipriation:

https://github.com/libAtoms/QUIP/blob/public/quippy/Makefile

@Fratorhe
Copy link
Author

Fratorhe commented Jun 6, 2024

I will have a look at QUIP.
Do you suggest sticking to Make or use the meson builder? (I have never used it before)

Thanks a lot for the advices, I will keep you posted!

@jameskermode
Copy link
Owner

I've also mainly used Make for multi-language projects, but Meson is a more modern approach and has some nice features if you are starting from scratch.

@Fratorhe
Copy link
Author

Ok, I managed to get it started. I can compile a few modules and get some functions working with the includes as well.
To generate the list of files to be compiled ans wrapped I use an external python script (I will integrate it later in the makefile).
From my complete ignorance, is it possible to use the already compile modules (*.mod files), because I guess that could make things easier (or at least faster). I am not sure if this is done in the example you shared with me.
I am attaching the current status of my case (based on the f90wrap examples) if that's of any help.
Makefile1.txt

Thanks!

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

2 participants