Skip to content

Commit

Permalink
set environment variables before dlopen
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed Jul 2, 2024
1 parent 8def840 commit cf1324b
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/MPI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,22 @@ function __init__()
""" ENV["JULIA_MPI_BINARY"]=mpi_env_binary MPIPreferences.binary
end

# Set environment variables before dlopen.

# disable UCX memory cache, since it doesn't work correctly
# https://github.com/openucx/ucx/issues/5061
if !haskey(ENV, "UCX_MEMTYPE_CACHE")
ENV["UCX_MEMTYPE_CACHE"] = "no"
end

# Julia multithreading uses SIGSEGV to sync threads
# https://docs.julialang.org/en/v1/devdocs/debuggingtips/#Dealing-with-signals-1
# By default, UCX will error if this occurs (issue #337)
if !haskey(ENV, "UCX_ERROR_SIGNALS")
# default is "SIGILL,SIGSEGV,SIGBUS,SIGFPE"
ENV["UCX_ERROR_SIGNALS"] = "SIGILL,SIGBUS,SIGFPE"
end

# preload any dependencies of libmpi (if needed, eg. GTL on cray) before
# dlopen'ing the MPI library: https://github.com/JuliaParallel/MPI.jl/pull/716
MPIPreferences.dlopen_preloads()
Expand All @@ -133,20 +149,6 @@ function __init__()
# calls don't trigger early `dlopen`-ing of the library.
Base.invokelatest(API.init_consts)

# disable UCX memory cache, since it doesn't work correctly
# https://github.com/openucx/ucx/issues/5061
if !haskey(ENV, "UCX_MEMTYPE_CACHE")
ENV["UCX_MEMTYPE_CACHE"] = "no"
end

# Julia multithreading uses SIGSEGV to sync threads
# https://docs.julialang.org/en/v1/devdocs/debuggingtips/#Dealing-with-signals-1
# By default, UCX will error if this occurs (issue #337)
if !haskey(ENV, "UCX_ERROR_SIGNALS")
# default is "SIGILL,SIGSEGV,SIGBUS,SIGFPE"
ENV["UCX_ERROR_SIGNALS"] = "SIGILL,SIGBUS,SIGFPE"
end

if MPIPreferences.binary == "MPItrampoline_jll" && !haskey(ENV, "MPITRAMPOLINE_MPIEXEC")
ENV["MPITRAMPOLINE_MPIEXEC"] = API.MPItrampoline_jll.mpich_mpiexec_path
end
Expand Down

0 comments on commit cf1324b

Please sign in to comment.