Skip to content

Commit 2058b7e

Browse files
author
Vasileios Karakasis
authored
Merge branch 'master' into UES-1279
2 parents e7749c2 + 0227b31 commit 2058b7e

File tree

7 files changed

+86
-35
lines changed

7 files changed

+86
-35
lines changed

cscs-checks/apps/gromacs/gromacs_check.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# SPDX-License-Identifier: BSD-3-Clause
55

66
import contextlib
7-
import itertools
87
import os
98

109
import reframe as rfm
@@ -100,27 +99,37 @@ def __init__(self, scale, variant):
10099
class GromacsCPUCheck(GromacsBaseCheck):
101100
def __init__(self, scale, variant):
102101
super().__init__('md.log')
103-
self.valid_systems = ['daint:mc']
102+
self.valid_systems = ['daint:mc', 'eiger:mc']
104103
self.descr = 'GROMACS CPU check'
105104
self.executable_opts = ['mdrun', '-dlb yes', '-ntomp 1', '-npme -1',
106105
'-nb cpu', '-s herflat.tpr']
107106

108107
if scale == 'small':
109108
self.valid_systems += ['dom:mc']
110-
self.num_tasks = 216
111-
self.num_tasks_per_node = 36
109+
if (self.current_system.name in ['daint', 'dom']):
110+
self.num_tasks = 216
111+
self.num_tasks_per_node = 36
112+
elif (self.current_system.name in ['eiger']):
113+
self.num_tasks = 768
114+
self.num_tasks_per_node = 128
112115
else:
113-
self.num_tasks = 576
114-
self.num_tasks_per_node = 36
116+
if (self.current_system.name in ['daint', 'dom']):
117+
self.num_tasks = 576
118+
self.num_tasks_per_node = 36
119+
elif (self.current_system.name in ['eiger']):
120+
self.num_tasks = 2048
121+
self.num_tasks_per_node = 128
115122

116123
references = {
117124
'prod': {
118125
'small': {
119126
'dom:mc': {'perf': (40.0, -0.05, None, 'ns/day')},
120-
'daint:mc': {'perf': (38.8, -0.10, None, 'ns/day')}
127+
'daint:mc': {'perf': (38.8, -0.10, None, 'ns/day')},
128+
'eiger:mc': {'perf': (103.00, -0.10, None, 'ns/day')}
121129
},
122130
'large': {
123-
'daint:mc': {'perf': (68.0, -0.20, None, 'ns/day')}
131+
'daint:mc': {'perf': (68.0, -0.20, None, 'ns/day')},
132+
'eiger:mc': {'perf': (146.00, -0.20, None, 'ns/day')}
124133
}
125134
},
126135
}

reframe/core/logging.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,10 @@ def _create_file_handler(site_config, config_prefix):
247247

248248

249249
def _create_filelog_handler(site_config, config_prefix):
250-
basedir = os.path.abspath(site_config.get(f'{config_prefix}/basedir'))
251-
prefix = site_config.get(f'{config_prefix}/prefix')
250+
basedir = os.path.abspath(
251+
osext.expandvars(site_config.get(f'{config_prefix}/basedir'))
252+
)
253+
prefix = osext.expandvars(site_config.get(f'{config_prefix}/prefix'))
252254
filename_patt = os.path.join(basedir, prefix)
253255
append = site_config.get(f'{config_prefix}/append')
254256
return MultiFileHandler(filename_patt, mode='a+' if append else 'w+')

reframe/core/modules.py

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ def __init__(self):
744744
(version, self.MIN_VERSION))
745745

746746
self._version = version
747+
self._extra_module_paths = []
747748

748749
def name(self):
749750
return 'tmod4'
@@ -770,6 +771,15 @@ def _execute(self, cmd, *args):
770771
def load_module(self, module):
771772
if module.collection:
772773
self.execute('restore', str(module))
774+
775+
# Here the module search path removal/addition is repeated since
776+
# 'restore' discards previous module path manipulations
777+
for op, mp in self._extra_module_paths:
778+
if op == '+':
779+
super().searchpath_add(mp)
780+
else:
781+
super().searchpath_remove(mp)
782+
773783
return []
774784
else:
775785
return super().load_module(module)
@@ -792,7 +802,15 @@ def conflicted_modules(self, module):
792802

793803
def emit_load_instr(self, module):
794804
if module.collection:
795-
return f'module restore {module}'
805+
cmds = [f'module restore {module}']
806+
807+
# Here we append module searchpath removal/addition commands
808+
# since 'restore' discards previous module path manipulations
809+
for op, mp in self._extra_module_paths:
810+
operation = 'use' if op == '+' else 'unuse'
811+
cmds += [f'module {operation} {mp}']
812+
813+
return '\n'.join(cmds)
796814

797815
return super().emit_load_instr(module)
798816

@@ -802,6 +820,18 @@ def emit_unload_instr(self, module):
802820

803821
return super().emit_unload_instr(module)
804822

823+
def searchpath_add(self, *dirs):
824+
if dirs:
825+
self._extra_module_paths += [('+', mp) for mp in dirs]
826+
827+
super().searchpath_add(*dirs)
828+
829+
def searchpath_remove(self, *dirs):
830+
if dirs:
831+
self._extra_module_paths += [('-', mp) for mp in dirs]
832+
833+
super().searchpath_remove(*dirs)
834+
805835

