Package magma: cleaned up cmake config (#33766)

This commit is contained in:
G-Ragghianti 2022-12-07 10:30:20 -05:00 committed by GitHub
parent 7950311767
commit 7f4d71252b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,55 +103,47 @@ def generate_gpu_config(self):
def cmake_args(self):
spec = self.spec
options = []
options.extend(
[
"-DCMAKE_INSTALL_PREFIX=%s" % self.prefix,
"-DCMAKE_INSTALL_NAME_DIR:PATH=%s/lib" % self.prefix,
"-DBLAS_LIBRARIES=%s" % spec["blas"].libs.joined(";"),
# As of MAGMA v2.3.0, CMakeLists.txt does not use the variable
# BLAS_LIBRARIES, but only LAPACK_LIBRARIES, so we need to
# explicitly add blas to LAPACK_LIBRARIES.
"-DLAPACK_LIBRARIES=%s" % (spec["lapack"].libs + spec["blas"].libs).joined(";"),
]
)
options += ["-DBUILD_SHARED_LIBS=%s" % ("ON" if ("+shared" in spec) else "OFF")]
define = self.define
options = [
define("CMAKE_INSTALL_PREFIX", self.prefix),
define("CMAKE_INSTALL_NAME_DIR", self.prefix.lib),
define("BLAS_LIBRARIES", spec["blas"].libs),
# As of MAGMA v2.3.0, CMakeLists.txt does not use the variable
# BLAS_LIBRARIES, but only LAPACK_LIBRARIES, so we need to
# explicitly add blas to LAPACK_LIBRARIES.
define("LAPACK_LIBRARIES", spec["lapack"].libs + spec["blas"].libs),
self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
]
if spec.satisfies("%cce"):
options += ["-DCUDA_NVCC_FLAGS=-allow-unsupported-compiler"]
options.append(define("CUDA_NVCC_FLAGS", "-allow-unsupported-compiler"))
if "+fortran" in spec:
options.extend(["-DUSE_FORTRAN=yes"])
options.append(define("USE_FORTRAN", True))
if spec.satisfies("%xl") or spec.satisfies("%xl_r"):
options.extend(["-DCMAKE_Fortran_COMPILER=%s" % self.compiler.f77])
options.append(define("CMAKE_Fortran_COMPILER", self.compiler.f77))
if spec.satisfies("%cce"):
options.append("-DCMAKE_Fortran_FLAGS=-ef")
options.append(define("CMAKE_Fortran_FLAGS", "-ef"))
if spec.satisfies("^cuda"):
cuda_arch = self.spec.variants["cuda_arch"].value
if "@:2.2.0" in spec:
capabilities = " ".join("sm{0}".format(i) for i in cuda_arch)
options.extend(["-DGPU_TARGET=" + capabilities])
else:
capabilities = " ".join("sm_{0}".format(i) for i in cuda_arch)
options.extend(["-DGPU_TARGET=" + capabilities])
if "+cuda" in spec:
cuda_arch = spec.variants["cuda_arch"].value
sep = "" if "@:2.2.0" in spec else "_"
capabilities = " ".join("sm{0}{1}".format(sep, i) for i in cuda_arch)
options.append(define("GPU_TARGET", capabilities))
if "@2.5.0" in spec:
options.extend(["-DMAGMA_SPARSE=OFF"])
options.append(define("MAGMA_SPARSE", False))
if spec.compiler.name in ["xl", "xl_r"]:
options.extend(["-DCMAKE_DISABLE_FIND_PACKAGE_OpenMP=TRUE"])
options.append(define("CMAKE_DISABLE_FIND_PACKAGE_OpenMP", True))
if "+rocm" in spec:
options.extend(["-DMAGMA_ENABLE_HIP=ON"])
options.extend(["-DCMAKE_CXX_COMPILER=hipcc"])
options.append(define("MAGMA_ENABLE_HIP", True))
options.append(define("CMAKE_CXX_COMPILER", spec["hip"].hipcc))
# See https://github.com/ROCmSoftwarePlatform/rocFFT/issues/322
if spec.satisfies("^cmake@3.21.0:3.21.2"):
options.extend(["-D__skip_rocmclang=ON"])
options.append(define("__skip_rocmclang", True))
else:
options.extend(["-DMAGMA_ENABLE_CUDA=ON"])
options.append(define("MAGMA_ENABLE_CUDA", True))
return options