PETSC.jl MPI wrapper

Hello,
I would love to know if someone has used PETSC wrapper in Julia for MPI? I am planning to develop a parallel code using the PETSC wrapper and would like to know how extensive the PETSC functionality is in Julia. Can one expect to find all PETSC commands (just like in C,C++,Fortran)? Also how good is the documentation?

Not a user of it but check out https://github.com/JuliaParallel/PETSc.jl.

1 Like

In PETSc.jl, @jkozdon started to automatically wrap the full PETSc package, which is available in this branch and employs the precompiled PETSc_jll binaries (which also works in parallel).
To make this more julia-like, we started adding some functionality for DMDA and partly for DMSTAG but ran out of time a while ago. We are hoping to finish this work over the coming weeks, and push this branch back to main.
Documentation is very limited, but as it mostly follows the actual PETSc routines, it shouldn’t be too difficult to use (have a look at the examples or the quite extensive tests).

1 Like

Just an update after a long time. The PETSc.jl repo is now updated to work on the latest Julia release (1.11) - by @boriskaus and me.

A major next project would be to do what @boriskaus outlined above. Much of the work already exists in a PR on the repo, that will need to be revived.

3 Likes

Hi, did you develop it ?
I was also curious about how extensive the PETSc wrapper is in Julia.

I am also looking into using PETSC as well.
I glad to see some updates on PETSC.jl !

I think @boriskaus may be the right person to chime in about how extensive the wrappers are. My main contribution was to have it update to Julia 1.11, and hopefully that will also make it easy to run in 1.12 as well.

Indeed, there has been a long-standing attempt to try and wrap the whole PETSc library to Julia. As the original dmstag branch became too large, I revived this last year, and much of it is available in this branch:

This includes automatically wrapping of nearly the full PETSc library using Clang, which results in a file lib/petsc_library.jl that is over 77k lines long. In principle, you can thus call nearly every PETSc function from julia already.
The issue is that much of this is not very julia-like and therefore of limited practical use.

Therefore, I also wrote some helper functions to automatically create nicer formatted julia functions (gem/wrap_functions), while also adding tests for it (which shows what is currently working).

My issue is a lack of time. I seem to have a few days every 6 months or so to spend on this, and at this rate it’ll take very long to finish.

If there are people that would like to see more functionality added to PETSc.jl (@pitipatw, @priyanshuFSI), you are very welcome to help with this effort.

Note that making nicer julia wrappers around the PETSc functions only has to be done once, after which we only need to push minor modifications to routines that change in future PETSc versions.

1 Like

Thank you @boriskaus for the clarification.

I do want to contribute, however, I’m a beginner Julia user + very new to PETSc.

If you could kindly guide how I could help, I’m willing to do so and spend time on it this summer.