806836
class LModImpl(TMod4Impl):
807837
'''Module system for Lmod (Tcl/Lua).'''
@@ -836,6 +866,8 @@ def __init__(self):
836866
raise ConfigError('Python is not supported by '
837867
'this Lmod installation')
838868

869+
self._extra_module_paths = []
870+
839871
def name(self):
840872
return 'lmod'
841873

@@ -891,20 +923,6 @@ def conflicted_modules(self, module):
891923

892924
return ret
893925

894-
def load_module(self, module):
895-
if module.collection:
896-
self.execute('restore', str(module))
897-
return []
898-
else:
899-
return super().load_module(module)
900-
901-
def unload_module(self, module):
902-
if module.collection:
903-
# Module collection are not unloaded
904-
return
905-
906-
super().unload_module(module)
907-
908926
def unload_all(self):
909927
# Currently, we don't take any provision for sticky modules in Lmod, so
910928
# we forcefully unload everything.

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
importlib_metadata==2.0.0
22
jsonschema==3.2.0
3-
pytest==6.1.1
3+
pytest==6.2.0
44
pytest-forked==1.3.0
55
pytest-parallel==0.1.0
66
coverage==5.3

unittests/test_cli.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,22 @@ def test_performance_check_failure(run_reframe, tmp_path, perflogdir):
364364
'default' / 'PerformanceFailureCheck.log')
365365

366366

367-
def test_performance_report(run_reframe):
367+
def test_perflogdir_from_env(run_reframe, tmp_path, monkeypatch):
368+
monkeypatch.setenv('FOODIR', str(tmp_path / 'perflogs'))
368369
returncode, stdout, stderr = run_reframe(
370+
checkpath=['unittests/resources/checks/frontend_checks.py'],
371+
more_options=['-t', 'PerformanceFailureCheck'],
372+
perflogdir='$FOODIR'
373+
)
374+
assert returncode == 1
375+
assert 'Traceback' not in stdout
376+
assert 'Traceback' not in stderr
377+
assert os.path.exists(tmp_path / 'perflogs' / 'generic' /
378+
'default' / 'PerformanceFailureCheck.log')
379+
380+
381+
def test_performance_report(run_reframe):
382+
returncode, stdout, _ = run_reframe(
369383
checkpath=['unittests/resources/checks/frontend_checks.py'],
370384
more_options=['-t', 'PerformanceFailureCheck', '--performance-report']
371385
)
@@ -657,6 +671,7 @@ def test_unuse_module_path(run_reframe, user_exec_ctx):
657671
config_file=fixtures.USER_CONFIG_FILE, action='run',
658672
system=rt.runtime().system.name
659673
)
674+
ms.searchpath_remove(module_path)
660675
assert "could not load module 'testmod_foo' correctly" in stdout
661676
assert 'Traceback' not in stderr
662677
assert returncode == 0
@@ -673,7 +688,6 @@ def test_use_module_path(run_reframe, user_exec_ctx):
673688
config_file=fixtures.USER_CONFIG_FILE, action='run',
674689
system=rt.runtime().system.name
675690
)
676-
677691
assert 'Traceback' not in stdout
678692
assert 'Traceback' not in stderr
679693
assert "could not load module 'testmod_foo' correctly" not in stdout
@@ -694,7 +708,6 @@ def test_overwrite_module_path(run_reframe, user_exec_ctx):
694708
config_file=fixtures.USER_CONFIG_FILE, action='run',
695709
system=rt.runtime().system.name
696710
)
697-
698711
assert 'Traceback' not in stdout
699712
assert 'Traceback' not in stderr
700713
assert "could not load module 'testmod_foo' correctly" not in stdout

unittests/test_modules.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@
33
#
44
# SPDX-License-Identifier: BSD-3-Clause
55

6-
import abc
76
import os
87
import pytest
98

109
import reframe.core.environments as env
1110
import reframe.core.modules as modules
12-
import reframe.utility as util
13-
import reframe.utility.osext as osext
1411
import unittests.fixtures as fixtures
15-
from reframe.core.exceptions import (ConfigError, EnvironError)
16-
from reframe.core.runtime import runtime
12+
from reframe.core.exceptions import ConfigError, EnvironError
1713

1814

1915
@pytest.fixture(params=['tmod', 'tmod4', 'lmod', 'nomod'])
@@ -130,6 +126,18 @@ def test_module_load_force_collection(modules_system, module_collection):
130126
assert modules_system.is_module_loaded('testmod_foo')
131127

132128

129+
def test_module_load_collection_searchpath(modules_system, tmpdir,
130+
module_collection):
131+
p1 = str(tmpdir.mkdir('path1'))
132+
p2 = str(tmpdir.mkdir('path2'))
133+
modules_system.searchpath_add(p1)
134+
modules_system.searchpath_add(p2)
135+
modules_system.searchpath_remove(p1)
136+
modules_system.load_module(module_collection, collection=True)
137+
assert p1 not in modules_system.searchpath
138+
assert p2 in modules_system.searchpath
139+
140+
133141
def test_module_unload_all(modules_system):
134142
if modules_system.name == 'nomod':
135143
modules_system.unload_all()

unittests/test_utility.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,8 @@ def modules_system(user_exec_ctx, monkeypatch):
14141414

14151415
ms = rt.runtime().system.modules_system
14161416
ms.searchpath_add(fixtures.TEST_MODULES)
1417-
return ms
1417+
yield ms
1418+
ms.searchpath_remove(fixtures.TEST_MODULES)
14181419

14191420

14201421
def test_find_modules(modules_system):

0 commit comments

Comments
 (0)