summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorAMD Toolchain Support <73240730+amd-toolchain-support@users.noreply.github.com>2023-12-28 16:03:32 +0530
committerGitHub <noreply@github.com>2023-12-28 11:33:32 +0100
commitade544b4cc8f5e3cb1873d8a5ccb94ddcc47b265 (patch)
tree388f5977026e67bbf079a71503ed574ba876c8d8 /var
parent94d81600d912e3861052f85c9bda08b81ce09e84 (diff)
downloadspack-ade544b4cc8f5e3cb1873d8a5ccb94ddcc47b265.tar.gz
spack-ade544b4cc8f5e3cb1873d8a5ccb94ddcc47b265.tar.bz2
spack-ade544b4cc8f5e3cb1873d8a5ccb94ddcc47b265.tar.xz
spack-ade544b4cc8f5e3cb1873d8a5ccb94ddcc47b265.zip
WRF: add support for %aocc@4: (#41559)
Co-authored-by: AMD Toolchain Support <toolchainsuppor@amd.com> Co-authored-by: Phil Tooley <phil.tooley@amd.com>
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/wrf/aocc_config.inc58
-rw-r--r--var/spack/repos/builtin/packages/wrf/package.py25
2 files changed, 81 insertions, 2 deletions
diff --git a/var/spack/repos/builtin/packages/wrf/aocc_config.inc b/var/spack/repos/builtin/packages/wrf/aocc_config.inc
new file mode 100644
index 0000000000..8c80196689
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/aocc_config.inc
@@ -0,0 +1,58 @@
+###########################################################
+#ARCH AMD Linux x86_64 #serial smpar dmpar dm+sm
+# For optimized AMDFCFLAGS and AMDLDFLAGS, please reach out to toolchainsupport@amd.com
+#
+
+DESCRIPTION = AMD ($SFC/$SCC) : AMD ZEN Architectures
+DMPARALLEL = # 1
+OMPCPP = # -D_OPENMP
+OMP = # -fopenmp
+OMPCC = # -fopenmp
+SFC = flang
+SCC = clang
+CCOMP = clang
+DM_FC = {MPIFC}
+DM_CC = {MPICC}
+FC = CONFIGURE_FC
+CC = CONFIGURE_CC
+LD = $(FC)
+RWORDSIZE = CONFIGURE_RWORDSIZE
+
+AMDMATHLIB = -fveclib=AMDLIBM
+AMDLDFLAGS =
+AMDFCFLAGS = -mllvm -disable-loop-idiom-memset -mllvm -inline-threshold=3000 \
+ -mllvm -inlinehint-threshold=10000 -mllvm -enable-loop-distribute-adv \
+ -mllvm -vectorize-non-contiguous-memory-aggressively \
+ -mllvm -vectorizer-maximize-bandwidth=true \
+ -mllvm -enable-gather -mllvm -legalize-vector-library-calls \
+ -finline-aggressive -finline-hint-functions
+
+PROMOTION = #-fdefault-real-8
+ARCH_LOCAL = -DNONSTANDARD_SYSTEM_SUBR {CTSM_SUBST}
+CFLAGS_LOCAL = -w -c -m64 -Ofast
+LDFLAGS_LOCAL = -m64 -Ofast -Mstack_arrays $(AMDLDFLAGS) $(AMDMATHLIB) -lamdlibm -lm
+CPLUSPLUSLIB =
+ESMF_LDFLAG = $(CPLUSPLUSLIB)
+FCOPTIM = -Ofast -Mstack_arrays -ftree-vectorize -funroll-loops -finline-aggressive \
+ -finline-hint-functions $(AMDMATHLIB) $(AMDFCFLAGS)
+FCREDUCEDOPT = -O2 -Mstack_arrays -DFCREDUCEDOPT
+FCNOOPT = -O0
+FCDEBUG = # -g $(FCNOOPT)
+FORMAT_FIXED = -ffixed-form
+FORMAT_FREE = -ffree-form
+FCSUFFIX =
+BYTESWAPIO = -Mbyteswapio
+FCBASEOPTS_NO_G = -w $(FORMAT_FREE) $(BYTESWAPIO)
+FCBASEOPTS = $(FCBASEOPTS_NO_G) $(FCDEBUG)
+MODULE_SRCH_FLAG=
+TRADFLAG = CONFIGURE_TRADFLAG
+CPP = /lib/cpp CONFIGURE_CPPFLAGS
+AR = llvm-ar
+ARFLAGS = ru
+M4 = m4
+RANLIB = llvm-ranlib
+RLFLAGS =
+CC_TOOLS = $(SCC)
+NETCDFPAR_BUILD = {NETCDFPAR_BUILD}
+
+#insert new stanza here
diff --git a/var/spack/repos/builtin/packages/wrf/package.py b/var/spack/repos/builtin/packages/wrf/package.py
index 1fcc8226d7..a12e943fa2 100644
--- a/var/spack/repos/builtin/packages/wrf/package.py
+++ b/var/spack/repos/builtin/packages/wrf/package.py
@@ -8,6 +8,7 @@ import re
import sys
import time
from os.path import basename
+from pathlib import Path
from subprocess import PIPE, Popen
from llnl.util import tty
@@ -171,9 +172,9 @@ class Wrf(Package):
patch("patches/4.2/add_aarch64.patch", when="@4.2:4.3.1 %gcc target=aarch64:")
patch("patches/4.2/add_aarch64_acfl.patch", when="@4.2:4.3.1 %arm target=aarch64:")
patch("patches/4.2/configure_aocc_2.3.patch", when="@4.2 %aocc@:2.4.0")
- patch("patches/4.2/configure_aocc_3.0.patch", when="@4.2: %aocc@3.0.0:3.2.0")
+ patch("patches/4.2/configure_aocc_3.0.patch", when="@4.2 %aocc@3.0.0:3.2.0")
patch("patches/4.2/hdf5_fix.patch", when="@4.2: %aocc")
- patch("patches/4.2/derf_fix.patch", when="@4.2 %aocc")
+ patch("patches/4.2/derf_fix.patch", when="@=4.2 %aocc")
patch(
"patches/4.2/add_tools_flags_acfl2304.patch",
when="@4.2:4.4.2 %arm@23.04.1: target=aarch64:",
@@ -293,6 +294,26 @@ class Wrf(Package):
filter_file("^#!/bin/csh -f", "#!/usr/bin/env csh", *files)
filter_file("^#!/bin/csh", "#!/usr/bin/env csh", *files)
+ @run_before("configure", when="%aocc@4:")
+ def create_aocc_config(self):
+ param = {
+ "MPICC": self.spec["mpi"].mpicc,
+ "MPIFC": self.spec["mpi"].mpifc,
+ "CTSM_SUBST": (
+ "-DWRF_USE_CLM" if self.spec.satisfies("@:4.2.2") else "CONFIGURE_D_CTSM"
+ ),
+ "NETCDFPAR_BUILD": (
+ "CONFIGURE_NETCDFPAR_BUILD" if self.spec.satisfies("@4.4.0:") else ""
+ ),
+ }
+
+ zen_conf = (Path(__file__).parent / "aocc_config.inc").read_text().format(**param)
+
+ if self.spec.satisfies("@4.0:"):
+ filter_file("#insert new stanza here", zen_conf, "arch/configure.defaults")
+ else:
+ filter_file("#insert new stanza here", zen_conf, "arch/configure_new.defaults")
+
def answer_configure_question(self, outputbuf):
# Platform options question:
if "Please select from among the following" in outputbuf: