-
Notifications
You must be signed in to change notification settings - Fork 37
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
Automatically wrapping with Clang.jl
#149
Conversation
Doesn't work with everything yet but you can call initialize and finalize. |
Input: # For some reason you need to initialize MPI before using multiple libraries.
# Need to debug this
using MPI
MPI.Initialized() || MPI.Init()
using PETSc
for petsclib in PETSc.LibPETSc.petsclibs
println(splitpath(petsclib.petsc_library)[end])
@show PETSc.initialized(petsclib)
@show PETSc.initialize(petsclib)
@show PETSc.initialized(petsclib)
@show PETSc.finalized(petsclib)
@show PETSc.finalize(petsclib)
@show PETSc.initialized(petsclib)
@show PETSc.finalized(petsclib)
println()
end Output: libpetsc_double_real_Int64.dylib
PETSc.initialized(petsclib) = false
PETSc.initialize(petsclib) = nothing
PETSc.initialized(petsclib) = true
PETSc.finalized(petsclib) = false
PETSc.finalize(petsclib) = nothing
PETSc.initialized(petsclib) = false
PETSc.finalized(petsclib) = true
libpetsc_single_real_Int64.dylib
PETSc.initialized(petsclib) = false
PETSc.initialize(petsclib) = nothing
PETSc.initialized(petsclib) = true
PETSc.finalized(petsclib) = false
PETSc.finalize(petsclib) = nothing
PETSc.initialized(petsclib) = false
PETSc.finalized(petsclib) = true
libpetsc_double_complex_Int64.dylib
PETSc.initialized(petsclib) = false
PETSc.initialize(petsclib) = nothing
PETSc.initialized(petsclib) = true
PETSc.finalized(petsclib) = false
PETSc.finalize(petsclib) = nothing
PETSc.initialized(petsclib) = false
PETSc.finalized(petsclib) = true
libpetsc_single_complex_Int64.dylib
PETSc.initialized(petsclib) = false
PETSc.initialize(petsclib) = nothing
PETSc.initialized(petsclib) = true
PETSc.finalized(petsclib) = false
PETSc.finalize(petsclib) = nothing
PETSc.initialized(petsclib) = false
PETSc.finalized(petsclib) = true |
I guess I still need to sort out the types (But I think it should be possible with more walking of the syntax tree). |
1e39b30
to
97e39a4
Compare
16b5f8e
to
fe80c8f
Compare
Lazy question, but what's the high-level procedure here? What is now automatic and what still has to be maintained "by hand"? Are the specific things here related to various PETSc components all of the "by hand" flavor, or are those things that have been generated automatically and are then checked in? |
I think everything in |
As @vchuravy said, the file in There is a bunch of stuff we do not currently wrap (look at There probably some gotchas left in there with respect to system / build dependent types that will need to be sorted out, but right now it does support multiple PETSc builds living side-by-side in Julia. @psanan shoot me an email if you'd like to VTC to chat about what I am doing, I'd be more than happy to have feedback. |
53fc7ab
to
aa8e660
Compare
afbe26f
to
0f22d51
Compare
3e3e0f9
to
1850ac4
Compare
Docs suggestion, re our chat our yesterday. Perhaps somewhere like here one could add language like "PETSc.jl's high-level, easy-to-use interface exposes only some of the functionality of PETSc. However, PETSc.jl includes an automatically-generated wrapper layer which directly exposes more of the PETSc API, which may be of use to existing expert users. See (link to minimal example/test of using the wrappers, directly) for an example". |
Thanks for the recommendation. I've put it as part of the PR task list. |
8880682
to
0846151
Compare
7d50259
to
f499bc4
Compare
4db9766
to
581f379
Compare
# ideally we would capture the output directly, but this looks difficult | ||
# easiest option is to redirect stdout | ||
# based on suggestion from https://github.com/JuliaLang/julia/issues/32567 | ||
function _show(io::IO, obj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still has problems with large matrices.
Might be better to create a temp file with mktemp()
, redirect the PETSC output to an ascii file with PetscViewerASCIIOpenWithFILE
, then dump the contents to io
.
Or something is wrong with the flush
?
Experimenting to play with #147
Todo
Clang.jl
#149 (comment))test/dmda.jl
failure...examples/laplacian.jl
failure...