Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 30dc0817 authored by hhakim's avatar hhakim
Browse files

Embed/load also libgfortran for OpenBLAS-OpenMP because the version can differ...

Embed/load also libgfortran for OpenBLAS-OpenMP because the version can differ from a system to another.
parent 39401037
Branches
Tags 3.13.0rc2
No related merge requests found
Pipeline #834019 skipped
...@@ -27,5 +27,22 @@ foreach(LIB IN LISTS LIBS) ...@@ -27,5 +27,22 @@ foreach(LIB IN LISTS LIBS)
# copy the libopenblaso in pyfaust/lib # copy the libopenblaso in pyfaust/lib
message("copying libopenblaso to wrapper/python/pyfaust/lib/${LIB_FILE2}") message("copying libopenblaso to wrapper/python/pyfaust/lib/${LIB_FILE2}")
configure_file(${LIB} pyfaust/lib/${LIB_FILE2} COPYONLY) configure_file(${LIB} pyfaust/lib/${LIB_FILE2} COPYONLY)
set(LIB_OPENBLASO ${LIB})
endif() endif()
endforeach() endforeach()
# libopenblaso also needs libgfortran
file(GET_RUNTIME_DEPENDENCIES LIBRARIES ${LIB_OPENBLASO} RESOLVED_DEPENDENCIES_VAR LIBS UNRESOLVED_DEPENDENCIES_VAR ERR_LIBS DIRECTORIES ${LIB_PATHS})
foreach(LIB IN LISTS LIBS)
string(REGEX MATCH ".*gfortran*" RES ${LIB})
string(LENGTH "${RES}" RES_LEN)
get_filename_component(LIB_FILE ${LIB} NAME)
# remove digit suffix in library name (to ease loading with an easier to determine library filename)
string(REGEX REPLACE "\\.[0-9]+.*$" "" LIB_FILE2 ${LIB_FILE})
if(${RES_LEN} GREATER 0)
message(STATUS "system libgfortran: ${LIB}")
# copy the libopenblaso in pyfaust/lib
message("copying libgfortran to wrapper/python/pyfaust/lib/${LIB_FILE2}")
configure_file(${LIB} pyfaust/lib/${LIB_FILE2} COPYONLY)
endif()
endforeach()
...@@ -5,6 +5,7 @@ blasomp_loading_verbose = True ...@@ -5,6 +5,7 @@ blasomp_loading_verbose = True
internal_blasomp_loading = True internal_blasomp_loading = True
blasomp_name_noext = 'libopenblaso' blasomp_name_noext = 'libopenblaso'
gfortran_name_noext = 'libgfortran'
def load_lib_blaso(): def load_lib_blaso():
...@@ -23,8 +24,9 @@ def load_lib_blaso(): ...@@ -23,8 +24,9 @@ def load_lib_blaso():
ext = 'dll' ext = 'dll'
for p in sys.path: for p in sys.path:
lib_path = join(p, 'pyfaust/lib/'+blasomp_name_noext+'.'+ext) lib_path = join(p, 'pyfaust/lib/'+blasomp_name_noext+'.'+ext)
lib_path = glob(lib_path+"*")[0] gfortran_lib_path = join(p, 'pyfaust/lib/'+gfortran_name_noext+'.'+ext)
if exists(lib_path): if exists(lib_path):
ctypes.CDLL(gfortran_lib_path) # gfortran is loaded first because openblaso depends on it
ctypes.CDLL(lib_path) ctypes.CDLL(lib_path)
if blasomp_loading_verbose: if blasomp_loading_verbose:
print(lib_path+" has been loaded successfully.") print(lib_path+" has been loaded successfully.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment