diff options
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/magma/package.py | 60 |
1 files changed, 26 insertions, 34 deletions
diff --git a/var/spack/repos/builtin/packages/magma/package.py b/var/spack/repos/builtin/packages/magma/package.py index 0364e089e0..0799cdb8ea 100644 --- a/var/spack/repos/builtin/packages/magma/package.py +++ b/var/spack/repos/builtin/packages/magma/package.py @@ -103,55 +103,47 @@ class Magma(CMakePackage, CudaPackage, ROCmPackage): 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 |