From 7ce63160fa12143a437738844da9f3c95af0b00a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20Tint=C3=B3?= <oriol.tinto@lmu.de> Date: Thu, 6 Jul 2023 10:38:38 +0200 Subject: [PATCH] Update icon-nwp recipe. --- spack_repo/packages/icon-nwp/package.py | 104 ++++-------------------- 1 file changed, 15 insertions(+), 89 deletions(-) diff --git a/spack_repo/packages/icon-nwp/package.py b/spack_repo/packages/icon-nwp/package.py index c6e8353..81ca221 100644 --- a/spack_repo/packages/icon-nwp/package.py +++ b/spack_repo/packages/icon-nwp/package.py @@ -19,8 +19,6 @@ class IconNwp(Package): homepage = "https://code.mpimet.mpg.de/projects/iconpublic" # maintainers("oriol.tinto") - # Version w2w-B6 points to a different repository and branch) - # version("w2w-B6", git="ssh://git@gitlab.physik.uni-muenchen.de/w2w/icon-w2w.git", branch="icon-w2w/icon-nwp-B6") version("w2w-B6", branch="w2w/B6_MCRPH") # FIXME: The ugly configuration system in older icon versions prevents us from using this package with it. # version("2.5.0-nwp3", branch="icon-nwp/op-release-2.5.0-nwp3") @@ -71,13 +69,6 @@ class IconNwp(Package): depends_on("openblas", when="%gcc") depends_on("intel-mkl", when="%intel") - # Extra dependencies for B6, including yaml, and the hdf5 filters for compression. - # depends_on("libyaml", when="@w2w-B6") - # depends_on("hdf5-blosc", when="@w2w-B6") - # depends_on("h5z-zfp", when="@w2w-B6") - # depends_on("sz~hdf5", when="@w2w-B6") - # depends_on("sz3~hdf5", when="@w2w-B6") - phases = ["configure", "build", "install"] def do_fetch(self, mirror_only=False): @@ -100,80 +91,8 @@ class IconNwp(Package): def patch(self): # Run git submodule update git = which("git") - if self.spec.variants['source'].value == 'lmu': - self.patch_submodules() git("submodule", "update", "--init", "--recursive") - def patch_submodules(self): - """ - Because of the lack of access rights to the original submodule repositories, - we patch the gitmodules file to point to a different mirror. - """ - git_submodules_file = Path().cwd() / ".gitmodules" - - git_mirror = "git@gitlab.lrz.de:dkrz-mirror" - - git_modules_patch = f""" - [submodule "externals/mtime"] - path = externals/mtime - url = {git_mirror}/libmtime.git - [submodule "externals/jsbach"] - path = externals/jsbach - url = {git_mirror}/jsbach.git - [submodule "externals/yac"] - path = externals/yac - url = {git_mirror}/YAC.git - [submodule "externals/self"] - path = externals/self - url = {git_mirror}/libself.git - [submodule "externals/tixi"] - path = externals/tixi - url = {git_mirror}/libtixi.git - [submodule "externals/yaxt"] - path = externals/yaxt - url = {git_mirror}/yaxt.git - [submodule "externals/rte-rrtmgp"] - path = externals/rte-rrtmgp - url = https://github.com/earth-system-radiation/rte-rrtmgp.git - [submodule "externals/cub"] - path = externals/cub - url = https://github.com/NVlabs/cub.git - [submodule "externals/omni-xmod-pool"] - path = externals/omni-xmod-pool - url = https://github.com/claw-project/omni-xmod-pool.git - [submodule "externals/cdi"] - path = externals/cdi - url = {git_mirror}/libcdi.git - [submodule "externals/sct"] - path = externals/sct - url = {git_mirror}/sct.git - [submodule "externals/ecrad"] - path = externals/ecrad - url = {git_mirror}/libecrad.git - [submodule "externals/dace_icon"] - path = externals/dace_icon - url = {git_mirror}/dace-icon-interface.git - [submodule "externals/emvorado"] - path = externals/emvorado - url = {git_mirror}/emvorado-for-icon.git - [submodule "utils/mkexp"] - path = utils/mkexp - url = https://git.mpimet.mpg.de/public/mkexp - [submodule "externals/art"] - path = externals/art - url = {git_mirror}/art.git - [submodule "externals/ppm"] - path = externals/ppm - url = https://gitlab.dkrz.de/jahns/ppm.git - [submodule "externals/probtest"] - path = externals/probtest - url = {git_mirror}/cscs-sw_probtest.git - """ - - # Replace the content of the original file with the patch - with git_submodules_file.open("w") as out_f: - out_f.write(git_modules_patch) - def setup_build_environment(self, env): spec = self.spec @@ -202,10 +121,6 @@ class IconNwp(Package): elif self.spec.satisfies("%intel"): libs.append("-qmkl=sequential") - # if self.spec.version == Version("w2w-B6"): - # libs.append("-lyaml") - # INCLUDES.append(f'-I{spec["zfp"].prefix}/include/zfp/') - mtune = "generic" CPPFLAGS = [] @@ -219,22 +134,33 @@ class IconNwp(Package): INCLUDES.append(f"-I{spec['petsc'].prefix}/include") libs.append(f"-L{spec['petsc'].prefix.lib} -lpetsc") + if self.spec.satisfies("%gcc"): + FCFLAGS = "-std=legacy -fmodule-private -fimplicit-none -fmax-identifier-length=63 -Wall " \ + "-Wcharacter-truncation -Wconversion -Wunderflow -Wunused-parameter " \ + "-Wno-surprising -fall-intrinsics -g -mpc64 -w" + ARCH_FLAG = f"-mtune={mtune}" + ICON_FCFLAGS = "-std=f2008 -fallow-argument-mismatch -fmodule-private -fimplicit-none -Wall" + elif self.spec.satisfies("%intel"): + FCFLAGS = "-stand none -implicitnone -warn all -warn conversions -warn unused -assume std_intrinsics -g -w" + ARCH_FLAG = f"-xHost" + ICON_FCFLAGS = "-stand f08 -implicitnone -warn all" + else: + raise AssertionError options = [ f"CC={spec['mpi'].mpicc}", f"FC={spec['mpi'].mpifc}", f"CFLAGS=-g -mpc64 {' '.join(INCLUDES)}", - f"ICON_CFLAGS=-O3 -g -mtune={mtune}", + f"ICON_CFLAGS=-O3 -g {ARCH_FLAG}", f"ICON_BUNDLED_CFLAGS=-O3 -mtune={mtune}", f"CPPFLAGS={' '.join(CPPFLAGS)}", - "FCFLAGS=-std=legacy -fmodule-private -fimplicit-none -fmax-identifier-length=63 -Wall -Wcharacter-truncation -Wconversion -Wunderflow -Wunused-parameter -Wno-surprising -fall-intrinsics -g -mpc64 -w", - f"ICON_OCEAN_FCFLAGS=-O3 -mtune={mtune}", + f"FCFLAGS={FCFLAGS}", + f"ICON_OCEAN_FCFLAGS=-O3 {ARCH_FLAG}", f"LDFLAGS={' '.join(libs)}", f"LIBS={' '.join(libs)}", f"--prefix={prefix}", ] - ICON_FCFLAGS="-std=f2008 -fallow-argument-mismatch -fmodule-private -fimplicit-none -Wall" if "+debug" in self.spec: options.append(f"ICON_FCFLAGS={ICON_FCFLAGS} -fbacktrace -fbounds-check -fstack-protector-all -finit-real=nan -finit-integer=-2147483648 -finit-character=127 -w -O2") else: -- GitLab