@@ -2718,6 +2718,7 @@ def check_required_file(paths, required_regexs):
2718
2718
found = True
2719
2719
break
2720
2720
if not found :
2721
+ _logger .debug ("Required file '%s' not found" , req )
2721
2722
raise RuntimeError (f"Required file { req } not found" )
2722
2723
return libs
2723
2724
@@ -2779,9 +2780,15 @@ def check_libs(
2779
2780
res = try_blas_flag (flags )
2780
2781
if res :
2781
2782
if any ("mkl" in flag for flag in flags ):
2782
- check_mkl_openmp ()
2783
+ try :
2784
+ check_mkl_openmp ()
2785
+ except Exception as e :
2786
+ _logger .debug (e )
2787
+ _logger .debug ("The following blas flags will be used: '%s'" , res )
2783
2788
return res
2784
2789
else :
2790
+ _logger .debug (f"Supplied flags { res } failed to compile" )
2791
+ _logger .debug ("Supplied flags '%s' failed to compile" , res )
2785
2792
raise RuntimeError (f"Supplied flags { flags } failed to compile" )
2786
2793
2787
2794
# If no compiler is available we default to empty ldflags
@@ -2802,6 +2809,11 @@ def check_libs(
2802
2809
# directory. We will include both in our searched library dirs
2803
2810
searched_library_dirs .append (os .path .join (sys .prefix , "Library" , "bin" ))
2804
2811
searched_library_dirs .append (os .path .join (sys .prefix , "Library" , "lib" ))
2812
+ search_dirs = "\n " .join (searched_library_dirs )
2813
+ _logger .debug (
2814
+ "Will search for BLAS libraries in the following directories:\n %s" ,
2815
+ search_dirs ,
2816
+ )
2805
2817
all_libs = [
2806
2818
l
2807
2819
for path in [
@@ -2817,6 +2829,7 @@ def check_libs(
2817
2829
maybe_add_to_os_environ_pathlist ("PATH" , rpath )
2818
2830
try :
2819
2831
# 1. Try to use MKL with INTEL OpenMP threading
2832
+ _logger .debug ("Checking MKL flags with intel threading" )
2820
2833
return check_libs (
2821
2834
all_libs ,
2822
2835
required_libs = [
@@ -2829,40 +2842,44 @@ def check_libs(
2829
2842
extra_compile_flags = [f"-Wl,-rpath,{ rpath } " ] if rpath is not None else [],
2830
2843
cxx_library_dirs = cxx_library_dirs ,
2831
2844
)
2832
- except Exception :
2833
- pass
2845
+ except Exception as e :
2846
+ _logger . debug ( e )
2834
2847
try :
2835
2848
# 2. Try to use MKL with GNU OpenMP threading
2849
+ _logger .debug ("Checking MKL flags with GNU OpenMP threading" )
2836
2850
return check_libs (
2837
2851
all_libs ,
2838
2852
required_libs = ["mkl_core" , "mkl_rt" , "mkl_gnu_thread" , "gomp" , "pthread" ],
2839
2853
extra_compile_flags = [f"-Wl,-rpath,{ rpath } " ] if rpath is not None else [],
2840
2854
cxx_library_dirs = cxx_library_dirs ,
2841
2855
)
2842
- except Exception :
2843
- pass
2856
+ except Exception as e :
2857
+ _logger . debug ( e )
2844
2858
try :
2859
+ _logger .debug ("Checking Lapack + blas" )
2845
2860
# 3. Try to use LAPACK + BLAS
2846
2861
return check_libs (
2847
2862
all_libs ,
2848
2863
required_libs = ["lapack" , "blas" , "cblas" , "m" ],
2849
2864
extra_compile_flags = [f"-Wl,-rpath,{ rpath } " ] if rpath is not None else [],
2850
2865
cxx_library_dirs = cxx_library_dirs ,
2851
2866
)
2852
- except Exception :
2853
- pass
2867
+ except Exception as e :
2868
+ _logger . debug ( e )
2854
2869
try :
2855
2870
# 4. Try to use BLAS alone
2871
+ _logger .debug ("Checking blas alone" )
2856
2872
return check_libs (
2857
2873
all_libs ,
2858
2874
required_libs = ["blas" , "cblas" ],
2859
2875
extra_compile_flags = [f"-Wl,-rpath,{ rpath } " ] if rpath is not None else [],
2860
2876
cxx_library_dirs = cxx_library_dirs ,
2861
2877
)
2862
- except Exception :
2863
- pass
2878
+ except Exception as e :
2879
+ _logger . debug ( e )
2864
2880
try :
2865
2881
# 5. Try to use openblas
2882
+ _logger .debug ("Checking openblas" )
2866
2883
return check_libs (
2867
2884
all_libs ,
2868
2885
required_libs = ["openblas" , "gfortran" , "gomp" , "m" ],
@@ -2871,8 +2888,9 @@ def check_libs(
2871
2888
else ["-fopenmp" ],
2872
2889
cxx_library_dirs = cxx_library_dirs ,
2873
2890
)
2874
- except Exception :
2875
- pass
2891
+ except Exception as e :
2892
+ _logger .debug (e )
2893
+ _logger .debug ("Failed to identify blas ldflags. Will leave them empty." )
2876
2894
return ""
2877
2895
2878
2896
0 commit comments