Skip to content

Commit 68a6c57

Browse files
committed
add corresponding hpccm recipe (working with hpccm fix)
1 parent ef55369 commit 68a6c57

File tree

1 file changed

+285
-0
lines changed

1 file changed

+285
-0
lines changed

ci/hpccm_recipe_almalinux9.py

+285
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
# © Copyright 2021 Met Office
2+
# This software is licensed under the terms of the Apache Licence Version 2.0 which can be obtained at
3+
# http://www.apache.org/licenses/LICENSE-2.0.
4+
#
5+
6+
"""JOPA development container (simplified)
7+
8+
Usage:
9+
hpccm --recipe THIS-FILE [options] > DEST
10+
"""
11+
12+
13+
def github_url(repo, vn):
14+
return f'https://github.com/{repo}/archive/refs/tags/{vn}.tar.gz'
15+
16+
17+
def gitlab_url(repo, vn):
18+
name = repo.rsplit('/', 1)[1]
19+
return f'https://gitlab.com/{repo}/-/archive/{vn}/{name}-{vn}.tar.gz'
20+
21+
22+
# get versions via --userarg options
23+
# build hdf5/netcdf with zstd (libzstd from epel)
24+
atlas_orca_vn = USERARG.get('atlas_orca_vn', '0.3.1')
25+
atlas_vn = USERARG.get('atlas_vn', '0.37.0')
26+
blitz_vn = USERARG.get('blitz_vn', '1.0.2')
27+
boost_vn = USERARG.get('boost_vn', '1.85.0')
28+
bufr_query_vn = USERARG.get('bufr_query_vn', 'v0.0.1')
29+
cmake_vn = USERARG.get('cmake_vn', '3.30.0')
30+
ecbuild_vn = USERARG.get('ecbuild_vn', '3.8.5')
31+
eccodes_vn = USERARG.get('eccodes_vn', '2.30.1') # requires AEC (libaec-devel) by default
32+
eckit_vn = USERARG.get('eckit_vn', '1.26.2')
33+
ectrans_vn = USERARG.get('ectrans_vn', '1.2.0')
34+
fckit_vn = USERARG.get('fckit_vn', '0.13.0')
35+
fiat_vn = USERARG.get('fiat_vn', '1.4.1')
36+
fparser_vn = USERARG.get('fparser_vn', '0.1.4')
37+
gsl_lite_vn = USERARG.get('gsl_lite_vn', '0.41.0')
38+
gsw_fortran_vn = USERARG.get('gsw_fortran_vn', '3.07')
39+
hdf5_vn = USERARG.get('hdf5_vn', '1.14.2')
40+
json_schema_validator_vn = USERARG.get('json_schema_validator_vn', '2.3.0')
41+
json_vn = USERARG.get('json_vn', '3.9.1')
42+
lapack_vn = USERARG.get('lapack_vn', '3.11.0')
43+
nccmp_vn = USERARG.get('nccmp_vn', '1.9.1.0')
44+
nceplibs_bufr_vn = USERARG.get('nceplibs_bufr_vn', '12.0.1')
45+
netcdf_vn = USERARG.get('netcdf_vn', '4.9.2')
46+
netcdfcxx_vn = USERARG.get('netcdfcxx_vn', '4.3.1')
47+
netcdfftn_vn = USERARG.get('netcdfftn_vn', '4.6.1')
48+
odc_vn = USERARG.get('odc_vn', '1.5.2')
49+
openmpi_vn = USERARG.get('openmpi_vn', '4.1.5')
50+
pycodestyle_vn = USERARG.get('pycodestyle_vn', '2.10')
51+
udunits_vn = USERARG.get('udunits_vn', '2.2.28')
52+
yaxt_vn = USERARG.get('yaxt_vn', '528-0.10.0') # URL has a number and a version
53+
54+
COMMON_PACKAGES = [
55+
'bison',
56+
'bzip2',
57+
'clang-tools-extra',
58+
'eigen3-devel',
59+
'expat-devel',
60+
'flex',
61+
'gcc',
62+
'gcc-c++',
63+
'gcc-gfortran',
64+
'git',
65+
'git-lfs',
66+
'gmp-devel',
67+
'gnupg2',
68+
'graphviz',
69+
'jq',
70+
'lcov',
71+
'less',
72+
'libaec-devel',
73+
'libcurl-devel',
74+
'libX11-devel',
75+
'libxml2-devel',
76+
'libzstd-devel',
77+
'lz4-devel',
78+
'mpfr-devel',
79+
'ncurses-devel',
80+
'ninja-build',
81+
'openssh-server',
82+
'openssl-devel',
83+
'patch',
84+
'pkgconfig',
85+
'pybind11-devel',
86+
'python3-devel',
87+
'python3-pip',
88+
'python3-pytest',
89+
'python3-pyyaml',
90+
'rsync',
91+
'time',
92+
'unzip',
93+
'vim-minimal',
94+
'wget',
95+
'xz',
96+
'zlib-devel',
97+
'zstd',
98+
]
99+
100+
Stage0 += baseimage(image='almalinux:9', _as='build', _distro='rhel')
101+
Stage0 += shell(commands=[
102+
'dnf install -y \'dnf-command(config-manager)\'',
103+
'dnf config-manager -y --set-enabled crb',
104+
])
105+
Stage0 += packages(epel=True, ospackages=COMMON_PACKAGES)
106+
107+
Stage0 += cmake(eula=True, version=cmake_vn)
108+
109+
Stage0 += generic_cmake(
110+
prefix='/usr/local',
111+
url=github_url('Reference-LAPACK/lapack', f'v{lapack_vn}'),
112+
directory=f'lapack-{lapack_vn}',
113+
cmake_opts=['-DCMAKE_BUILD_TYPE=Release', '-DBUILD_SHARED_LIBS=ON'],
114+
)
115+
116+
Stage0 += boost(
117+
prefix='/usr/local',
118+
version=boost_vn,
119+
b2_opts=['toolset=gcc', 'cxxflags="-std=c++17"'],
120+
bootstrap_opts=[
121+
'--with-libraries=chrono,date_time,filesystem,program_options,regex,serialization,system,thread',
122+
],
123+
)
124+
125+
mpi = openmpi(
126+
prefix='/usr/local',
127+
version=openmpi_vn,
128+
cuda=False,
129+
infiniband=False,
130+
configure_opts=['--enable-mpi-fortran', '--enable-mpi-cxx'],
131+
)
132+
Stage0 += mpi
133+
134+
Stage0 += hdf5(
135+
version=hdf5_vn,
136+
prefix='/usr/local',
137+
with_zlib='/usr/local',
138+
with_szlib='/usr/local',
139+
enable_build_mode='production',
140+
configure_opts=['--enable-cxx', '--enable-fortran'],
141+
enable_parallel=True,
142+
enable_threadsafe=True,
143+
enable_unsupported=True,
144+
toolchain=mpi.toolchain,
145+
)
146+
# - Post-process h5pcc to avoid f951: Warning:
147+
# Nonexistent include directory '/var/tmp/hdf5-1.14.0/src/H5FDsubfiling'
148+
# sed -i "s|-I${TMPDIR}/hdf5-${hdf5_vn}/src/H5FDsubfiling||g" "/usr/local/bin/h5pcc"
149+
Stage0 += shell(commands=[
150+
f'sed -i "s|-I/var/tmp/hdf5-${hdf5_vn}/src/H5FDsubfiling||g" "/usr/local/bin/h5pcc"'
151+
])
152+
Stage0 += environment(variables={'H5DIR': '/usr/local', 'LIBS': '-ldl'})
153+
Stage0 += netcdf(
154+
version=netcdf_vn,
155+
version_cxx=netcdfcxx_vn,
156+
version_fortran=netcdfftn_vn,
157+
prefix='/usr/local',
158+
cxx=True,
159+
fortran=True,
160+
enable_netcdf_4=True,
161+
enable_shared=True,
162+
disable_zstandard_plugin=True,
163+
toolchain=mpi.toolchain,
164+
)
165+
Stage0 += environment(variables={
166+
'NETCDF_DIR': '/usr/local',
167+
'NetCDF_ROOT': '/usr/local'})
168+
Stage0 += generic_cmake(
169+
prefix='/usr/local',
170+
url=gitlab_url('remikz/nccmp', nccmp_vn),
171+
cmake_opts=['-DCMAKE_BUILD_TYPE=Release', '-DBUILD_SHARED_LIBS=ON'],
172+
toolchain=mpi.toolchain,
173+
)
174+
175+
Stage0 += generic_autotools(
176+
prefix='/usr/local',
177+
url=f'https://downloads.unidata.ucar.edu/udunits/{udunits_vn}/udunits-{udunits_vn}.tar.gz',
178+
configure_opts=['--enable-shared=yes'],
179+
)
180+
181+
Stage0 += generic_cmake(
182+
prefix='/usr/local',
183+
url=github_url('gsl-lite/gsl-lite', f'v{gsl_lite_vn}'),
184+
directory=f'gsl-lite-{gsl_lite_vn}',
185+
cmake_opts=['-DCMAKE_BUILD_TYPE=Release'],
186+
)
187+
188+
Stage0 += generic_cmake(
189+
prefix='/usr/local',
190+
url=github_url('blitzpp/blitz', blitz_vn),
191+
directory=f'blitz-{blitz_vn}',
192+
cmake_opts=['-DCMAKE_BUILD_TYPE=Release', '-DBUILD_SHARED_LIBS=ON'],
193+
)
194+
195+
Stage0 += generic_cmake(
196+
prefix='/usr/local',
197+
url=github_url('nlohmann/json', f'v{json_vn}'),
198+
directory=f'json-{json_vn}',
199+
cmake_opts=['-DCMAKE_BUILD_TYPE=Release', '-DJSON_BuildTests=OFF'],
200+
)
201+
202+
Stage0 += generic_cmake(
203+
prefix='/usr/local',
204+
url=github_url('NOAA-EMC/NCEPLIBS-bufr', f'v{nceplibs_bufr_vn}'),
205+
directory=f'NCEPLIBS-bufr-{nceplibs_bufr_vn}',
206+
cmake_opts=['-DCMAKE_BUILD_TYPE=Release', '-DBUILD_TESTS=OFF'],
207+
)
208+
209+
Stage0 += generic_cmake(
210+
prefix='/usr/local',
211+
url=github_url('pboettch/json-schema-validator', json_schema_validator_vn),
212+
directory=f'json-schema-validator-{json_schema_validator_vn}',
213+
cmake_opts=[
214+
'-DCMAKE_BUILD_TYPE=Release',
215+
'-DCMAKE_POLICY_DEFAULT_CMP0074=NEW',
216+
'-DBUILD_SHARED_LIBS=ON',
217+
'-DBUILD_TESTS=OFF',
218+
'-DBUILD_EXAMPLES=OFF',
219+
],
220+
)
221+
222+
for org, name, vn in (
223+
('ecmwf', 'ecbuild', ecbuild_vn),
224+
('ecmwf', 'eckit', eckit_vn),
225+
('ecmwf', 'fckit', fckit_vn),
226+
('ecmwf', 'odc', odc_vn),
227+
('ecmwf-ifs', 'fiat', fiat_vn),
228+
('ecmwf-ifs', 'ectrans', ectrans_vn),
229+
('ecmwf', 'atlas', atlas_vn),
230+
('ecmwf', 'atlas-orca', atlas_orca_vn),
231+
('ecmwf', 'eccodes', eccodes_vn),
232+
):
233+
Stage0 += generic_cmake(
234+
prefix='/usr/local',
235+
url=github_url(f'{org}/{name}', vn),
236+
directory=f'{name}-{vn}',
237+
cmake_opts=['-DCMAKE_BUILD_TYPE=Release', '-DMPI=ON', '-DOMP=ON'],
238+
)
239+
240+
# -- bufr-query
241+
Stage0 += generic_cmake(
242+
prefix='/usr/local',
243+
repository='https://github.com/NOAA-EMC/bufr-query',
244+
commit=bufr_query_vn,
245+
cmake_opts=['-DCMAKE_BUILD_TYPE=Release', '-DMPI=ON', '-DOMP=ON'],
246+
build_environment={'LDFLAGS': '-lnetcdf'},
247+
)
248+
249+
# -- GSW-Fortran
250+
Stage0 += generic_cmake(
251+
prefix='/usr/local',
252+
url=github_url('JCSDA-internal/GSW-Fortran', f'v{gsw_fortran_vn}'),
253+
directory=f'GSW-Fortran-{gsw_fortran_vn}',
254+
cmake_opts=['-DCMAKE_BUILD_TYPE=Release', '-DMPI=ON', '-DOMP=ON'],
255+
)
256+
257+
yaxt_vns = yaxt_vn.split('-', 1)
258+
Stage0 += generic_autotools(
259+
prefix='/usr/local',
260+
url=(
261+
'https://swprojects.dkrz.de/redmine/attachments/download/' +
262+
f'{yaxt_vns[0]}/yaxt-{yaxt_vns[1]}.tar.xz'
263+
),
264+
configure_opts=['--with-idxtype=long', '--without-regard-for-quality'],
265+
)
266+
267+
Stage1 += baseimage(image='almalinux:9', _distro='rhel')
268+
Stage1 += comment('JEDI development image with GNU and OpenMPI')
269+
Stage1 += label(metadata={
270+
'Maintainer': '[email protected]',
271+
'Species': 'NextGen',
272+
'Version': 'v0.1'})
273+
Stage1 += shell(commands=[
274+
'dnf install -y \'dnf-command(config-manager)\'',
275+
'dnf config-manager -y --set-enabled crb',
276+
])
277+
Stage1 += packages(epel=True, ospackages=COMMON_PACKAGES)
278+
Stage1 += pip(pip='pip3', packages=['cpplint', 'yamlprocessor'])
279+
Stage1 += copy(_from='build', src='/usr/local', dest='/usr/local')
280+
Stage1 += shell(commands=['ln -sfT python3 /usr/bin/python'])
281+
Stage1 += environment(variables={
282+
'PATH': '/usr/local/bin:$PATH',
283+
'LD_LIBRARY_PATH': '/usr/local/lib64:/usr/local/lib:/usr/lib64:/usr/lib:$LD_LIBRARY_PATH',
284+
})
285+
Stage1 += workdir(directory='/var/tmp')

0 commit comments

Comments
 (0)