Skip to content

Commit

Permalink
Use __init__ of openblas for setting openblas env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ViralBShah committed Oct 8, 2021
1 parent f70e66c commit 56fae48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 0 additions & 5 deletions stdlib/LinearAlgebra/src/LinearAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -572,11 +572,6 @@ function find_library_path(name)
end

function __init__()
# try to ensuremake sure OpenBLAS does not set CPU affinity (#1070, #9639)
if !haskey(ENV, "OPENBLAS_MAIN_FREE")
ENV["OPENBLAS_MAIN_FREE"] = "1"
end

try
libblas_path = find_library_path(Base.libblas_name)
liblapack_path = find_library_path(Base.liblapack_name)
Expand Down
5 changes: 5 additions & 0 deletions stdlib/OpenBLAS_jll/src/OpenBLAS_jll.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ else
end

function __init__()
# make sure OpenBLAS does not set CPU affinity (#1070, #9639)
if !haskey(ENV, "OPENBLAS_MAIN_FREE")
ENV["OPENBLAS_MAIN_FREE"] = "1"
end

global libopenblas_handle = dlopen(libopenblas)
global libopenblas_path = dlpath(libopenblas_handle)
global artifact_dir = dirname(Sys.BINDIR)
Expand Down

0 comments on commit 56fae48

Please sign in to comment.