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

Registerd binary wrapper and julia package #289

Open
mloubout opened this issue Apr 21, 2023 · 11 comments
Open

Registerd binary wrapper and julia package #289

mloubout opened this issue Apr 21, 2023 · 11 comments

Comments

@mloubout
Copy link

Hi

Since we SLIM work a lot in julia and some external user could be interested, I have created a julia native wrapper for rsf which consist of:

  • RSF_jll a Julia binary library with rsf libs and programmed precompiled so that it can be added and installed in a second. I was only able to configure it for a couple of architecture but would like to extend it. PR at New Recipe: RSF v1.0.0 JuliaPackaging/Yggdrasil#6627
  • Madagascar.jl which is basically a lightweight version of m8r.jl . still few bugs to fix but mostly there.

So was just wondering if it's something you are fine with and/or interested in.

Cheers

@deckerla
Copy link
Contributor

deckerla commented Apr 21, 2023

Love this idea
To elaborate, having Madagascar.jl as a registered Julia package would make package management / dependency issues significantly simpler if we were doing deployment of Madagascar functionality on cloud instances.
I haven't really tried that with m8r.jl. It may work well, but I just have limited knowledge & experience using the Julia Madagascar wrapping.
Using Madagascar.jl it should also be straightforward to package Madagascar operators as Jets and use them within the COFII framework.

@mloubout
Copy link
Author

The good news is that it seems to pass all the test nicely on ubuntu so that's a great start. The main thing is that it would basically avoid the massive work to compile it and have a nice portable framework with all the libs and executables.

Yes wrapping it in Jets/JOLI/LinearMaps/.... would be a really nice extra as well.

Waiting for the jll to be merged and I'll register the initial POC version of Madagascar in general registry once I fxed the docstrings.

Binaries

RSF_jll
Madagascar.jl

@sfomel
Copy link
Contributor

sfomel commented Apr 24, 2023

Please compare with the old interface to show how this improves it https://reproducibility.org/blog/2015/09/28/julia/

The wave propagation example https://github.com/ahay/src/blob/master/api/julia/test/afdm.jl is tested in book/rsf/rsf/afdm https://github.com/ahay/src/blob/master/book/rsf/rsf/afdm/SConstruct

@mloubout
Copy link
Author

mloubout commented Apr 24, 2023

The interface is the same the difference is that the actual libraries and executable are wrapped into Julia binaries so that it can be installed directly from Julia as a standardized Julia package

It's also automatically tested so I'll make sure to add those

@deckerla
Copy link
Contributor

deckerla commented Apr 24, 2023 via email

@mloubout
Copy link
Author

mloubout commented Apr 25, 2023

Ok so Madagascar_jll) is now registered, i,e the precompiled sources only

Madagascar.jl now setup with it a tested with CI including the afdm example above revamped for the new interface so you can just run julia afdm.jl. (Test results there)

Working on adding support for additional platform but looks like a good start and will probably register it fairly soon. Probably gonna compute some reference values for afdm to check correct solution as well.

It can be simply installed as

] add  https://github.com/mloubout/Madagascar.jl

on a linux system and won't need any other installation steps

@tmasthay
Copy link

tmasthay commented May 15, 2024

It appears to me that while the CI tests pass for Madagascar.jl, the wrapper for sf_floatwrite will dump the binary content into the terminal.

See the Run tests workflow at this link to see this behavior. It is a fork with a single empty commit to reproduce the latest CI run (last one was deleted due to GitHub storage timeout). You will have to scroll down to line 416 of the output to see the beginning of the binary dump.

I suspect that the issue lies in the wrapper for sf_floatwrite. If I simply comment out the writing to the file when running julia afdm.jl, then the binary dumping does not occur (of course, neither does writing to an rsf file). I have also adding some debugging info at this link for reference. The same behavior takes place in run_tests.jl for me.

Finally, I would just like to note that at each iteration of the time-stepping loop of afdm.jl, the length of the binary dump gets larger and larger, so it does seem to be writing the information correctly. Furthermore, on the first iteration, the header information of the rsf is printed to stdout as well.

@mloubout
Copy link
Author

Looks like afdm.jl was setup with stdout output ('Fo = Madagascar.sf_output("out")'). I have changed it to a file to make sure it doesn't blow up the log.

You can see here the log is now fine

@tmasthay
Copy link

tmasthay commented May 31, 2024

@mloubout I am trying to build a GitHub Action that checks against the executables listed in Madagascar_jll so that a pull request can be sent to Yggdrasil for regular, automated releases of the precompiled binaries. When I build Madagascar on my Pop!_OS Ubuntu 22.04 system, my build system generates 176 executables that are not in the build_tarballs.jl script, and for some reason, I also do not build two that are in build_tarballs.jl. I know you did this over a year ago at this point, but do you recall why the subset of ExecutableProduct commands was chosen?

Attached here is a workflow that shows how I built Madagascar from source (what I believe to be essentially a carbon copy of the workflow from build_tarballs.jl) and then a simple script that does string processing for comparison.

Some executables listed like sfnpyCorr I imagine have pretty clear reason such as sfnpyCorr which I imagine depends on numpy and thus doesn't make sense to include in this julia package.

@mloubout
Copy link
Author

mloubout commented Jun 1, 2024

Hi @tmasthay . Thanks for reaching out.

As you pointed out I haven't really looked at this in a bit, there is PR opened I need to finish on Yggdrasil that add supports for more architectures as well you might wanna look at.

For the list of executable, I don't remember how I generated that list, I think I made a basic bash script that read the content of the bin dir but might have ran it on a broken install so I wouldn't be surprised if there is missing ones in the current released version. Ideally that by-hand list should be replaced by a searchdir for more robust lib discovery. That's what Madagascar.jl does to generate the wrapper for all the executables dynamically.

I'll see if I can find some time next week to cleanup the PR and if there is extra details I can share.

@tmasthay
Copy link

tmasthay commented Jul 9, 2024

@mloubout
I talked with @sfomel, and we decided it might be better to support a build from source as well. I have posted a pull request on main of your branch that supports from source with a detailed message (see TODO at the bottom...I think there is a way to support both precompiled and source builds by figuring out compile-time environment).

mloubout/Madagascar.jl#2

TLDR on the pull request: to do from source, use main branch (since rsf_read and rsf_write are pure julia and thus would be "easier" than precompiled binaries), and the precompiled branch HEAD is the same as the current HEAD of your repo.

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

4 participants