Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarak committed Jan 27, 2023
2 parents 0fbffce + def32e3 commit 706b6c9
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ci-scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ tmpdir=$(mktemp -d)
echo "Deploying ReFrame version $version ..."
echo "Working directory: $tmpdir ..."
cd $tmpdir
git clone https://${_gh_creds_prefix}github.com/reframe-hpc/reframe.git
git clone --branch master https://${_gh_creds_prefix}github.com/reframe-hpc/reframe.git
cd reframe
./bootstrap.sh
found_version=$(./bin/reframe -V | sed -e 's/\(.*\)\+.*/\1/g')
Expand Down
2 changes: 1 addition & 1 deletion hpctestlib/microbenchmarks/mpi/osu.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class osu_benchmark(rfm.RunOnlyRegressionTest):
('mpi.pt2pt.osu_latency', 'latency')
], fmt=lambda x: x[0], loggable=True)

@run_after('init')
@run_before('setup')
def setup_per_benchmark(self):
bench, bench_metric = self.benchmark_info
if bench_metric == 'latency':
Expand Down
2 changes: 1 addition & 1 deletion reframe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
import sys

VERSION = '4.1.0-dev.1'
VERSION = '4.1.0-dev.2'
INSTALL_PREFIX = os.path.normpath(
os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
)
Expand Down
5 changes: 2 additions & 3 deletions reframe/core/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ def _update_check_extras(self):
)

def log_performance(self, level, task, msg=None, multiline=False):
if self.extra['__rfm_check__'] is None:
if self.check is None or not self.check.is_performance_check():
return

self.extra['check_partition'] = task.testcase.partition.name
Expand All @@ -737,8 +737,7 @@ def log_performance(self, level, task, msg=None, multiline=False):

if multiline:
# Log one record for each performance variable
check = self.extra['__rfm_check__']
for var, info in check.perfvalues.items():
for var, info in self.check.perfvalues.items():
val, ref, lower, upper, unit = info
self.extra['check_perf_var'] = var.split(':')[-1]
self.extra['check_perf_value'] = val
Expand Down
2 changes: 1 addition & 1 deletion reframe/frontend/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ def print_infoline(param, value):
elif len(optstr) == 1:
parsed_job_options.append(f'-{optstr} {valstr}')
else:
parsed_job_options.append(f'--{optstr} {valstr}')
parsed_job_options.append(f'--{optstr}={valstr}')

# Locate and load checks; `force=True` is not needed for normal
# invocations from the command line and has practically no effect, but
Expand Down
4 changes: 1 addition & 3 deletions reframe/frontend/executors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,7 @@ def sanity(self):

@logging.time_function
def performance(self):
if self.check.is_performance_check():
self._perflogger = logging.getperflogger(self.check)

self._perflogger = logging.getperflogger(self.check)
self._safe_call(self.check.performance)

@logging.time_function
Expand Down
3 changes: 1 addition & 2 deletions reframe/frontend/executors/policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,6 @@ def _advance_running(self, task):
return 1
else:
return 0

except TaskExit:
self._partition_tasks[partname].remove(task)
self._current_tasks.remove(task)
Expand All @@ -530,9 +529,9 @@ def _advance_completing(self, task):
task.finalize()
self._retired_tasks.append(task)
self._current_tasks.remove(task)
return 1
except TaskExit:
self._current_tasks.remove(task)
finally:
return 1

def deps_failed(self, task):
Expand Down
6 changes: 4 additions & 2 deletions reframe/frontend/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,15 @@ def _fn(case):

def have_gpu_only():
def _fn(case):
return case.check.num_gpus_per_node > 0
# NOTE: This takes into account num_gpus_per_node being None
return case.check.num_gpus_per_node

return _fn


def have_cpu_only():
def _fn(case):
return case.check.num_gpus_per_node == 0
# NOTE: This takes into account num_gpus_per_node being None
return not case.check.num_gpus_per_node

return _fn
1 change: 0 additions & 1 deletion unittests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class _X(rfm.RegressionTest):
maintainers=['A', 'B', 'C', 'D']),
make_case(_X, alt_name='check2',
tags={'x', 'y', 'z'},
num_gpus_per_node=0,
maintainers=['X', 'Y', 'Z']),
make_case(_X, alt_name='check3',
tags={'a', 'z'},
Expand Down
49 changes: 49 additions & 0 deletions unittests/test_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,29 @@ def perf0(self):
return _MyFailingTest()


@pytest.fixture
def lazy_perf_test():
class _LazyPerfTest(rfm.RunOnlyRegressionTest):
valid_systems = ['*']
valid_prog_environs = ['*']
executable = 'echo perf0=100'

@sanity_function
def validate(self):
return True

@run_before('performance')
def set_perf_vars(self):
self.perf_variables = {
'perf0': sn.make_performance_function(
sn.extractsingle(r'perf0=(\S+)', self.stdout, 1, float),
'unit0'
)
}

return _LazyPerfTest()


@pytest.fixture
def simple_test():
class _MySimpleTest(rfm.RunOnlyRegressionTest):
Expand Down Expand Up @@ -1240,3 +1263,29 @@ def test_perf_logging_multiline(make_runner, make_exec_ctx, perf_test,
lines = fp.readlines()
assert ',perf0=100.0,unit0' in lines[1]
assert ',perf1=50.0,unit1' in lines[2]


def test_perf_logging_lazy(make_runner, make_exec_ctx, lazy_perf_test,
config_perflog, tmp_path):
make_exec_ctx(
config_perflog(
fmt=(
'%(check_job_completion_time)s,%(version)s,'
'%(check_display_name)s,%(check_system)s,'
'%(check_partition)s,%(check_environ)s,'
'%(check_jobid)s,%(check_result)s,%(check_perfvalues)s'
),
perffmt=(
'%(check_perf_value)s,%(check_perf_unit)s,'
'%(check_perf_ref)s,%(check_perf_lower)s,'
'%(check_perf_upper)s,'
)
)
)
logging.configure_logging(rt.runtime().site_config)
runner = make_runner()
testcases = executors.generate_testcases([lazy_perf_test])
runner.runall(testcases)

logfile = tmp_path / 'perflogs' / 'generic' / 'default' / '_LazyPerfTest.log'
assert os.path.exists(logfile)

0 comments on commit 706b6c9

Please sign in to comment.