Skip to content
Snippets Groups Projects
Commit 7ce63160 authored by Oriol Tintó's avatar Oriol Tintó
Browse files

Update icon-nwp recipe.

parent 14760e2c
No related branches found
No related tags found
1 merge request!9Build only
...@@ -19,8 +19,6 @@ class IconNwp(Package): ...@@ -19,8 +19,6 @@ class IconNwp(Package):
homepage = "https://code.mpimet.mpg.de/projects/iconpublic" homepage = "https://code.mpimet.mpg.de/projects/iconpublic"
# maintainers("oriol.tinto") # 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") version("w2w-B6", branch="w2w/B6_MCRPH")
# FIXME: The ugly configuration system in older icon versions prevents us from using this package with it. # 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") # version("2.5.0-nwp3", branch="icon-nwp/op-release-2.5.0-nwp3")
...@@ -71,13 +69,6 @@ class IconNwp(Package): ...@@ -71,13 +69,6 @@ class IconNwp(Package):
depends_on("openblas", when="%gcc") depends_on("openblas", when="%gcc")
depends_on("intel-mkl", when="%intel") 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"] phases = ["configure", "build", "install"]
def do_fetch(self, mirror_only=False): def do_fetch(self, mirror_only=False):
...@@ -100,80 +91,8 @@ class IconNwp(Package): ...@@ -100,80 +91,8 @@ class IconNwp(Package):
def patch(self): def patch(self):
# Run git submodule update # Run git submodule update
git = which("git") git = which("git")
if self.spec.variants['source'].value == 'lmu':
self.patch_submodules()
git("submodule", "update", "--init", "--recursive") 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): def setup_build_environment(self, env):
spec = self.spec spec = self.spec
...@@ -202,10 +121,6 @@ class IconNwp(Package): ...@@ -202,10 +121,6 @@ class IconNwp(Package):
elif self.spec.satisfies("%intel"): elif self.spec.satisfies("%intel"):
libs.append("-qmkl=sequential") 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" mtune = "generic"
CPPFLAGS = [] CPPFLAGS = []
...@@ -219,22 +134,33 @@ class IconNwp(Package): ...@@ -219,22 +134,33 @@ class IconNwp(Package):
INCLUDES.append(f"-I{spec['petsc'].prefix}/include") INCLUDES.append(f"-I{spec['petsc'].prefix}/include")
libs.append(f"-L{spec['petsc'].prefix.lib} -lpetsc") 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 = [ options = [
f"CC={spec['mpi'].mpicc}", f"CC={spec['mpi'].mpicc}",
f"FC={spec['mpi'].mpifc}", f"FC={spec['mpi'].mpifc}",
f"CFLAGS=-g -mpc64 {' '.join(INCLUDES)}", 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"ICON_BUNDLED_CFLAGS=-O3 -mtune={mtune}",
f"CPPFLAGS={' '.join(CPPFLAGS)}", 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"FCFLAGS={FCFLAGS}",
f"ICON_OCEAN_FCFLAGS=-O3 -mtune={mtune}", f"ICON_OCEAN_FCFLAGS=-O3 {ARCH_FLAG}",
f"LDFLAGS={' '.join(libs)}", f"LDFLAGS={' '.join(libs)}",
f"LIBS={' '.join(libs)}", f"LIBS={' '.join(libs)}",
f"--prefix={prefix}", f"--prefix={prefix}",
] ]
ICON_FCFLAGS="-std=f2008 -fallow-argument-mismatch -fmodule-private -fimplicit-none -Wall"
if "+debug" in self.spec: 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") 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: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment