WRF: v3.9.1.1 and v4.2 can be built with aocc@3.1 (#25384)

Co-authored-by: mohan002 <mohbabul@amd.com>
This commit is contained in:
AMD Toolchain Support 2021-08-16 11:56:56 +05:30 committed by GitHub
parent fbed679dd0
commit e42af64e24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 77 additions and 2 deletions

View file

@ -108,6 +108,7 @@ class Wrf(Package):
patch("patches/3.9/add_aarch64.patch", when="@3.9.1.1")
patch("patches/3.9/configure_aocc_2.3.patch", when="@3.9.1.1 %aocc@:2.4.0")
patch("patches/3.9/configure_aocc_3.0.patch", when="@3.9.1.1 %aocc@3.0.0")
patch("patches/3.9/configure_aocc_3.1.patch", when="@3.9.1.1 %aocc@3.1.0")
# These patches deal with netcdf & netcdf-fortran being two diff things
# Patches are based on:
@ -133,7 +134,8 @@ class Wrf(Package):
patch("patches/4.2/tirpc_detect.patch", when="@4.2")
patch("patches/4.2/add_aarch64.patch", when="@4.2")
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")
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")
depends_on("pkgconfig", type=("build"))
@ -339,7 +341,7 @@ def configure(self, spec, prefix):
@run_after("configure")
def patch_for_libmvec(self):
if self.spec.satisfies("@3.9.1.1 %aocc@:3.0"):
if self.spec.satisfies("@3.9.1.1 %aocc"):
fp = self.package_dir + "/patches/3.9/aocc_lmvec.patch"
which('patch')('-s', '-p1', '-i', '{0}'.format(fp), '-d', '.')

View file

@ -0,0 +1,53 @@
--- WRF-3.9.1.1/arch/configure_new.defaults 2021-03-10 10:08:07.885236847 +0530
+++ WRF-3.9.1.1/arch/configure_new_aocc.defaults 2021-08-12 08:58:35.442165745 +0530
@@ -1917,6 +1917,50 @@
CC_TOOLS = $(SCC)
#insert new stanza here
+##############################################################
+#ARCH AMD EPYC Linux x86_64 AOCC Compilers #dm+sm
+#
+DESCRIPTION = AMD AOCC ($SFC/$SCC): EPYC
+DMPARALLEL = 1
+OMPCPP = -D_OPENMP
+OMP = -fopenmp
+OMPCC = -fopenmp -Mpreprocess
+SFC = flang
+SCC = clang
+CCOMP = clang
+DM_FC = mpif90 -DMPI2_SUPPORT
+DM_CC = mpicc -DMPI2_SUPPORT
+FC = $(DM_FC)
+CC = $(DM_CC) -DFSEEKO64_OK
+LD = $(FC)
+RWORDSIZE = $(NATIVE_RWORDSIZE)
+PROMOTION =
+ARCH_LOCAL = -DNONSTANDARD_SYSTEM_SUBR -DWRF_USE_CLM
+LIBMVEC = -mllvm -vector-library=LIBMVEC-X86 -mllvm -enable-loop-vectorization-with-conditions -Mstack_arrays
+AOCCOPT = -O3 -m64 -Ofast -ffast-math
+CFLAGS_LOCAL = -w $(AOCCOPT)
+LDFLAGS_LOCAL = -lm -ltirpc -lamdlibm -ljemalloc -lmvec $(AOCCOPT)
+CPLUSPLUSLIB =
+ESMF_LDFLAG = $(CPLUSPLUSLIB)
+FCOPTIM = $(AOCCOPT) -fopenmp
+FCREDUCEDOPT = -O2 -Ofast -ffast-math
+FCNOOPT = -O0 -DFCNOOPT -fopenmp
+FCDEBUG = #-g
+FORMAT_FIXED = -Mfixed
+FORMAT_FREE = -Mfreeform
+FCSUFFIX =
+BYTESWAPIO = -Mbyteswapio
+FCBASEOPTS_NO_G = $(FORMAT_FREE) $(BYTESWAPIO) -fopenmp
+FCBASEOPTS = $(FCBASEOPTS_NO_G) $(FCDEBUG) -DBASEOPTS -fopenmp
+MODULE_SRCH_FLAG =
+TRADFLAG = -traditional
+CPP = /lib/cpp -P
+AR = llvm-ar
+ARFLAGS = ru
+M4 = m4
+RANLIB = llvm-ranlib
+RLFLAGS =
+CC_TOOLS = $(SCC)
###########################################################
#ARCH Fujitsu FX10/FX100 Linux x86_64 SPARC64IXfx/SPARC64Xlfx, mpifrtpx and mpifccpx compilers #serial smpar dmpar dm+sm

View file

@ -0,0 +1,20 @@
--- WRF-4.2/arch/Config.pl 2021-08-12 16:39:02.339226280 +0530
+++ WRF-4.2/arch/Config_hdf5.pl 2021-08-12 18:17:17.362452577 +0530
@@ -514,7 +514,7 @@
}
if ( $sw_hdf5_path )
- { $_ =~ s:CONFIGURE_HDF5_LIB_PATH:-L$sw_hdf5_path/lib -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lm -lz: ;
+ { $_ =~ s:CONFIGURE_HDF5_LIB_PATH:-L$sw_hdf5_path/lib -lhdf5_hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lm -lz: ;
$_ =~ s:CONFIGURE_HDF5_FLAG:-DHDF5: ;
}
else
@@ -836,7 +836,7 @@
}
if ( $sw_hdf5_path )
- { $_ =~ s:CONFIGURE_HDF5_LIB_PATH:-L$sw_hdf5_path/lib -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lm -lz: ;
+ { $_ =~ s:CONFIGURE_HDF5_LIB_PATH:-L$sw_hdf5_path/lib -lhdf5_hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lm -lz: ;
$_ =~ s:CONFIGURE_HDF5_FLAG:-DHDF5: ;
}
else