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

Uenv ci venv activation #1012

Open
wants to merge 116 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
209c779
inital update
jonasjucker Jan 29, 2024
59c9119
remove blas variant, remove serialbox
jonasjucker Jan 29, 2024
f8f1bdf
remove old extensions
jonasjucker Jan 29, 2024
362b35e
Delete sysconfigs/tsa/modules.yaml
dominichofer Feb 1, 2024
0caa92b
do not use upstreams
jonasjucker Feb 1, 2024
3e5bbf4
Merge branch 'dev_v0.21.1' of github.com:C2SM/spack-c2sm into dev_v0.…
jonasjucker Feb 1, 2024
ab4f4a2
py-toolz available in upstream spack
jonasjucker Feb 1, 2024
1ceb0c7
GitHub Action: Apply Pep8-formatting
invalid-email-address Feb 1, 2024
ee202cf
remove upstreams
jonasjucker Feb 1, 2024
47d62ca
add version 0.12.3
jonasjucker Feb 1, 2024
205ffe6
cython@2 for [email protected]
jonasjucker Feb 13, 2024
3ed0137
GitHub Action: Apply Pep8-formatting
invalid-email-address Feb 13, 2024
4056566
inherit from upstream, introduce v 2.4.0
jonasjucker Feb 13, 2024
bb34584
GitHub Action: Apply Pep8-formatting
invalid-email-address Feb 13, 2024
a7d055a
lock pip to :23.0 for py-cmake
jonasjucker Feb 13, 2024
9730d27
Merge branch 'dev_v0.21.1' of github.com:C2SM/spack-c2sm into dev_v0.…
jonasjucker Feb 13, 2024
70e385f
lock eckit-version for infero
jonasjucker Feb 13, 2024
2834f46
temporary deactivate testsuite for int2lm
jonasjucker Feb 15, 2024
6b241f8
Revert "temporary deactivate testsuite for int2lm"
jonasjucker Feb 15, 2024
663ca8c
remove gmake on Daint
jonasjucker Feb 19, 2024
bdcfe98
remove deprecated config
jonasjucker Feb 19, 2024
056ac6e
add gmake again
jonasjucker Feb 22, 2024
3534c7e
Remove faulty classification as "spack locking problem"
dominichofer Feb 23, 2024
e46164a
[python] no default ssl package
dominichofer Feb 23, 2024
8514ffe
[fdb] Remove package and tests
dominichofer Feb 23, 2024
fe41fc2
[fckit] Remove package and tests
dominichofer Feb 23, 2024
98ef7ed
[numpy] Remove package and tests.
dominichofer Feb 23, 2024
586747c
Revert "[fckit] Remove package and tests"
jonasjucker Feb 26, 2024
d9c9a9e
Fix FDB related tests (#920)
victoria-cherkas Feb 27, 2024
53fcc0a
test:fix(pytorch-fortran): try explicit dependency on (c/g)make%gcc
leclairm Feb 29, 2024
4e53c73
upd: point to icon-c2sm branch spack_v0.21.1
leclairm Mar 1, 2024
bb02e1b
Update system_test.py
jonasjucker Mar 4, 2024
2d70626
GitHub Action: Apply Pep8-formatting
invalid-email-address Mar 4, 2024
be37428
upd: cosmo spack env
leclairm Mar 4, 2024
f51bc0f
Merge branch 'main' of github.com:C2SM/spack-c2sm into dev_v0.21.1
jonasjucker Mar 6, 2024
73b8f62
skip failing tests
jonasjucker Mar 12, 2024
f14cad7
GitHub Action: Apply Pep8-formatting
invalid-email-address Mar 12, 2024
a5b8577
add link to latest spack version
jonasjucker Mar 12, 2024
2dbc567
Merge branch 'dev_v0.21.1' of github.com:C2SM/spack-c2sm into dev_v0.…
jonasjucker Mar 12, 2024
ec10891
downgrade icon4py,gt4py mostly to build-tests, add fdb again
jonasjucker Mar 12, 2024
eedf6e3
GitHub Action: Apply Pep8-formatting
invalid-email-address Mar 12, 2024
f487d15
add upstreams for Daint
jonasjucker Mar 12, 2024
0e5c21f
add upstream to config
jonasjucker Mar 12, 2024
c1abeb3
adapt unit-test
jonasjucker Mar 12, 2024
8bd2ae6
Use single-thread make for flexpart-cosmo
mjaehn Mar 28, 2024
c2bd45e
Merge branch 'main' of github.com:C2SM/spack-c2sm into dev_v0.21.1
mjaehn Mar 28, 2024
cd43f0b
Update system_test.py
jonasjucker Apr 2, 2024
d9f9f7f
Fixes to gt4py in v0.21.1 (#937)
abishekg7 Apr 17, 2024
1bd69b5
Update system_test.py (#938)
abishekg7 Apr 18, 2024
7f05c36
drop test for nvhpc-cpu ICON
jonasjucker Apr 18, 2024
ba5c86d
Merge branch 'main' of github.com:C2SM/spack-c2sm into dev_v0.21.1
jonasjucker Apr 18, 2024
d18b6ce
cleanup
jonasjucker Apr 18, 2024
9565d57
[py-gt4py] fixes to typing-extensions versions (#939)
abishekg7 Apr 19, 2024
76015b7
remove irrelevant test
jonasjucker May 13, 2024
0c524f6
Merge branch 'main' of github.com:C2SM/spack-c2sm into dev_v0.21.1
jonasjucker May 13, 2024
0339c09
parametrize integration tests
jonasjucker May 15, 2024
8fa9132
adapte trigger test
jonasjucker May 15, 2024
420487d
cleanup
jonasjucker May 15, 2024
614e1db
GitHub Action: Apply Pep8-formatting
invalid-email-address May 15, 2024
b1400b7
fix bug
jonasjucker May 15, 2024
d06f8f6
exclude packages for spack spec
jonasjucker May 15, 2024
4b40126
GitHub Action: Apply Pep8-formatting
invalid-email-address May 15, 2024
2312aa4
first shot of test
jonasjucker May 15, 2024
2b4b761
GitHub Action: Apply Pep8-formatting
invalid-email-address May 15, 2024
dfbf164
fix
jonasjucker May 15, 2024
08bd714
unique function names
jonasjucker May 16, 2024
7602028
GitHub Action: Apply Pep8-formatting
invalid-email-address May 16, 2024
a78d2e0
all tests ported
jonasjucker May 16, 2024
7f45895
GitHub Action: Apply Pep8-formatting
invalid-email-address May 16, 2024
bb5ef49
use fixture for devirtualize_env
jonasjucker May 16, 2024
2d0d0c3
Merge branch 'pure_pytest' of github.com:C2SM/spack-c2sm into pure_py…
jonasjucker May 16, 2024
c9d00e3
GitHub Action: Apply Pep8-formatting
invalid-email-address May 16, 2024
cd511c5
speed up
jonasjucker May 16, 2024
d034f3b
fix tests
jonasjucker May 16, 2024
aae44bf
GitHub Action: Apply Pep8-formatting
invalid-email-address May 16, 2024
336255b
move unssuported packages closer to test
jonasjucker May 22, 2024
21da2ed
GitHub Action: Apply Pep8-formatting
invalid-email-address May 22, 2024
8fdabb0
add infrastructure from branch uenv
jonasjucker May 22, 2024
0f95e0c
thread-safe fixture to link config-yaml for uenvs
jonasjucker May 22, 2024
a1e7dab
spack_install_and_test ready for uenv
jonasjucker May 22, 2024
0bbb1b4
GitHub Action: Apply Pep8-formatting
invalid-email-address May 22, 2024
de19e03
link repos as part of uenv-fixture
jonasjucker May 23, 2024
031be49
spack install and spack install and test with uenv
jonasjucker May 23, 2024
5f72ca9
build icon for nvhpc
jonasjucker May 23, 2024
20c19fd
GitHub Action: Apply Pep8-formatting
invalid-email-address May 23, 2024
e8fca80
fix(uenv): use warnings if hash not found
leclairm Jul 1, 2024
1819669
fix(uenv): no test on hash if not found
leclairm Jul 1, 2024
cc97fd6
Merge branch 'main' of github.com:C2SM/spack-c2sm into uenv_ci
jonasjucker Jul 8, 2024
133260e
finalize uenv
jonasjucker Jul 8, 2024
5216170
GitHub Action: Apply Pep8-formatting
invalid-email-address Jul 8, 2024
13f7681
handle srun for Balfrin higher up in callstack
jonasjucker Jul 9, 2024
d828742
GitHub Action: Apply Pep8-formatting
invalid-email-address Jul 9, 2024
0b6886f
remove ) to fix syntax
jonasjucker Jul 9, 2024
fde5d4e
use env-var instead of link for uenv
jonasjucker Jul 9, 2024
e491e8e
Merge branch 'uenv_ci' of github.com:C2SM/spack-c2sm into uenv_ci
jonasjucker Jul 9, 2024
bd48530
GitHub Action: Apply Pep8-formatting
invalid-email-address Jul 9, 2024
48e77ad
restore gitignore
jonasjucker Jul 9, 2024
163022b
Update src/spack_commands.py
jonasjucker Jul 9, 2024
7632728
review 1/2
jonasjucker Jul 9, 2024
eb20355
GitHub Action: Apply Pep8-formatting
invalid-email-address Jul 9, 2024
e088ed8
Update src/spack_commands.py
jonasjucker Jul 10, 2024
a418f85
review 2/2
jonasjucker Jul 10, 2024
608df8d
GitHub Action: Apply Pep8-formatting
invalid-email-address Jul 10, 2024
be80163
Merge branch 'main' of github.com:C2SM/spack-c2sm into uenv_ci
jonasjucker Jul 10, 2024
ce3b0b8
GitHub Action: Apply Pep8-formatting
invalid-email-address Jul 10, 2024
4b9e073
Merge branch 'main' of github.com:C2SM/spack-c2sm into uenv_ci
jonasjucker Jul 10, 2024
a27a73c
rename srun to allow-srun to better reflect actual code, reintroduce …
jonasjucker Jul 10, 2024
e5cdeca
GitHub Action: Apply Pep8-formatting
invalid-email-address Jul 10, 2024
dbd4c52
FIX: only append _out_of_source to logfile if really out-of-source
jonasjucker Jul 16, 2024
1ab704c
only use srun on Daint and Tsa
jonasjucker Jul 16, 2024
eb2c4f0
cleanup
jonasjucker Jul 16, 2024
5a4e718
GitHub Action: Apply Pep8-formatting
invalid-email-address Jul 16, 2024
9d22c17
separate cache as well
jonasjucker Jul 18, 2024
292dc7b
remove uenv-test with Python
jonasjucker Jul 18, 2024
b5ddb2a
deactivate uenv tests
jonasjucker Jul 18, 2024
f21ac3f
fix enable venv
huppd Nov 12, 2024
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
1 change: 1 addition & 0 deletions repos/c2sm/packages/icon/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ def configure_args(self):
# Check for DSL variants and set corresponding Liskov options
dsl = self.spec.variants['dsl'].value
if dsl != ('none', ):
args.append('--disable-venv-activation')
if 'substitute' in dsl:
args.append('--enable-liskov=substitute')
elif 'verify' in dsl:
Expand Down
14 changes: 11 additions & 3 deletions setup-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@ else
machine="$( "$parent_dir"/src/machine.sh )"
fi

export SPACK_SYSTEM_CONFIG_PATH="$parent_dir"/sysconfigs/"$machine"
export SPACK_USER_CONFIG_PATH="$parent_dir"/user-config
export SPACK_USER_CACHE_PATH="$parent_dir"/user-cache
if [[ ${machine:0:1} == "/" ]]; then
export SPACK_SYSTEM_CONFIG_PATH="$machine"/config
export SPACK_USER_CONFIG_PATH="$parent_dir"/sysconfigs/uenv
export SPACK_USER_CACHE_PATH="$parent_dir"/user-cache/uenv
else
export SPACK_SYSTEM_CONFIG_PATH="$parent_dir"/sysconfigs/"$machine"
export SPACK_USER_CONFIG_PATH="$parent_dir"/user-config
export SPACK_USER_CACHE_PATH="$parent_dir"/user-cache/"$machine"
fi


. "$parent_dir"/spack/share/spack/setup-env.sh

echo Spack configured for "$machine".
26 changes: 22 additions & 4 deletions src/spack_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def log_with_spack(command: str,
log_filename: str = None,
cwd=None,
env=None,
srun=False) -> None:
allow_srun=False,
uenv=None) -> None:
"""
Executes the given command while spack is loaded and writes the output into the log file.
If log_filename is None, command is used to create one.
Expand All @@ -27,13 +28,27 @@ def log_with_spack(command: str,

# Setup spack env
spack_env = f'. {spack_c2sm_path}/setup-env.sh'
if uenv:
spack_env += ' /user-environment'

# Only use srun as Jenkins user and on machines where it is available
use_srun = allow_srun and getpass.getuser() == 'jenkins' and machine_name(
) in ['daint', 'tsa']

uenv_args = ''
if uenv:
uenv_mount_point = f'{uenv}:/user-environment'
if use_srun:
uenv_args = '--uenv=' + uenv_mount_point
else:
uenv_args = 'squashfs-mount ' + uenv_mount_point + ' -- '

# Distribute work with 'srun'
if srun and getpass.getuser() == 'jenkins':
if use_srun:
# The '-c' argument should be in sync with
# sysconfig/<machine>/config.yaml config:build_jobs for max efficiency

srun = {
'balfrin': '',
'daint': 'srun -t 02:00:00 -C gpu -A g110 -c 12 -n 1',
'tsa': 'srun -t 02:00:00 -c 6',
}[machine_name()]
Expand All @@ -47,6 +62,9 @@ def log_with_spack(command: str,
with log_file.open('a') as f:
f.write(machine_name())
f.write('\n')
if uenv:
f.write(f'uenv: {uenv}')
f.write('\n')
f.write(command)
f.write('\n\n')

Expand All @@ -55,7 +73,7 @@ def log_with_spack(command: str,
# The output is streamed as directly as possible to the log_file to avoid buffering and potentially losing buffered content.
# '2>&1' redirects stderr to stdout.
ret = subprocess.run(
f'{spack_env}; {env_activate} ({srun} {command}) >> {log_file} 2>&1',
f'({srun} {uenv_args} bash -c "{spack_env}; {env_activate} {command}") >> {log_file} 2>&1',
cwd=cwd,
check=False,
shell=True)
Expand Down
2 changes: 2 additions & 0 deletions sysconfigs/uenv/concretizer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
concretizer:
reuse: true
6 changes: 6 additions & 0 deletions sysconfigs/uenv/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
config:
build_stage: '$spack/../spack-build_stage'
test_stage: '$spack/../spack-test_stage'
misc_cache: '$spack/../spack-misc_cache'
build_jobs: 12
db_lock_timeout: 120
2 changes: 2 additions & 0 deletions sysconfigs/uenv/repos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
repos:
- '$spack/../repos/c2sm'
28 changes: 20 additions & 8 deletions test/system_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import unittest
import pytest
import subprocess
import sys
import os
import uuid
import shutil
from pathlib import Path
import inspect

spack_c2sm_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
Expand All @@ -14,6 +12,8 @@
sys.path.append(os.path.normpath(spack_c2sm_path))
from src import machine_name, log_with_spack, sanitized_filename

PREPOST = '/scratch/mch/leclairm/uenvs/images/pre-post_v0.sqfs'


@pytest.fixture(scope='function')
def devirt_env():
Expand All @@ -39,7 +39,7 @@ def compose_logfilename(spec):
return sanitized_filename(func_name + '-' + spec)


def spack_install(spec: str, test_root: bool = True):
def spack_install(spec: str, test_root: bool = True, uenv: str = None):
"""
Tests 'spack install' of the given spec and writes the output into the log file.
"""
Expand All @@ -50,13 +50,15 @@ def spack_install(spec: str, test_root: bool = True):
log_with_spack(f'spack spec {spec}',
'system_test',
log_filename,
srun=False)
allow_srun=False,
uenv=uenv)

test_arg = "--test=root" if test_root else ""
log_with_spack(f'spack install -n -v {test_arg} {spec}',
'system_test',
log_filename,
srun=not spec.startswith('icon '))
allow_srun=not spec.startswith('icon '),
uenv=uenv)


nvidia_compiler: str = {
Expand All @@ -72,6 +74,14 @@ def test_install_libfyaml_default():
spack_install('libfyaml', test_root=False)


@pytest.mark.no_tsa # No uenv on Tsa
@pytest.mark.no_daint # No uenv on Daint
@pytest.mark.no_balfrin # Does not work as expected
@pytest.mark.libfyaml
def test_install_libfyaml_default_uenv():
spack_install('libfyaml', test_root=False, uenv=PREPOST)


@pytest.mark.libtorch
def test_install_libtorch_default():
spack_install('libtorch', test_root=False)
Expand Down Expand Up @@ -172,20 +182,22 @@ def icon_env_test(spack_env: str, out_of_source: bool = False):
check=True,
shell=True)

log_filename = sanitized_filename(spack_env)

if out_of_source:
build_dir = os.path.join(unique_folder, 'build')
os.makedirs(build_dir, exist_ok=True)
shutil.copytree(os.path.join(unique_folder, 'config'),
os.path.join(build_dir, 'config'))
unique_folder = build_dir
log_filename += '_out_of_source'

log_filename = sanitized_filename(spack_env) + '_out_of_source'
log_with_spack('spack install -n -v',
'system_test',
log_filename,
cwd=unique_folder,
env=spack_env,
srun=True)
allow_srun=True)

# for out-of-source build we can't run tests because required files
# like scripts/spack/test.py or scripts/buildbot_script are not synced
Expand All @@ -198,7 +210,7 @@ def icon_env_test(spack_env: str, out_of_source: bool = False):
log_filename,
cwd=unique_folder,
env=spack_env,
srun=False)
allow_srun=False)


@pytest.mark.no_balfrin # config file does not exist for this machine
Expand Down
Loading