Skip to content

Commit 31947ff

Browse files
authored
[MPIPreferences] Always set ZES_ENABLE_SYSMAN=1 when dlopening libmpi (#571)
1 parent 7cb10d5 commit 31947ff

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

lib/MPIPreferences/src/MPIPreferences.jl

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ function use_system_binary(;
9797
force=true,
9898
)
9999

100-
libmpi = find_library(library_names)
100+
# Set `ZES_ENABLE_SYSMAN` to work around https://github.com/open-mpi/ompi/issues/10142
101+
libmpi = withenv("ZES_ENABLE_SYSMAN" => "1") do
102+
find_library(library_names)
103+
end
101104
if libmpi == ""
102105
error("MPI library could not be found")
103106
end
@@ -144,13 +147,16 @@ function identify_abi(libmpi)
144147
buf = Array{UInt8}(undef, 8192)
145148
buflen = Ref{Cint}()
146149

147-
@static if Sys.isunix()
148-
# need to open libmpi with RTLD_GLOBAL flag for Linux, before
149-
# any ccall cannot use RTLD_DEEPBIND; this leads to segfaults
150-
# at least on Ubuntu 15.10
151-
hndl = Libdl.dlopen(libmpi, Libdl.RTLD_LAZY | Libdl.RTLD_GLOBAL)
150+
hndl = @static if Sys.isunix()
151+
# Again, work around https://github.com/open-mpi/ompi/issues/10142
152+
withenv("ZES_ENABLE_SYSMAN" => "1") do
153+
# need to open libmpi with RTLD_GLOBAL flag for Linux, before
154+
# any ccall cannot use RTLD_DEEPBIND; this leads to segfaults
155+
# at least on Ubuntu 15.10
156+
Libdl.dlopen(libmpi, Libdl.RTLD_LAZY | Libdl.RTLD_GLOBAL)
157+
end
152158
else
153-
hndl = Libdl.dlopen(libmpi)
159+
Libdl.dlopen(libmpi)
154160
end
155161

156162
try

0 commit comments

Comments
 (0)