Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to compass v1.3.0-alpha.1 #793

Merged
merged 20 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions compass/landice/tests/circular_shelf/albany_input.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra

Problem:
LandIce Viscosity:
Type: 'Glen''s Law'
Expand Down
2 changes: 0 additions & 2 deletions compass/landice/tests/dome/albany_input.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra

Problem:
LandIce Viscosity:
Type: 'Glen''s Law'
Expand Down
2 changes: 0 additions & 2 deletions compass/landice/tests/ensemble_generator/albany_input.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra

Problem:
LandIce Field Norm:
sliding_velocity_basalside:
Expand Down
2 changes: 0 additions & 2 deletions compass/landice/tests/greenland/albany_input.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra

# Discretization Description
Discretization:
Exodus Output File Name: albany_output.exo
Expand Down
2 changes: 0 additions & 2 deletions compass/landice/tests/humboldt/albany_input.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra

Problem:
LandIce Field Norm:
sliding_velocity_basalside:
Expand Down
2 changes: 0 additions & 2 deletions compass/landice/tests/humboldt/albany_input_depthInt.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra

Problem:
LandIce Field Norm:
sliding_velocity_basalside:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
# In order to use ML, change Tpetra to Epetra in the following line,
# and "Preconditioner Type: MueLu" to " Preconditioner Type: ML" several lines below
Build Type: Tpetra

Problem:
LandIce Field Norm:
sliding_velocity_basalside:
Expand Down
2 changes: 0 additions & 2 deletions compass/landice/tests/mismipplus/albany_input.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra

Problem:
Dirichlet BCs:
SDBC on NS dirichlet for DOF U1 prescribe Field: dirichlet_field
Expand Down
2 changes: 0 additions & 2 deletions compass/landice/tests/thwaites/albany_input.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra

# Problem Description
Problem:
Cubature Degree: 4
Expand Down
2 changes: 0 additions & 2 deletions compass/landice/tests/thwaites/albany_input_depthInt.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra

Problem:
Depth Integrated Model: true

Expand Down
2 changes: 2 additions & 0 deletions compass/machines/chicoma-cpu.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ spack = /usr/projects/e3sm/compass/chicoma-cpu/spack
# pnetcdf as E3SM (spack modules are used otherwise)
use_e3sm_hdf5_netcdf = True

# location of a spack mirror for compass to use
spack_mirror = /usr/projects/e3sm/compass/chicoma-cpu/spack/spack_mirror

