33# # dummy stub for https://github.com/JuliaBinaryWrappers/OpenBLAS_jll.jl
44baremodule OpenBLAS_jll
55using Base, Libdl, Base. BinaryPlatforms
6-
7- # We are explicitly NOT loading this at runtime, as it contains `libgomp`
8- # which conflicts with `libiomp5`, breaking things like MKL. In the future,
9- # we hope to transition to a JLL interface that provides a more granular
10- # interface than eagerly dlopen'ing all libraries provided in the JLL
11- # which will eliminate issues like this, where we avoid loading a JLL
12- # because we don't want to load a library that we don't even use yet.
13- # using CompilerSupportLibraries_jll
14- # Because of this however, we have to manually load the libraries we
15- # _do_ care about, namely libgfortran
16- Base. Experimental. @compiler_options compile= min optimize= 0 infer= false
17-
18- const PATH_list = String[]
19- const LIBPATH_list = String[]
20-
216export libopenblas
227
23- # These get calculated in __init__()
24- const PATH = Ref (" " )
25- const LIBPATH = Ref (" " )
26- artifact_dir:: String = " "
27- libopenblas_handle:: Ptr{Cvoid} = C_NULL
28- libopenblas_path:: String = " "
29-
308if Base. USE_BLAS64
319 const libsuffix = " 64_"
3210else
3311 const libsuffix = " "
3412end
3513
3614if Sys. iswindows ()
37- const libopenblas = " libopenblas$(libsuffix) .dll"
38- const _libgfortran = string (" libgfortran-" , libgfortran_version (HostPlatform ()). major, " .dll" )
15+ const libopenblas_name = " bin/ libopenblas$(libsuffix) .dll"
16+ const libgfortran_name = string (" libgfortran-" , libgfortran_version (HostPlatform ()). major, " .dll" )
3917elseif Sys. isapple ()
40- const libopenblas = " @rpath /libopenblas$(libsuffix) .dylib"
41- const _libgfortran = string (" @rpath/ " , " libgfortran." , libgfortran_version (HostPlatform ()). major, " .dylib" )
18+ const libopenblas_name = " lib /libopenblas$(libsuffix) .dylib"
19+ const libgfortran_name = string (" lib/ libgfortran." , libgfortran_version (HostPlatform ()). major, " .dylib" )
4220else
43- const libopenblas = " libopenblas$(libsuffix) .so"
44- const _libgfortran = string (" libgfortran.so." , libgfortran_version (HostPlatform ()). major)
21+ const libopenblas_name = " lib/ libopenblas$(libsuffix) .so"
22+ const libgfortran_name = string (" lib/ libgfortran.so." , libgfortran_version (HostPlatform ()). major)
4523end
4624
25+ const libgfortran_path = BundledLazyLibraryPath (libgfortran_name)
26+ const libgfortran = LazyLibrary (libgfortran_path)
27+
28+ const libopenblas_path = BundledLazyLibraryPath (libopenblas_name)
29+ const libopenblas = LazyLibrary (libopenblas_path; dependencies= [libgfortran])
30+
4731function __init__ ()
4832 # make sure OpenBLAS does not set CPU affinity (#1070, #9639)
4933 if ! haskey (ENV , " OPENBLAS_MAIN_FREE" )
@@ -62,25 +46,6 @@ function __init__()
6246 # to the true value in its `__init__()` function.
6347 ENV [" OPENBLAS_DEFAULT_NUM_THREADS" ] = " 1"
6448 end
65-
66- # As mentioned above, we are sneaking this in here so that we don't have to
67- # depend on CSL_jll and load _all_ of its libraries.
68- dlopen (_libgfortran)
69-
70- global libopenblas_handle = dlopen (libopenblas)
71- global libopenblas_path = dlpath (libopenblas_handle)
72- global artifact_dir = dirname (Sys. BINDIR)
73- LIBPATH[] = dirname (libopenblas_path)
74- push! (LIBPATH_list, LIBPATH[])
7549end
7650
77- # JLLWrappers API compatibility shims. Note that not all of these will really make sense.
78- # For instance, `find_artifact_dir()` won't actually be the artifact directory, because
79- # there isn't one. It instead returns the overall Julia prefix.
80- is_available () = true
81- find_artifact_dir () = artifact_dir
82- dev_jll () = error (" stdlib JLLs cannot be dev'ed" )
83- best_wrapper = nothing
84- get_libopenblas_path () = libopenblas_path
85-
8651end # module OpenBLAS_jll
0 commit comments