Skip to content
Snippets Groups Projects
Commit 30bd0a94 authored by Fabian.Jakub's avatar Fabian.Jakub
Browse files

Merge remote-tracking branch 'origin/minimal-configuration' into FJ/spack_icon_install

parents 44b564de ba3ea1bb
No related branches found
No related tags found
1 merge request!4Switching to the advanced configuration method and fixing spack build.
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
from pathlib import Path from pathlib import Path
from spack.package import *
class IconNwp(Package): class IconNwp(Package):
""" """
...@@ -14,7 +15,7 @@ class IconNwp(Package): ...@@ -14,7 +15,7 @@ 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")
# Main repository (pointing to LMU's gitlab) # Main repository (pointing to LMU's gitlab)
git = "ssh://git@gitlab.physik.uni-muenchen.de/w2w/icon.git" git = "ssh://git@gitlab.physik.uni-muenchen.de/w2w/icon.git"
...@@ -27,14 +28,17 @@ class IconNwp(Package): ...@@ -27,14 +28,17 @@ class IconNwp(Package):
version("master", branch="master") version("master", branch="master")
version("psp", branch="icon-nwp/icon-nwp-psp") version("psp", branch="icon-nwp/icon-nwp-psp")
# Dependencies # Dependencies
depends_on("mpi") depends_on("mpi")
depends_on("netcdf-c") depends_on("netcdf-c")
depends_on("netcdf-fortran") depends_on("netcdf-fortran")
depends_on("eccodes") depends_on("eccodes+fortran")
depends_on("libxml2") depends_on("libxml2")
# Openblas? best way of doing it?
depends_on("openblas", when="%gcc")
depends_on("intel-mkl", when="%intel")
# Extra dependencies for B6, including yaml, and the hdf5 filters for compression. # Extra dependencies for B6, including yaml, and the hdf5 filters for compression.
depends_on("libyaml", when="@w2w-B6") depends_on("libyaml", when="@w2w-B6")
depends_on("hdf5-blosc", when="@w2w-B6") depends_on("hdf5-blosc", when="@w2w-B6")
...@@ -129,7 +133,7 @@ class IconNwp(Package): ...@@ -129,7 +133,7 @@ class IconNwp(Package):
"F77": spec["mpi"].mpif77, "F77": spec["mpi"].mpif77,
} }
for variable, value in env_variables_to_set.items(): for variable, value in env_variables_to_set.items():
env.set(variable, value) env.set(variable, value)
def configure(self, spec, prefix): def configure(self, spec, prefix):
spec = self.spec spec = self.spec
...@@ -138,11 +142,15 @@ class IconNwp(Package): ...@@ -138,11 +142,15 @@ class IconNwp(Package):
libs = [ libs = [
f"-L{spec['netcdf-c'].prefix.lib} -lnetcdf ", # netcdf-c libs f"-L{spec['netcdf-c'].prefix.lib} -lnetcdf ", # netcdf-c libs
f"-L{spec['netcdf-fortran'].prefix.lib} -lnetcdff", # netcdf-fortran libs f"-L{spec['netcdf-fortran'].prefix.lib} -lnetcdff", # netcdf-fortran libs
"-lopenblas", # OpenBlas
f"-L{spec['eccodes'].prefix.lib} -leccodes_f90 -leccodes", f"-L{spec['eccodes'].prefix.lib} -leccodes_f90 -leccodes",
f"-L{spec['libxml2'].prefix.lib} -lxml2", # XML2 libs f"-L{spec['libxml2'].prefix.lib} -lxml2", # XML2 libs
] ]
if self.spec.satisfies("%gcc"):
libs.append("-lopenblas")
elif self.spec.satisfies("%intel"):
libs.append("-qmkl=sequential")
if self.spec.version == Version("w2w-B6"): if self.spec.version == Version("w2w-B6"):
libs.append("-lyaml") libs.append("-lyaml")
...@@ -182,7 +190,6 @@ class IconNwp(Package): ...@@ -182,7 +190,6 @@ class IconNwp(Package):
env.set("ICON_DATA_PATH", self.spec.prefix.join("data")) env.set("ICON_DATA_PATH", self.spec.prefix.join("data"))
env.set("ICON_DOCS_PATH", self.spec.prefix.join("doc")) env.set("ICON_DOCS_PATH", self.spec.prefix.join("doc"))
def make_extra_folders(self, prefix): def make_extra_folders(self, prefix):
mkdir = which("mkdir") mkdir = which("mkdir")
rsync = which("rsync") rsync = which("rsync")
...@@ -195,6 +202,7 @@ class IconNwp(Package): ...@@ -195,6 +202,7 @@ class IconNwp(Package):
rsync("-av", "data/", f"{prefix}/data") rsync("-av", "data/", f"{prefix}/data")
rsync("-av", "run/", f"{prefix}/run") rsync("-av", "run/", f"{prefix}/run")
rsync("-av", "--include='*.pdf'", "--exclude='*.*'", "doc/", f"{prefix}/doc/") rsync("-av", "--include='*.pdf'", "--exclude='*.*'", "doc/", f"{prefix}/doc/")
curl("https://code.mpimet.mpg.de/attachments/download/19568/ICON_tutorial_2019.pdf", "--output", f"{prefix}/doc/ICON_tutorial_2019.pdf") curl("https://code.mpimet.mpg.de/attachments/download/19568/ICON_tutorial_2019.pdf", "--output",
curl("http://www.cosmo-model.org/content/model/documentation/core/emvorado_userguide.pdf", "--output", f"{prefix}/doc/emvorado_userguide.pdf") f"{prefix}/doc/ICON_tutorial_2019.pdf")
curl("http://www.cosmo-model.org/content/model/documentation/core/emvorado_userguide.pdf", "--output",
f"{prefix}/doc/emvorado_userguide.pdf")
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