cp2k: fix builds on macOS, workaround reported issue with __contains__ (#35584)
Co-authored-by: Robert Cohn <rscohn2@gmail.com> Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
parent
3bb03ea7d1
commit
44705b0a6e
4 changed files with 39 additions and 36 deletions
|
@ -274,31 +274,14 @@ def archive_files(self):
|
||||||
def edit(self, spec, prefix):
|
def edit(self, spec, prefix):
|
||||||
pkgconf = which("pkg-config")
|
pkgconf = which("pkg-config")
|
||||||
|
|
||||||
if "^fftw" in spec:
|
fftw = spec["fftw-api"]
|
||||||
fftw = spec["fftw:openmp" if "+openmp" in spec else "fftw"]
|
|
||||||
fftw_header_dir = fftw.headers.directories[0]
|
fftw_header_dir = fftw.headers.directories[0]
|
||||||
elif "^amdfftw" in spec:
|
|
||||||
fftw = spec["amdfftw:openmp" if "+openmp" in spec else "amdfftw"]
|
# some providers (mainly Intel) keep the fftw headers in a subdirectory, find it
|
||||||
fftw_header_dir = fftw.headers.directories[0]
|
|
||||||
elif "^armpl-gcc" in spec:
|
|
||||||
fftw = spec["armpl-gcc:openmp" if "+openmp" in spec else "armpl-gcc"]
|
|
||||||
fftw_header_dir = fftw.headers.directories[0]
|
|
||||||
elif "^intel-mkl" in spec:
|
|
||||||
fftw = spec["intel-mkl"]
|
|
||||||
fftw_header_dir = fftw.headers.directories[0] + "/fftw"
|
|
||||||
elif "^intel-oneapi-mkl" in spec:
|
|
||||||
fftw = spec["intel-oneapi-mkl"]
|
|
||||||
fftw_header_dir = fftw.headers.directories[0] + "/fftw"
|
|
||||||
elif "^intel-parallel-studio+mkl" in spec:
|
|
||||||
fftw = spec["intel-parallel-studio"]
|
|
||||||
fftw_header_dir = "<NOTFOUND>"
|
|
||||||
for incdir in [join_path(f, "fftw") for f in fftw.headers.directories]:
|
for incdir in [join_path(f, "fftw") for f in fftw.headers.directories]:
|
||||||
if os.path.exists(incdir):
|
if os.path.exists(incdir):
|
||||||
fftw_header_dir = incdir
|
fftw_header_dir = incdir
|
||||||
break
|
break
|
||||||
elif "^cray-fftw" in spec:
|
|
||||||
fftw = spec["cray-fftw"]
|
|
||||||
fftw_header_dir = fftw.headers.directories[0]
|
|
||||||
|
|
||||||
optimization_flags = {
|
optimization_flags = {
|
||||||
"gcc": ["-O2", "-funroll-loops", "-ftree-vectorize"],
|
"gcc": ["-O2", "-funroll-loops", "-ftree-vectorize"],
|
||||||
|
@ -401,11 +384,12 @@ def edit(self, spec, prefix):
|
||||||
ldflags.append((lapack + blas).search_flags)
|
ldflags.append((lapack + blas).search_flags)
|
||||||
libs.extend([str(x) for x in (fftw.libs, lapack, blas)])
|
libs.extend([str(x) for x in (fftw.libs, lapack, blas)])
|
||||||
|
|
||||||
if any(
|
if self.spec.satisfies("platform=darwin"):
|
||||||
p in spec for p in ("^intel-mkl", "^intel-parallel-studio+mkl", "^intel-oneapi-mkl")
|
cppflags.extend(["-D__NO_STATM_ACCESS"])
|
||||||
):
|
|
||||||
|
if spec["blas"].name in ("intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"):
|
||||||
cppflags += ["-D__MKL"]
|
cppflags += ["-D__MKL"]
|
||||||
elif "^accelerate" in spec:
|
elif spec["blas"].name == "accelerate":
|
||||||
cppflags += ["-D__ACCELERATE"]
|
cppflags += ["-D__ACCELERATE"]
|
||||||
|
|
||||||
if "+cosma" in spec:
|
if "+cosma" in spec:
|
||||||
|
@ -418,15 +402,15 @@ def edit(self, spec, prefix):
|
||||||
if "+mpi" in spec:
|
if "+mpi" in spec:
|
||||||
cppflags.extend(["-D__parallel", "-D__SCALAPACK"])
|
cppflags.extend(["-D__parallel", "-D__SCALAPACK"])
|
||||||
|
|
||||||
if "^intel-oneapi-mpi" in spec:
|
if spec["mpi"].name == "intel-oneapi-mpi":
|
||||||
mpi = [join_path(spec["intel-oneapi-mpi"].libs.directories[0], "libmpi.so")]
|
mpi = [join_path(spec["intel-oneapi-mpi"].libs.directories[0], "libmpi.so")]
|
||||||
else:
|
else:
|
||||||
mpi = spec["mpi:cxx"].libs
|
mpi = spec["mpi:cxx"].libs
|
||||||
|
|
||||||
# while intel-mkl has a mpi variant and adds the scalapack
|
# while intel-mkl has a mpi variant and adds the scalapack
|
||||||
# libs to its libs, intel-oneapi-mkl does not.
|
# libs to its libs, intel-oneapi-mkl does not.
|
||||||
if "^intel-oneapi-mkl" in spec:
|
if spec["scalapack"].name == "intel-oneapi-mkl":
|
||||||
mpi_impl = "openmpi" if "^openmpi" in spec else "intelmpi"
|
mpi_impl = "openmpi" if spec["mpi"] == "openmpi" else "intelmpi"
|
||||||
scalapack = [
|
scalapack = [
|
||||||
join_path(
|
join_path(
|
||||||
spec["intel-oneapi-mkl"].libs.directories[0], "libmkl_scalapack_lp64.so"
|
spec["intel-oneapi-mkl"].libs.directories[0], "libmkl_scalapack_lp64.so"
|
||||||
|
@ -662,10 +646,10 @@ def edit(self, spec, prefix):
|
||||||
#
|
#
|
||||||
# and use `-fpp` instead
|
# and use `-fpp` instead
|
||||||
mkf.write("CPP = # {0} -P\n".format(spack_cc))
|
mkf.write("CPP = # {0} -P\n".format(spack_cc))
|
||||||
mkf.write("AR = {0}/xiar -r\n".format(intel_bin_dir))
|
mkf.write("AR = {0}/xiar -qs\n".format(intel_bin_dir))
|
||||||
else:
|
else:
|
||||||
mkf.write("CPP = # {0} -E\n".format(spack_cc))
|
mkf.write("CPP = # {0} -E\n".format(spack_cc))
|
||||||
mkf.write("AR = ar -r\n")
|
mkf.write("AR = ar -qs\n") # r = qs is a GNU extension
|
||||||
|
|
||||||
if "+cuda" in spec:
|
if "+cuda" in spec:
|
||||||
mkf.write(
|
mkf.write(
|
||||||
|
@ -762,7 +746,7 @@ def fix_package_config(self):
|
||||||
content += " " + self.spec["lapack"].libs.ld_flags
|
content += " " + self.spec["lapack"].libs.ld_flags
|
||||||
content += " " + self.spec["fftw-api"].libs.ld_flags
|
content += " " + self.spec["fftw-api"].libs.ld_flags
|
||||||
|
|
||||||
if "^fftw+openmp" in self.spec:
|
if (self.spec["fftw-api"].name == "fftw") and ("+openmp" in self.spec["fftw"]):
|
||||||
content += " -lfftw3_omp"
|
content += " -lfftw3_omp"
|
||||||
|
|
||||||
content += "\n"
|
content += "\n"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
|
from os.path import dirname, isdir
|
||||||
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
|
@ -153,7 +154,10 @@ def _find_mkl_libs(self, shared):
|
||||||
if "+cluster" in self.spec:
|
if "+cluster" in self.spec:
|
||||||
libs.append(self._xlp64_lib("libmkl_blacs_intelmpi"))
|
libs.append(self._xlp64_lib("libmkl_blacs_intelmpi"))
|
||||||
|
|
||||||
return find_libraries(libs, self.component_prefix.lib.intel64, shared=shared)
|
lib_path = self.component_prefix.lib.intel64
|
||||||
|
lib_path = lib_path if isdir(lib_path) else dirname(lib_path)
|
||||||
|
|
||||||
|
return find_libraries(libs, lib_path, shared=shared)
|
||||||
|
|
||||||
def _xlp64_lib(self, lib):
|
def _xlp64_lib(self, lib):
|
||||||
return lib + ("_ilp64" if "+ilp64" in self.spec else "_lp64")
|
return lib + ("_ilp64" if "+ilp64" in self.spec else "_lp64")
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index 85ea82a..86222e0 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -232,7 +232,7 @@ append_subdir_files(src-C "SRC")
|
||||||
|
|
||||||
|
if (UNIX)
|
||||||
|
add_library(scalapack ${blacs} ${tools} ${tools-C} ${extra_lapack} ${pblas} ${pblas-F} ${ptzblas} ${ptools} ${pbblas} ${redist} ${src} ${src-C})
|
||||||
|
- target_link_libraries( scalapack ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
|
||||||
|
+ target_link_libraries( scalapack ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${MPI_Fortran_LIBRARIES})
|
||||||
|
scalapack_install_library(scalapack)
|
||||||
|
else (UNIX) # Need to separate Fortran and C Code
|
||||||
|
OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON )
|
|
@ -44,6 +44,8 @@ class ScalapackBase(CMakePackage):
|
||||||
sha256="072b006e485f0ca4cba56096912a986e4d3da73aae51c2205928aa5eb842cefd",
|
sha256="072b006e485f0ca4cba56096912a986e4d3da73aae51c2205928aa5eb842cefd",
|
||||||
when="@2.2.0",
|
when="@2.2.0",
|
||||||
)
|
)
|
||||||
|
# From Homebrew, integrated @upstream in different form over multiple commits
|
||||||
|
patch("fix-build-macos.patch", when="@2.2.0")
|
||||||
|
|
||||||
def flag_handler(self, name, flags):
|
def flag_handler(self, name, flags):
|
||||||
iflags = []
|
iflags = []
|
||||||
|
|
Loading…
Reference in a new issue