openblas: fix AttributeError when threads=openmp (#45338)

This commit is contained in:
Wouter Deconinck 2024-08-02 13:19:06 -05:00 committed by GitHub
parent 8538b0c01d
commit a2cbc46dbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -570,17 +570,19 @@ def check_install(self):
# Openblas may pass its own test but still fail to compile Lapack
# symbols. To make sure we get working Blas and Lapack, do a small
# test.
source_file = join_path(os.path.dirname(self.module.__file__), "test_cblas_dgemm.c")
blessed_file = join_path(os.path.dirname(self.module.__file__), "test_cblas_dgemm.output")
source_file = join_path(os.path.dirname(self.pkg.module.__file__), "test_cblas_dgemm.c")
blessed_file = join_path(
os.path.dirname(self.pkg.module.__file__), "test_cblas_dgemm.output"
)
include_flags = spec["openblas"].headers.cpp_flags
link_flags = spec["openblas"].libs.ld_flags
if self.compiler.name == "intel":
if self.pkg.compiler.name == "intel":
link_flags += " -lifcore"
if self.spec.satisfies("threads=pthreads"):
link_flags += " -lpthread"
if spec.satisfies("threads=openmp"):
link_flags += " -lpthread " + self.compiler.openmp_flag
link_flags += " -lpthread " + self.pkg.compiler.openmp_flag
output = compile_c_and_execute(source_file, [include_flags], link_flags.split())
compare_output_file(output, blessed_file)