-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
Intended way to generate MPI.jl compatible C bindings #667
Comments
Can |
(Slightly tangential, I am curious why there is a mismatch between Line 35 in 3f21294
|
Thanks for the quick answer and your suggestion. I already tried to use this one as a template. diff --git a/gen/generator.jl b/gen/generator.jl
index d6880cb..3df8f19 100644
--- a/gen/generator.jl
+++ b/gen/generator.jl
@@ -1,10 +1,18 @@
using Clang.Generators
-using HYPRE_jll, MPICH_jll
+using HYPRE_jll, MPIPreferences
cd(@__DIR__)
+if MPIPreferences.binary == "MPICH_jll"
+ import MPICH_jll: artifact_dir
+elseif MPIPreferences.binary == "OpenMPI_jll"
+ import OpenMPI_jll: artifact_dir
+else
+ error("Unknown MPI binary: $(MPIPreferences.binary)")
+end
+
hypre_include_dir = normpath(HYPRE_jll.artifact_dir, "include")
-mpi_include_dir = normpath(MPICH_jll.artifact_dir, "include")
+mpi_include_dir = normpath(artifact_dir, "include")
options = load_options(joinpath(@__DIR__, "generator.toml")) but the types are still not matching - and we generate quite a bit of redundant code which is readily available in MPI.jl. |
I'm not entirely sure that file was automatically generated from header files, |
This could maybe be of inspiration https://github.com/cesmix-mit/LAMMPS.jl/tree/main/res |
It wasn't, that was manually translated. I don't think it matters which one we use. I'm not sure why I changed them to unsigned? Perhaps changing them back to |
Sorry to ask again, but how exactly is the variable mpi_header_dir ( |
Okay, I ran into Line 10 in 61947d9
? |
Lets just change them to signed: that's what they are in the headers. |
Basically, we can reuse symbols from MPI by treating MPI headers as system headers.
to
|
In this way, all useless symbols under |
Exactly what I was looking for - thanks! Now, if I am understanding correctly, then Binary Builder ensures that an artifact matching the MPI backend selected in MPIPreferences is selected, right? |
I've changed the MPICH and Microsoft MPI handles to now be signed ints (#668), I'll tag a new patch release. It would be great to turn this discussion into some docs. |
I am currently trying to generate MPI.jl compatible bindings of the C library HYPRE with the help Clang.jl . The current generator (found here https://github.com/termi-official/HYPRE.jl/blob/master/gen/generator.jl) creates files that have incompatible data types (see e.g. https://github.com/termi-official/HYPRE.jl/blob/master/lib/LibHYPRE.jl#L6), so I was wondering what the intended way to grab the correct MPI headers and data type definitions is?
cc @fredrikekre @Gnimuc
The text was updated successfully, but these errors were encountered: