File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -99,19 +99,23 @@ include("mpiexec_wrapper.jl")
99
99
include (" deprecated.jl" )
100
100
101
101
function __init__ ()
102
-
103
102
@static if Sys. isunix ()
104
103
# dlopen the MPI library before any ccall:
105
104
# - RTLD_GLOBAL is required for Open MPI
106
- # <https://www.open-mpi.org/community/lists/users/2010/04/12803.php>
107
- # - also allows us to ccall global symbols, which enables
108
- # profilers which use LD_PRELOAD
109
- # - don't use RTLD_DEEPBIND; this leads to segfaults at least
110
- # on Ubuntu 15.10
111
- # <https://github.com/JuliaParallel/MPI.jl/pull/109>
105
+ # https://www.open-mpi.org/community/lists/users/2010/04/12803.php
106
+ # - also allows us to ccall global symbols, which enables profilers
107
+ # which use LD_PRELOAD
108
+ # - don't use RTLD_DEEPBIND; this leads to issues with multiple MPI
109
+ # libraries:
110
+ # https://github.com/JuliaParallel/MPI.jl/pull/109
111
+ # https://github.com/JuliaParallel/MPI.jl/issues/587
112
112
Libdl. dlopen (libmpi, Libdl. RTLD_LAZY | Libdl. RTLD_GLOBAL)
113
113
end
114
114
115
+ # Needs to be called after `dlopen`. Use `invokelatest` so that `cglobal`
116
+ # calls don't trigger early `dlopen`-ing of the library.
117
+ Base. invokelatest (Consts. init_consts)
118
+
115
119
# disable UCX memory cache, since it doesn't work correctly
116
120
# https://github.com/openucx/ucx/issues/5061
117
121
if ! haskey (ENV , " UCX_MEMTYPE_CACHE" )
Original file line number Diff line number Diff line change 39
39
error (" Unknown MPI ABI $(MPIPreferences. abi) " )
40
40
end
41
41
42
- @eval function __init__ ()
42
+ # Initialize the ref constants from the library.
43
+ # This is not `Consts.__init__`, as it should be called _after_
44
+ # `dlopen` to ensure the library is opened correctly.
45
+ @eval function init_consts ()
43
46
$ (Expr (:block , initexprs... ))
44
47
end
45
48
49
+ # since this is called by invokelatest, it isn't automatically precompiled
50
+ precompile (init_consts, ())
51
+
46
52
end
You can’t perform that action at this time.
0 commit comments