-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathpackage.py
131 lines (113 loc) · 4.71 KB
/
package.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
# ----------------------------------------------------------------------------
# spack install icontools
#
# You can edit this file again by typing:
#
# spack edit icontools
#
# See the Spack documentation for more information on packaging.
# ----------------------------------------------------------------------------
from spack import *
import subprocess
class Icontools(AutotoolsPackage):
"""
DWD ICON Tools for C2SM members.
Set of tools to prepare the input files
(for example the boundary condition, initial condition file,...) for ICON.
"""
homepage = 'https://c2sm.github.io/tools/icontools/'
c2sm = 'git@github.com:C2SM/icontools.git'
dkrz = 'git@gitlab.dkrz.de:dwd-sw/dwd_icon_tools.git'
maintainers = ['jonasjucker']
version('c2sm-master', git=c2sm, branch='master', submodules=True)
version('dkrz-master', git=dkrz, branch='master', submodules=True)
version('2.5.2', git=dkrz, tag='icontools-2.5.2', submodules=True)
depends_on('autoconf', type='build')
depends_on('automake', type='build')
depends_on('libtool', type='build')
depends_on('m4', type='build')
depends_on(
'netcdf-fortran %gcc'
) # WORKAROUND: '%gcc' should not be necessary, but without it, spack concretizes to nvhpc.
depends_on('netcdf-c ~mpi')
depends_on('hdf5 ~mpi +hl')
depends_on(
'mpi',
type=('build', 'link', 'run'),
)
depends_on('eccodes +fortran ~aec', type=('build', 'link', 'run'))
depends_on('jasper@1.900.1')
variant(
'slave',
default='none',
description='Build on described slave machine',
)
variant('slurm_account',
default='g110',
description=
'Slurm account used for mandatory testing during installation')
conflicts('%pgi')
conflicts('%nvhpc')
conflicts('%cce')
def configure_args(self):
args = []
args.append('acx_cv_fc_ftn_include_flag=-I')
args.append('acx_cv_fc_pp_include_flag=-I')
args.append('--disable-silent-rules')
args.append('--disable-shared')
args.append('--with-netcdf={0}'.format(
self.spec['netcdf-fortran'].prefix))
args.append('--enable-iso-c-interface')
args.append('--enable-grib2')
args.append('--with-eccodes={0}'.format(self.spec['eccodes'].prefix))
return args
def setup_build_environment(self, env):
#Setting CFLAGS
env.append_flags('CFLAGS', '-O2')
env.append_flags('CFLAGS', '-g')
env.append_flags('CFLAGS', '-Wunused')
env.append_flags('CFLAGS', '-DHAVE_LIBNETCDF')
env.append_flags('CFLAGS', '-DHAVE_NETCDF4')
env.append_flags('CFLAGS', '-DHAVE_CF_INTERFACE')
env.append_flags('CFLAGS', '-DHAVE_LIBGRIB_API')
env.append_flags('CFLAGS', '-D__ICON__')
env.append_flags('CFLAGS', '-DNOMPI')
#Setting CXXFLAGS
env.append_flags('CXXFLAGS', '-O2')
env.append_flags('CXXFLAGS', '-g')
env.append_flags('CXXFLAGS', '-fopenmp')
env.append_flags('CXXFLAGS', '-Wunused')
env.append_flags('CXXFLAGS', '-DNOMPI')
#Setting FCFLAGS
env.append_flags('FCFLAGS', '-O2')
env.append_flags('FCFLAGS', '-g')
env.append_flags('FCFLAGS', '-cpp')
env.append_flags('FCFLAGS', '-Wunused')
env.append_flags('FCFLAGS', '-DNOMPI')
#Setting LIBS
env.append_flags('LIBS', '-lhdf5')
env.append_flags('LIBS', '-leccodes')
env.append_flags('LIBS', '-leccodes_f90')
# jasper needs to be after eccodes, otherwise linking error
env.append_flags('LIBS', '-ljasper')
env.append_flags('LIBS', '-lgfortran')
def check(self):
# only c2sm-versions have script for CSCS
if self.spec.version in (Version('c2sm-master'), ):
if test_process.returncode != 0:
cat_submit_process = subprocess.run(['cat', 'job.out'],
stderr=subprocess.STDOUT,
check=True)
raise InstallError('Tests for Icontools failed')
else:
cat_submit_process = subprocess.run(['cat', 'job.out'],
stderr=subprocess.STDOUT,
check=True)
else:
print("\033[92m" + "==> " + "\033[0m" +
"icontools: No tests available for version {}".format(
self.spec.version))