# The parallel section describes options related to running jobs in parallel
[parallel]
Expand Down
2 changes: 2 additions & 0 deletions compass/ocean/suites/nonhydro.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ocean/nonhydro/solitary_wave
ocean/nonhydro/stratified_seiche
2 changes: 1 addition & 1 deletion compass/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.2.0-alpha.9'
__version__ = '1.3.0-alpha.1'
109 changes: 67 additions & 42 deletions conda/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,50 +340,15 @@ def build_conda_env(env_type, recreate, mpi, conda_mpi, version,
check_call(commands, logger=logger)

if recreate or update_jigsaw:
# remove conda jigsaw and jigsaw-python
t0 = time.time()
commands = \
f'{activate_env} && ' \
f'conda remove -y --force-remove jigsaw jigsawpy'
check_call(commands, logger=logger)

commands = \
f'{activate_env} && ' \
f'cd {source_path} && ' \
f'git submodule update --init jigsaw-python'
check_call(commands, logger=logger)

print('Building JIGSAW\n')
# add build tools to deployment env, not compass env
commands = \
f'conda install -y cmake cxx-compiler && ' \
f'cd {source_path}/jigsaw-python && ' \
f'python setup.py build_external'
check_call(commands, logger=logger)

print('Installing JIGSAW and JIGSAW-Python\n')
commands = \
f'{activate_env} && ' \
f'cd {source_path}/jigsaw-python && ' \
f'python -m pip install --no-deps -e . && ' \
f'cp jigsawpy/_bin/* ${{CONDA_PREFIX}}/bin'
check_call(commands, logger=logger)

t1 = time.time()
total = t1 - t0
message = f'JIGSAW install took {total:.1f} s.'
if logger is None:
print(message)
else:
logger.info(message)
build_jigsaw(activate_env, source_path, env_path, logger)

# install (or reinstall) compass in edit mode
print('Installing compass\n')
commands = \
f'{activate_env} && ' \
f'cd {source_path} && ' \
f'rm -rf compass.egg-info && ' \
f'python -m pip install -e .'
f'python -m pip install --no-deps -e .'
check_call(commands, logger=logger)

print('Installing pre-commit\n')
Expand All @@ -394,6 +359,57 @@ def build_conda_env(env_type, recreate, mpi, conda_mpi, version,
check_call(commands, logger=logger)


def build_jigsaw(activate_env, source_path, env_path, logger):
# remove conda jigsaw and jigsaw-python
t0 = time.time()
commands = \
f'{activate_env} && ' \
f'conda remove -y --force-remove jigsaw jigsawpy'
check_call(commands, logger=logger)

commands = \
f'{activate_env} && ' \
f'cd {source_path} && ' \
f'git submodule update --init jigsaw-python'
check_call(commands, logger=logger)

print('Building JIGSAW\n')
# add build tools to deployment env, not compass env
jigsaw_build_deps = 'cxx-compiler cmake'
netcdf_lib = f'{env_path}/lib/libnetcdf.so'
cmake_args = f'-DCMAKE_BUILD_TYPE=Release -DNETCDF_LIBRARY={netcdf_lib}'

commands = \
f'conda install -y {jigsaw_build_deps} && ' \
f'cd {source_path}/jigsaw-python/external/jigsaw && ' \
f'rm -rf tmp && ' \
f'mkdir tmp && ' \
f'cd tmp && ' \
f'cmake .. {cmake_args} && ' \
f'cmake --build . --config Release --target install --parallel 4 && ' \
f'cd {source_path}/jigsaw-python && ' \
f'rm -rf jigsawpy/_bin jigsawpy/_lib && ' \
f'cp -r external/jigsaw/bin/ jigsawpy/_bin && ' \
f'cp -r external/jigsaw/lib/ jigsawpy/_lib'
check_call(commands, logger=logger)

print('Installing JIGSAW and JIGSAW-Python\n')
commands = \
f'{activate_env} && ' \
f'cd {source_path}/jigsaw-python && ' \
f'python -m pip install --no-deps -e . && ' \
f'cp jigsawpy/_bin/* ${{CONDA_PREFIX}}/bin'
check_call(commands, logger=logger)

t1 = time.time()
total = int(t1 - t0 + 0.5)
message = f'JIGSAW install took {total:.1f} s.'
if logger is None:
print(message)
else:
logger.info(message)


def get_env_vars(machine, compiler, mpilib):

if machine is None:
Expand Down Expand Up @@ -449,10 +465,16 @@ def build_spack_env(config, update_spack, machine, compiler, mpi, # noqa: C901
cmake = config.get('deploy', 'cmake')
esmf = config.get('deploy', 'esmf')
lapack = config.get('deploy', 'lapack')
moab = config.get('deploy', 'moab')
petsc = config.get('deploy', 'petsc')
scorpio = config.get('deploy', 'scorpio')
parallelio = config.get('deploy', 'parallelio')

if config.has_option('deploy', 'spack_mirror'):
spack_mirror = config.get('deploy', 'spack_mirror')
else:
spack_mirror = None

spack_branch_base = f'{spack_base}/{spack_env}'

specs = list()
Expand All @@ -479,6 +501,9 @@ def build_spack_env(config, update_spack, machine, compiler, mpi, # noqa: C901
include_e3sm_lapack = False
else:
include_e3sm_lapack = True
if moab != 'None':
specs.append(
f'"moab@{moab}+mpi+hdf5+netcdf+pnetcdf+metis+parmetis+tempest"')
if petsc != 'None':
specs.append(f'"petsc@{petsc}+mpi+batch"')

Expand All @@ -503,7 +528,7 @@ def build_spack_env(config, update_spack, machine, compiler, mpi, # noqa: C901

if albany != 'None':
specs.append(f'"trilinos-for-albany@{albany}"')
specs.append(f'"albany@{albany}+mpas"')
specs.append(f'"albany@{albany}+mpas~py+unit_tests"')

yaml_template = f'{spack_template_path}/{machine}_{compiler}_{mpi}.yaml'
if not os.path.exists(yaml_template):
Expand All @@ -526,7 +551,7 @@ def build_spack_env(config, update_spack, machine, compiler, mpi, # noqa: C901
include_e3sm_lapack=include_e3sm_lapack,
include_e3sm_hdf5_netcdf=e3sm_hdf5_netcdf,
yaml_template=yaml_template, tmpdir=tmpdir,
custom_spack=custom_spack)
custom_spack=custom_spack, spack_mirror=spack_mirror)

# remove ESMC/ESMF include files that interfere with MPAS time keeping
include_path = f'{spack_branch_base}/var/spack/environments/' \
Expand Down Expand Up @@ -645,11 +670,11 @@ def write_load_compass(template_path, activ_path, conda_base, env_type,
mkdir -p conda/logs
echo Reinstalling compass package in edit mode...
rm -rf compass.egg-info
python -m pip install -e . &> conda/logs/install_compass.log
python -m pip install --no-deps -e . &> conda/logs/install_compass.log
echo Done.
echo
fi
"""
""" # noqa: E501
else:
update_compass = ''

Expand Down Expand Up @@ -1049,7 +1074,7 @@ def main(): # noqa: C901
commands = f'source {conda_base}/etc/profile.d/conda.sh && ' \
f'conda activate {conda_env_name} && ' \
'cd ../build_mache/mache && ' \
'python -m pip install .'
'python -m pip install --no-deps .'
check_call(commands, logger=logger)

previous_conda_env = conda_env_name
Expand Down
10 changes: 6 additions & 4 deletions conda/compass_env/spec-file.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ python>=3.8
cartopy
cartopy_offlinedata
cmocean
esmf=*={{ mpi_prefix }}_*
esmf=8.6.0={{ mpi_prefix }}_*
ffmpeg
geometric_features=1.3.0
git
Expand All @@ -16,11 +16,13 @@ ipython
jupyter
lxml
{% if include_mache %}
mache=1.17.0
mache=1.20.0
{% endif %}
matplotlib-base
metis
mpas_tools=0.29.0
moab >=5.5.1
moab=*={{ mpi_prefix }}_tempest_*
mpas_tools=0.32.0
nco
netcdf4=*=nompi_*
numpy
Expand All @@ -30,7 +32,7 @@ otps=2021.10
progressbar2
pyamg >=4.2.2
pyproj
pyremap>=1.1.0,<2.0.0
pyremap>=1.3.0,<2.0.0
requests
ruamel.yaml
# having pip check problems with this version
Expand Down
4 changes: 2 additions & 2 deletions conda/configure_compass_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def main():
if local_mache:
mache = ''
else:
mache = '"mache=1.17.0"'
mache = '"mache=1.20.0"'

setup_install_env(env_name, activate_base, args.use_local, logger,
args.recreate, conda_base, mache)
Expand All @@ -114,7 +114,7 @@ def main():
f'git clone -b {args.mache_branch} ' \
f'[email protected]:{args.mache_fork}.git mache && ' \
f'cd mache && ' \
f'python -m pip install .'
f'python -m pip install --no-deps .'

check_call(commands, logger=logger)

Expand Down
13 changes: 7 additions & 6 deletions conda/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,23 @@ recreate = False
suffix =

# the python version
python = 3.10
python = 3.11

# the MPI version (nompi, mpich or openmpi)
mpi = nompi

# the version of various packages to include if using spack
albany = compass-2023-08-03
albany = compass-2024-03-13
# cmake newer than 3.23.0 needed for Trilinos
cmake = 3.23.0:
esmf = 8.4.2
hdf5 = 1.14.1
esmf = 8.6.0
hdf5 = 1.14.3
lapack = 3.9.1
moab = 5.5.1
netcdf_c = 4.9.2
netcdf_fortran = 4.6.0
petsc = 3.19.1
pnetcdf = 1.12.3
scorpio = 1.4.1
# parallelio = 2.5.10
scorpio = 1.6.0
# parallelio = 2.6.2
parallelio = None
Loading
Loading