summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorAMD Toolchain Support <73240730+amd-toolchain-support@users.noreply.github.com>2023-06-23 01:38:21 +0530
committerGitHub <noreply@github.com>2023-06-22 16:08:21 -0400
commit77817a0f056337baccf5aed2b95d55342a31e832 (patch)
tree9b8294181406b61e8d6fa0d232351af86f995c1d /var
parent590d3ba6cfd0e005fb12c61e1a1e58e469704571 (diff)
downloadspack-77817a0f056337baccf5aed2b95d55342a31e832.tar.gz
spack-77817a0f056337baccf5aed2b95d55342a31e832.tar.bz2
spack-77817a0f056337baccf5aed2b95d55342a31e832.tar.xz
spack-77817a0f056337baccf5aed2b95d55342a31e832.zip
VASP package: Zen4 Support (#36800)
* zen4 support for vasp * encourage openmp support in fftw/blas when +openmp * enable gamma and non-collinear builds
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/vasp/package.py108
1 files changed, 89 insertions, 19 deletions
diff --git a/var/spack/repos/builtin/packages/vasp/package.py b/var/spack/repos/builtin/packages/vasp/package.py
index aa70138c80..0a8f5393a7 100644
--- a/var/spack/repos/builtin/packages/vasp/package.py
+++ b/var/spack/repos/builtin/packages/vasp/package.py
@@ -21,6 +21,7 @@ class Vasp(MakefilePackage):
manual_download = True
version("6.3.2", sha256="f7595221b0f9236a324ea8afe170637a578cdd5a837cc7679e7f7812f6edf25a")
+ version("6.3.0", sha256="adcf83bdfd98061016baae31616b54329563aa2739573f069dd9df19c2071ad3")
version("6.2.0", sha256="49e7ba351bd634bc5f5f67a8ef1e38e64e772857a1c02f602828898a84197e25")
version("6.1.1", sha256="e37a4dfad09d3ad0410833bcd55af6b599179a085299026992c2d8e319bf6927")
version("5.4.4.pl2", sha256="98f75fd75399a23d76d060a6155f4416b340a1704f256a00146f89024035bc8e")
@@ -34,10 +35,21 @@ class Vasp(MakefilePackage):
)
variant("openmp", default=False, description="Enable openmp build")
+ with when("+openmp"):
+ conflicts("^fftw~openmp")
+ conflicts("^amdfftw~openmp")
+ conflicts("^amdblis threads=none")
+ conflicts("^amdblis threads=pthreads")
+ conflicts("^openblas threads=none")
+ conflicts("^openblas threads=pthreads")
variant("scalapack", default=False, description="Enables build with SCALAPACK")
variant("cuda", default=False, description="Enables running on Nvidia GPUs")
+ variant("fftlib", default=False, description="Enables fftlib build")
+ with when("+fftlib"):
+ conflicts("@:6.1.1", msg="fftlib support started from 6.2.0")
+ conflicts("~openmp", msg="fftlib is intended to be used with openmp")
variant(
"vaspsol",
@@ -45,7 +57,6 @@ class Vasp(MakefilePackage):
description="Enable VASPsol implicit solvation model\n"
"https://github.com/henniggroup/VASPsol",
)
-
variant("shmem", default=True, description="Enable use_shmem build flag")
depends_on("rsync", type="build")
@@ -83,28 +94,61 @@ class Vasp(MakefilePackage):
filter_file("/opt/pgi/qd-2.3.17/install/lib", spec["qd"].prefix.lib, make_include)
elif "%aocc" in spec:
if "+openmp" in spec:
- copy(
- join_path("arch", "makefile.include.linux_gnu_omp"),
- join_path("arch", "makefile.include.linux_aocc_omp"),
- )
- make_include = join_path("arch", "makefile.include.linux_aocc_omp")
+ if "@6.3.0" in spec:
+ copy(
+ join_path("arch", "makefile.include.gnu_ompi_aocl_omp"),
+ join_path("arch", "makefile.include.linux_aocc_omp"),
+ )
+ make_include = join_path("arch", "makefile.include.linux_aocc_omp")
+
+ elif "@6.3.2:" in spec:
+ make_include = join_path("arch", "makefile.include.aocc_ompi_aocl_omp")
+ else:
+ copy(
+ join_path("arch", "makefile.include.linux_gnu_omp"),
+ join_path("arch", "makefile.include.linux_aocc_omp"),
+ )
+ make_include = join_path("arch", "makefile.include.linux_aocc_omp")
else:
- copy(
- join_path("arch", "makefile.include.linux_gnu"),
- join_path("arch", "makefile.include.linux_aocc"),
- )
- make_include = join_path("arch", "makefile.include.linux_aocc")
- filter_file("gcc", "{0} {1}".format(spack_cc, "-Mfree"), make_include, string=True)
- filter_file("g++", spack_cxx, make_include, string=True)
+ if "@6.3.0:" in spec:
+ copy(
+ join_path("arch", "makefile.include.gnu_ompi_aocl"),
+ join_path("arch", "makefile.include.linux_aocc"),
+ )
+ make_include = join_path("arch", "makefile.include.linux_aocc")
+ if "@6.3.2:" in spec:
+ make_include = join_path("arch", "makefile.include.aocc_ompi_aocl")
+ else:
+ copy(
+ join_path("arch", "makefile.include.linux_gnu"),
+ join_path("arch", "makefile.include.linux_aocc"),
+ )
+ make_include = join_path("arch", "makefile.include.linux_aocc_omp")
+ filter_file("^CC_LIB[ ]{0,}=.*$", "CC_LIB={0}".format(spack_cc), make_include)
+ if "@6.3.0:" in spec:
+ filter_file("gcc", "{0} {1}".format(spack_fc, "-Mfree"), make_include, string=True)
+ else:
+ filter_file("gcc", "{0}".format(spack_fc), make_include, string=True)
+ filter_file("g++", spack_cxx, make_include, string=True)
+
filter_file("^CFLAGS_LIB[ ]{0,}=.*$", "CFLAGS_LIB = -O3", make_include)
- filter_file("^FFLAGS_LIB[ ]{0,}=.*$", "FFLAGS_LIB = -O2", make_include)
+ filter_file("^FFLAGS_LIB[ ]{0,}=.*$", "FFLAGS_LIB = -O3", make_include)
filter_file("^OFLAG[ ]{0,}=.*$", "OFLAG = -O3", make_include)
filter_file(
"^FC[ ]{0,}=.*$", "FC = {0}".format(spec["mpi"].mpifc), make_include, string=True
)
filter_file(
- "^FCL[ ]{0,}=.*$", "FCL = {0}".format(spec["mpi"].mpifc), make_include, string=True
+ "^FCL[ ]{0,}=.*$",
+ '"FCL = {0}".format(spec["mpi"].mpifc)',
+ make_include,
+ string=True,
+ )
+ filter_file(
+ "-fallow-argument-mismatch", " -fno-fortran-main", make_include, string=True
)
+
+ filter_file("^OBJECTS_LIB[ ]{0,}=.*$", "OBJECTS_LIB ?=", make_include)
+ filter_file("-march=native", " ", make_include)
else:
if "+openmp" in spec:
make_include = join_path(
@@ -130,7 +174,7 @@ class Vasp(MakefilePackage):
filter_file("^FFTW[ ]{0,}?=.*$", "FFTW ?=", "makefile.include")
filter_file("^MPI_INC[ ]{0,}=.*$", "MPI_INC ?=", "makefile.include")
filter_file("-DscaLAPACK.*$\n", "", "makefile.include")
- filter_file("^SCALAPACK[ ]{0,}=.*$", "SCALAPACK ?=", "makefile.include")
+ filter_file("^SCALAPACK[ ]{0,} =.*$", "SCALAPACK ?=", "makefile.include")
if "+cuda" in spec:
filter_file("^OBJECTS_GPU[ ]{0,}=.*$", "OBJECTS_GPU ?=", "makefile.include")
@@ -139,6 +183,14 @@ class Vasp(MakefilePackage):
filter_file("^CFLAGS[ ]{0,}=.*$", "CFLAGS ?=", "makefile.include")
+ if "+fftlib" in spec:
+ filter_file("^#FCL[ ]{0,}=fftlib.o", "FCL += fftlib/fftlib.o", "makefile.include")
+ filter_file("^#CXX_FFTLIB", "CXX_FFTLIB", "makefile.include")
+ filter_file("^#INCS_FFTLIB", "INCS_FFTLIB", "makefile.include")
+ filter_file("^#LIBS", "LIBS", "makefile.include")
+ filter_file(
+ "LIBS[ ]{0,}=.*$", "LIBS=-lstdc++ fftlib/fftlib.o -ldl", "makefile.include"
+ )
if "+vaspsol" in spec:
copy("VASPsol/src/solvation.F", "src/")
@@ -160,9 +212,20 @@ class Vasp(MakefilePackage):
if "%nvhpc" in self.spec:
cpp_options.extend(['-DHOST=\\"LinuxPGI\\"', "-DPGI16", "-Dqd_emulate"])
elif "%aocc" in self.spec:
- cpp_options.extend(['-DHOST=\\"LinuxGNU\\"', "-Dfock_dblbuf"])
+ cpp_options.extend(
+ [
+ '-DHOST=\\"LinuxAMD\\"',
+ "-Dfock_dblbuf",
+ "-Dsysv",
+ "-Dshmem_bcast_buffer",
+ "-DNGZhalf",
+ ]
+ )
+ if "@6.3.0:" and "^amdfftw@4.0:" in self.spec:
+ cpp_options.extend(["-Dfftw_cache_plans", "-Duse_fftw_plan_effort"])
if "+openmp" in self.spec:
cpp_options.extend(["-D_OPENMP"])
+ cpp_options.extend(["-Mfree "])
else:
cpp_options.append('-DHOST=\\"LinuxGNU\\"')
@@ -176,11 +239,16 @@ class Vasp(MakefilePackage):
elif "%nvhpc" in spec:
fflags.extend(["-Mnoupcase", "-Mbackslash", "-Mlarge_arrays"])
elif "%aocc" in spec:
- fflags.extend(["-fno-fortran-main", "-Mbackslash", "-ffast-math"])
+ fflags.extend(["-fno-fortran-main", "-Mbackslash"])
+ objects_lib = ["linpack_double.o", "getshmem.o"]
+ spack_env.set("OBJECTS_LIB", " ".join(objects_lib))
spack_env.set("BLAS", spec["blas"].libs.ld_flags)
spack_env.set("LAPACK", spec["lapack"].libs.ld_flags)
- spack_env.set("FFTW", spec["fftw-api"].prefix)
+ if "^amdfftw" in spec:
+ spack_env.set("AMDFFTW_ROOT", spec["fftw-api"].prefix)
+ else:
+ spack_env.set("FFTW", spec["fftw-api"].libs.ld_flags)
spack_env.set("MPI_INC", spec["mpi"].prefix.include)
if "%nvhpc" in spec:
@@ -217,6 +285,8 @@ class Vasp(MakefilePackage):
if spec.satisfies("%gcc@10:"):
fflags.append("-fallow-argument-mismatch")
+ if spec.satisfies("%aocc"):
+ fflags.append("-fno-fortran-main -Mbackslash -ffunc-args-alias")
# Finally
spack_env.set("CPP_OPTIONS", " ".join(cpp_options))