Skip to content

Commit 6bd1a84

Browse files
authored
Merge pull request #125 from xylar/update-to-1.11.0
Update to v1.11.0
2 parents 2001d9e + ebf363b commit 6bd1a84

File tree

7 files changed

+167
-121
lines changed

7 files changed

+167
-121
lines changed

e3sm_supported_machines/bootstrap.py

Lines changed: 55 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ def build_env(is_test, recreate, compiler, mpi, conda_mpi, version,
123123
mpi_prefix = f'mpi_{conda_mpi}'
124124

125125
nco_spec = config.get('spack_specs', 'nco')
126+
127+
# whether to remove esmpy and xesmf, becasue they will be installed
128+
# manually with pip
129+
remove_esmf_esmpy_xesmf = (
130+
config.get('e3sm_unified', 'esmpy') != 'None' and
131+
config.get('e3sm_unified', 'xesmf') != 'None')
132+
126133
if is_test:
127134

128135
nco_dev = ('alpha' in nco_spec or 'beta' in nco_spec)
@@ -139,16 +146,17 @@ def build_env(is_test, recreate, compiler, mpi, conda_mpi, version,
139146
channels = f'{channels} -c conda-forge/label/{package}_dev'
140147

141148
# edit if not using a release candidate for a given package
142-
dev_labels = ['e3sm_diags', 'mpas_analysis', 'zppy']
149+
dev_labels = ['e3sm_unified', 'chemdyg', 'e3sm_diags',
150+
'mpas_analysis', 'zppy', 'zstash']
143151
for package in dev_labels:
144152
channels = f'{channels} -c conda-forge/label/{package}_dev'
145153
channels = f'{channels} ' \
146-
f'-c conda-forge ' \
147-
f'-c e3sm/label/e3sm_dev'
154+
f'-c conda-forge '
148155
else:
149-
channels = '--override-channels -c conda-forge -c defaults -c e3sm'
156+
channels = '--override-channels -c conda-forge'
150157

151-
packages = f'python={python} pip'
158+
packages = f'python={python} pip "setuptools>=41.2" setuptools_scm ' \
159+
f'setuptools-git-versioning'
152160

153161
source_activation_scripts = \
154162
f'source {conda_base}/etc/profile.d/conda.sh'
@@ -163,9 +171,13 @@ def build_env(is_test, recreate, compiler, mpi, conda_mpi, version,
163171
check_call(commands)
164172

165173
if conda_mpi == 'hpc':
166-
remove_packages = 'tempest-remap esmf esmpy'
167-
if nco_spec != '':
174+
remove_packages = 'tempest-remap'
175+
if nco_spec != 'None':
168176
remove_packages = f'nco {remove_packages}'
177+
178+
if remove_esmf_esmpy_xesmf:
179+
remove_packages = f'{remove_packages} esmf esmpy xesmf'
180+
169181
# remove conda-forge versions so we're sure to use Spack versions
170182
commands = f'{activate_base} && conda remove -y --force ' \
171183
f'-n {env_name} {remove_packages}'
@@ -180,8 +192,8 @@ def build_env(is_test, recreate, compiler, mpi, conda_mpi, version,
180192
def install_mache_from_branch(activate_env, fork, branch):
181193
print('Clone and install local mache\n')
182194
commands = f'{activate_env} && ' \
183-
f'cd build_mache/mache && ' \
184-
f'python -m pip install --no-deps .'
195+
f'cd build_mache/mache && ' \
196+
f'python -m pip install --no-deps .'
185197

186198
check_call(commands)
187199

@@ -191,17 +203,20 @@ def build_sys_ilamb_esmpy(config, machine, compiler, mpi, template_path,
191203

192204
mpi4py_version = config.get('e3sm_unified', 'mpi4py')
193205
ilamb_version = config.get('e3sm_unified', 'ilamb')
194-
build_mpi4py = str(mpi4py_version != 'None')
195-
build_ilamb = str(ilamb_version != 'None')
206+
build_mpi4py = mpi4py_version != 'None'
207+
build_ilamb = ilamb_version != 'None'
196208

197209
esmpy_version = config.get('e3sm_unified', 'esmpy')
198-
build_esmpy = str(esmpy_version != 'None')
210+
build_esmpy = esmpy_version != 'None'
211+
212+
xesmf_version = config.get('e3sm_unified', 'xesmf')
213+
build_xesmf = xesmf_version != 'None'
199214

200215
mpicc, _, _, modules = \
201216
get_modules_env_vars_and_mpi_compilers(machine, compiler, mpi,
202217
shell='sh')
203218

204-
script_filename = 'build_ilamb_esmpy.bash'
219+
script_filename = 'build_ilamb_esmpy_xesmf.bash'
205220

206221
with open(f'{template_path}/build.template', 'r') as f:
207222
template = Template(f.read())
@@ -211,33 +226,41 @@ def build_sys_ilamb_esmpy(config, machine, compiler, mpi, template_path,
211226
activate_env_lines = activate_env.replace(' && ', '\n')
212227
modules = f'{activate_env_lines}\n{modules}'
213228

214-
spack_branch_base = f'{spack_base}/{spack_env}'
215-
spack_view = f'{spack_branch_base}/var/spack/environments/' \
229+
spack_view = f'{spack_base}/var/spack/environments/' \
216230
f'{spack_env}/.spack-env/view'
217231
script = template.render(
218232
mpicc=mpicc, modules=modules, template_path=template_path,
219-
mpi4py_version=mpi4py_version, build_mpi4py=build_mpi4py,
220-
ilamb_version=ilamb_version, build_ilamb=build_ilamb,
233+
mpi4py_version=mpi4py_version, build_mpi4py=str(build_mpi4py),
234+
ilamb_version=ilamb_version, build_ilamb=str(build_ilamb),
221235
ilamb_channels=channels, esmpy_version=esmpy_version,
222-
build_esmpy=build_esmpy, spack_view=spack_view)
236+
build_esmpy=str(build_esmpy), xesmf_version=xesmf_version,
237+
build_xesmf=str(build_xesmf), spack_view=spack_view)
223238
print(f'Writing {script_filename}')
224239
with open(script_filename, 'w') as handle:
225240
handle.write(script)
226241

227242
command = f'/bin/bash {script_filename}'
228243
check_call(command)
229244

245+
if build_esmpy:
246+
# use spack esmf
247+
esmf_mk = f'export ESMFMKFILE={spack_view}/lib/esmf.mk'
248+
else:
249+
# use conda esmf
250+
esmf_mk = 'export ESMFMKFILE=${CONDA_PREFIX}/lib/esmf.mk'
251+
return esmf_mk
252+
230253

231254
def build_spack_env(config, machine, compiler, mpi, spack_env, tmpdir):
232255

233256
base_path = config.get('e3sm_unified', 'base_path')
234257
spack_base = f'{base_path}/spack/{spack_env}'
235258

236-
if config.has_option('e3sm_unified', 'use_system_hdf5_netcdf'):
237-
use_system_hdf5_netcdf = config.getboolean('e3sm_unified',
238-
'use_system_hdf5_netcdf')
259+
if config.has_option('e3sm_unified', 'use_e3sm_hdf5_netcdf'):
260+
use_e3sm_hdf5_netcdf = config.getboolean('e3sm_unified',
261+
'use_e3sm_hdf5_netcdf')
239262
else:
240-
use_system_hdf5_netcdf = False
263+
use_e3sm_hdf5_netcdf = False
241264

242265
if config.has_option('e3sm_unified', 'spack_mirror'):
243266
spack_mirror = config.get('e3sm_unified', 'spack_mirror')
@@ -248,7 +271,7 @@ def build_spack_env(config, machine, compiler, mpi, spack_env, tmpdir):
248271
section = config['spack_specs']
249272
for option in section:
250273
# skip redundant specs if using E3SM packages
251-
if use_system_hdf5_netcdf and \
274+
if use_e3sm_hdf5_netcdf and \
252275
option in ['hdf5', 'netcdf_c', 'netcdf_fortran',
253276
'parallel_netcdf']:
254277
continue
@@ -259,7 +282,7 @@ def build_spack_env(config, machine, compiler, mpi, spack_env, tmpdir):
259282
make_spack_env(spack_path=spack_base, env_name=spack_env,
260283
spack_specs=specs, compiler=compiler, mpi=mpi,
261284
machine=machine, tmpdir=tmpdir, include_e3sm_lapack=True,
262-
include_system_hdf5_netcdf=use_system_hdf5_netcdf,
285+
include_e3sm_hdf5_netcdf=use_e3sm_hdf5_netcdf,
263286
spack_mirror=spack_mirror)
264287

265288
return spack_base
@@ -339,6 +362,7 @@ def check_env(script_filename, env_name, conda_mpi, machine):
339362
'IPython', 'globus_cli', 'zstash']
340363
if conda_mpi not in ['nompi', 'hpc']:
341364
imports.append('ILAMB')
365+
imports.append('esmpy')
342366

343367
commands = [['mpas_analysis', '-h'],
344368
['livv', '--version'],
@@ -416,10 +440,10 @@ def main():
416440

417441
nompi_compiler = None
418442
nompi_suffix = '_login'
419-
# first, make environment for login nodes. We're using mpich from
420-
# conda-forge for now because we haven't had any luck with esmf>8.2.0 nompi
443+
# first, make environment for login nodes. We're using no-MPI from
444+
# conda-forge for now
421445
env_path, env_nompi, activate_env, _, _ = build_env(
422-
is_test, recreate, nompi_compiler, mpi, 'mpich', version,
446+
is_test, recreate, nompi_compiler, mpi, 'nompi', version,
423447
python, conda_base, nompi_suffix, nompi_suffix, activate_base,
424448
args.local_conda_build, config)
425449

@@ -444,8 +468,10 @@ def main():
444468
if compiler is not None:
445469
spack_base = build_spack_env(config, machine, compiler, mpi, spack_env,
446470
args.tmpdir)
447-
build_sys_ilamb_esmpy(config, machine, compiler, mpi, template_path,
448-
activate_env, channels, spack_base, spack_env)
471+
esmf_mk = build_sys_ilamb_esmpy(config, machine, compiler, mpi,
472+
template_path, activate_env, channels,
473+
spack_base, spack_env)
474+
sys_info['env_vars'].append(esmf_mk)
449475
else:
450476
spack_base = None
451477

e3sm_supported_machines/default.cfg

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,35 @@ python = 3.10
1717
# the MPI version (nompi, mpich or openmpi)
1818
mpi = nompi
1919

20-
# the version of ILAMB
21-
ilamb = 2.7
20+
# the version of ILAMB if using system compilers and MPI
21+
ilamb = 2.7.2
2222

2323
# the version of mache to use during deployment (should match the version used
2424
# in the package itself)
25-
mache = 1.22.0
25+
mache = 1.28.0
2626

27-
# the version of mpi4py to build if using system compilers
28-
mpi4py = 3.1.5
27+
# the version of mpi4py to build if using system compilers and MPI
28+
mpi4py = 4.0.1
2929

30-
# the version of esmpy to build if using system compilers (must match esmf from
31-
# spack below)
32-
esmpy = 8.6.0
30+
# the version of esmpy to build if using system MPI (must match esmf from
31+
# spack below if not None)
32+
esmpy = None
33+
34+
# the version of xesmf to build if using system MPI (doesn't make sense
35+
# to install from source unless esmpy is also being installed from source).
36+
xesmf = None
3337

3438

3539
# spack package specs
3640
[spack_specs]
3741

38-
esmf = esmf@8.6.0+mpi+netcdf~pnetcdf~external-parallelio
39-
hdf5 = [email protected].1+cxx+fortran+hl+mpi+shared
42+
esmf = esmf@8.8.0+mpi+netcdf~pnetcdf~external-parallelio
43+
hdf5 = [email protected].3+cxx+fortran+hl+mpi+shared
4044
moab = [email protected]+mpi+hdf5+netcdf+pnetcdf+metis+parmetis+tempest
41-
nco = nco@5.2.4+openmp
45+
nco = nco@5.3.2+openmp
4246
netcdf_c = [email protected]+mpi~parallel-netcdf
4347
netcdf_fortran = [email protected]
4448
parallel_netcdf = [email protected]
4549
# parallelio = [email protected]+fortran+mpi~pnetcdf
46-
tempestextremes = [email protected].1+mpi
50+
tempestextremes = [email protected].3+mpi
4751
tempestremap = [email protected]

e3sm_supported_machines/shared.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
def parse_args(bootstrap):
1515
parser = argparse.ArgumentParser(
1616
description='Deploy E3SM-Unified')
17-
parser.add_argument("--version", dest="version", default="1.10.0",
17+
parser.add_argument("--version", dest="version", default="1.11.0",
1818
help="The version of E3SM-Unified to deploy")
1919
parser.add_argument("--conda", dest="conda_base",
2020
help="Path for the conda base")

e3sm_supported_machines/templates/build.template

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,20 @@ if [ "{{ build_esmpy }}" == "True" ]; then
2828
# this is an unused dumping grounds and causes disconcerting warnings
2929
rm -rf src/esmpy/fragments
3030

31-
python -m pip install --no-deps .
31+
python -m pip install --no-deps --no-build-isolation .
32+
33+
cd ${build_dir}
34+
fi
35+
36+
if [ "{{ build_xesmf }}" == "True" ]; then
37+
38+
git clone [email protected]:pangeo-data/xESMF.git -b v{{ xesmf_version }} xesmf-{{ xesmf_version }}
39+
40+
export ESMFMKFILE={{ spack_view }}/lib/esmf.mk
41+
42+
cd xesmf-{{ xesmf_version }}
43+
44+
python -m pip install --no-deps --no-build-isolation .
3245

3346
cd ${build_dir}
3447
fi

recipes/e3sm-unified/build_and_upload.bash

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
conda_dir=${HOME}/miniforge3
6+
dev=True
7+
8+
rm -rf ${conda_dir}/conda-bld
9+
10+
if [ $dev == "True" ]
11+
then
12+
13+
channels="-c conda-forge/label/chemdyg_dev \
14+
-c conda-forge/label/e3sm_diags_dev \
15+
-c conda-forge/label/mache_dev \
16+
-c conda-forge/label/mpas_analysis_dev \
17+
-c conda-forge/label/zppy_dev \
18+
-c conda-forge/label/zstash_dev \
19+
-c conda-forge"
20+
21+
for file in configs/mpi_mpich_python3.10.yaml configs/mpi_hpc_python3.10.yaml
22+
do
23+
conda build -m $file --override-channels $channels .
24+
done
25+
26+
else
27+
28+
channels="-c conda-forge -c e3sm"
29+
for file in configs/mpi_*_python*.yaml
30+
do
31+
conda build -m $file --override-channels $channels .
32+
done
33+
34+
fi

0 commit comments

Comments
 (0)