Skip to content

Commit

Permalink
Merge pull request EESSI#166 from smoors/eessi_init_optional
Browse files Browse the repository at this point in the history
make EESSI optional in common_eessi_init
  • Loading branch information
casparvl authored Aug 12, 2024
2 parents df29715 + b9d64fe commit 3e1ecc5
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 23 deletions.
2 changes: 1 addition & 1 deletion config/aws_citc.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
FEATURES['CPU']
],
'prepare_cmds': [
'source %s' % common_eessi_init(),
common_eessi_init(),
# Required when using srun as launcher with --export=NONE in partition access, in order to ensure job
# steps inherit environment. It doesn't hurt to define this even if srun is not used
'export SLURM_EXPORT_ENV=ALL'
Expand Down
2 changes: 1 addition & 1 deletion config/aws_mc.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
FEATURES['CPU']
] + list(SCALES.keys()),
'prepare_cmds': [
'source %s' % common_eessi_init(),
common_eessi_init(),
# Required when using srun as launcher with --export=NONE in partition access, in order to ensure job
# steps inherit environment. It doesn't hurt to define this even if srun is not used
'export SLURM_EXPORT_ENV=ALL'
Expand Down
4 changes: 2 additions & 2 deletions config/it4i_karolina.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
'name': 'qcpu',
'scheduler': 'slurm',
'prepare_cmds': [
'source %s' % common_eessi_init(),
common_eessi_init(),
# Pass job environment variables like $PATH, etc., into job steps
'export SLURM_EXPORT_ENV=ALL',
# Needed when using srun launcher
Expand Down Expand Up @@ -71,7 +71,7 @@
# 'name': 'qgpu',
# 'scheduler': 'slurm',
# 'prepare_cmds': [
# 'source %s' % common_eessi_init(),
# common_eessi_init(),
# # Pass job environment variables like $PATH, etc., into job steps
# 'export SLURM_EXPORT_ENV=ALL',
# # Needed when using srun launcher
Expand Down
4 changes: 2 additions & 2 deletions config/izum_vega.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
'name': 'cpu',
'scheduler': 'slurm',
'prepare_cmds': [
'source %s' % common_eessi_init(),
common_eessi_init(),
# Pass job environment variables like $PATH, etc., into job steps
'export SLURM_EXPORT_ENV=ALL',
# Needed when using srun launcher
Expand Down Expand Up @@ -72,7 +72,7 @@
# 'name': 'gpu',
# 'scheduler': 'slurm',
# 'prepare_cmds': [
# 'source %s' % common_eessi_init(),
# common_eessi_init(),
# # Pass job environment variables like $PATH, etc., into job steps
# 'export SLURM_EXPORT_ENV=ALL',
# # Needed when using srun launcher
Expand Down
2 changes: 1 addition & 1 deletion config/macc_deucalion.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# bypass CPU autodetection for now aarch64/a64fx,
# see https://github.com/EESSI/software-layer/pull/608
'export EESSI_SOFTWARE_SUBDIR_OVERRIDE=aarch64/a64fx',
'source %s' % common_eessi_init(),
common_eessi_init(),
# Pass job environment variables like $PATH, etc., into job steps
'export SLURM_EXPORT_ENV=HOME,PATH,LD_LIBRARY_PATH,PYTHONPATH',
],
Expand Down
8 changes: 4 additions & 4 deletions config/surf_snellius.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{
'name': 'rome',
'scheduler': 'slurm',
'prepare_cmds': ['source %s' % common_eessi_init()],
'prepare_cmds': [common_eessi_init()],
'launcher': 'mpirun',
'access': ['-p rome', '--export=None'],
'environs': ['default'],
Expand All @@ -63,7 +63,7 @@
{
'name': 'genoa',
'scheduler': 'slurm',
'prepare_cmds': ['source %s' % common_eessi_init()],
'prepare_cmds': [common_eessi_init()],
'launcher': 'mpirun',
'access': ['-p genoa', '--export=None'],
'environs': ['default'],
Expand All @@ -87,7 +87,7 @@
{
'name': 'gpu_A100',
'scheduler': 'slurm',
'prepare_cmds': ['source %s' % common_eessi_init()],
'prepare_cmds': [common_eessi_init()],
'launcher': 'mpirun',
'access': ['-p gpu_a100', '--export=None'],
'environs': ['default'],
Expand Down Expand Up @@ -123,7 +123,7 @@
{
'name': 'gpu_H100',
'scheduler': 'slurm',
'prepare_cmds': ['source %s' % common_eessi_init()],
'prepare_cmds': [common_eessi_init()],
'launcher': 'mpirun',
'access': ['-p gpu_h100', '--export=None'],
'environs': ['default'],
Expand Down
10 changes: 5 additions & 5 deletions config/vsc_hortense.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def command(self, job):
{
'name': 'cpu_rome_256gb',
'scheduler': 'slurm',
'prepare_cmds': ['source %s' % common_eessi_init()],
'prepare_cmds': [common_eessi_init()],
'access': hortense_access + ['--partition=cpu_rome'],
'environs': ['default'],
'descr': 'CPU nodes (AMD Rome, 256GiB RAM)',
Expand Down Expand Up @@ -65,7 +65,7 @@ def command(self, job):
{
'name': 'cpu_rome_512gb',
'scheduler': 'slurm',
'prepare_cmds': ['source %s' % common_eessi_init()],
'prepare_cmds': [common_eessi_init()],
'access': hortense_access + ['--partition=cpu_rome_512'],
'environs': ['default'],
'descr': 'CPU nodes (AMD Rome, 512GiB RAM)',
Expand Down Expand Up @@ -97,7 +97,7 @@ def command(self, job):
{
'name': 'cpu_milan',
'scheduler': 'slurm',
'prepare_cmds': ['source %s' % common_eessi_init()],
'prepare_cmds': [common_eessi_init()],
'access': hortense_access + ['--partition=cpu_milan'],
'environs': ['default'],
'descr': 'CPU nodes (AMD Milan, 256GiB RAM)',
Expand Down Expand Up @@ -129,7 +129,7 @@ def command(self, job):
{
'name': 'gpu_rome_a100_40gb',
'scheduler': 'slurm',
'prepare_cmds': ['source %s' % common_eessi_init()],
'prepare_cmds': [common_eessi_init()],
'access': hortense_access + ['--partition=gpu_rome_a100_40'],
'environs': ['default'],
'descr': 'GPU nodes (A100 40GB)',
Expand Down Expand Up @@ -173,7 +173,7 @@ def command(self, job):
{
'name': 'gpu_rome_a100_80gb',
'scheduler': 'slurm',
'prepare_cmds': ['source %s' % common_eessi_init()],
'prepare_cmds': [common_eessi_init()],
'access': hortense_access + ['--partition=gpu_rome_a100_80'],
'environs': ['default'],
'descr': 'GPU nodes (A100 80GB)',
Expand Down
28 changes: 21 additions & 7 deletions eessi/testsuite/common_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import warnings

perflog_format = '|'.join([
'%(check_job_completion_time)s',
Expand Down Expand Up @@ -93,11 +94,21 @@ def common_eessi_init(eessi_version=None):
"""
# Check which EESSI_CVMFS_REPO we are running under
eessi_cvmfs_repo = os.getenv('EESSI_CVMFS_REPO', None)

if eessi_cvmfs_repo is None:
err_msg = "Environment variable 'EESSI_CVMFS_REPO' was not found."
err_msg += " Did you initialize the EESSI environment before running the test suite?"
raise ValueError(err_msg)
if eessi_cvmfs_repo == '/cvmfs/pilot.eessi-hpc.org':
warn_msg = '\n' + '\n'.join([
"EESSI WARNING: Environment variable 'EESSI_CVMFS_REPO' was not found.",
"EESSI WARNING: If you do not intend to use the EESSI software stack, this is perfectly fine.",
"EESSI WARNING: To use EESSI, initialize the EESSI environment before running the test suite.",
])
warnings.warn(warn_msg)
return ''

eessi_init = []
pilot_repo = '/cvmfs/pilot.eessi-hpc.org'

if eessi_cvmfs_repo == pilot_repo:
eessi_init.append('export EESSI_FORCE_PILOT=1')
if eessi_version is None:
# Try also EESSI_VERSION for backwards compatibility with previous common_eessi_init implementation
eessi_version = os.getenv('EESSI_PILOT_VERSION', os.getenv('EESSI_VERSION', 'latest'))
Expand All @@ -112,7 +123,10 @@ def common_eessi_init(eessi_version=None):
err_msg += " Did you initialize the EESSI environment before running the test suite?"
raise ValueError(err_msg)

if eessi_cvmfs_repo == '/cvmfs/pilot.eessi-hpc.org' and eessi_version == 'latest':
return '/cvmfs/pilot.eessi-hpc.org/latest/init/bash'
if eessi_cvmfs_repo == pilot_repo and eessi_version == 'latest':
version_string = eessi_version
else:
return '%s/versions/%s/init/bash' % (eessi_cvmfs_repo, eessi_version)
version_string = f'versions/{eessi_version}'

eessi_init.append(f'source {eessi_cvmfs_repo}/{version_string}/init/bash')
return ' && '.join(eessi_init)

0 comments on commit 3e1ecc5

Please sign in to comment.