Skip to content

Commit

Permalink
Merge pull request #186 from teojgo/test/ior_check_update
Browse files Browse the repository at this point in the history
[test] Update the IOR check to fetch source from GitHub
  • Loading branch information
teojgo authored Apr 17, 2024
2 parents 17072ae + f6744af commit a044288
Showing 1 changed file with 63 additions and 26 deletions.
89 changes: 63 additions & 26 deletions checks/system/io/ior_check.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2023 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# Copyright 2016 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
Expand All @@ -10,16 +10,62 @@
import reframe.utility.sanity as sn


class IorCheck(rfm.RegressionTest):
class fetch_ior_benchmarks(rfm.RunOnlyRegressionTest):
descr = 'Fetch IOR benchmarks'
version = variable(str, value='4.0.0')
executable = 'wget'
executable_opts = [
f'https://github.com/hpc/ior/releases/download/{version}/ior-{version}.tar.gz' # noqa: E501
]

@sanity_function
def validate_download(self):
return sn.assert_eq(self.job.exitcode, 0)


class build_ior_benchmarks(rfm.CompileOnlyRegressionTest):
descr = 'Build IOR benchmarks'
build_system = 'Autotools'
build_prefix = variable(str)
ior_benchmarks = fixture(fetch_ior_benchmarks, scope='session')

# Build on the remote system for consistency
build_locally = False

@run_after('init')
def load_cray_module(self):
if self.current_system.name in ['eiger', 'pilatus']:
self.modules = ['cray']

@run_before('compile')
def prepare_build(self):
tarball = f'ior-{self.ior_benchmarks.version}.tar.gz'
self.build_prefix = tarball[:-7]
fullpath = os.path.join(self.ior_benchmarks.stagedir, tarball)
self.prebuild_cmds = [
f'cp {fullpath} {self.stagedir}',
f'tar xzf {tarball}',
f'cd {self.build_prefix}'
]

# FIXME this will not be needed in a ReFrame release including:
# https://github.com/reframe-hpc/reframe/pull/3157
@sanity_function
def validate_build(self):
return True


class IorCheck(rfm.RunOnlyRegressionTest):
base_dir = parameter(['/capstor/scratch/cscs',
'/scratch/snx3000tds',
'/scratch/snx3000',
'/scratch/shared/fulen',
'/users'])
username = getpass.getuser()
time_limit = '5m'
maintainers = ['SO', 'GLR']
tags = {'ops', 'production', 'external-resources'}
ior_binaries = fixture(build_ior_benchmarks, scope='environment')
maintainers = ['SO', 'TM']
tags = {'ops', 'production'}

@run_after('init')
def set_description(self):
Expand Down Expand Up @@ -108,20 +154,11 @@ def set_valid_systems(self):
self.num_tasks = self.fs[self.base_dir][cur_sys].get('num_tasks', 1)
self.num_tasks_per_node = tpn

self.sourcesdir = os.path.join(self.current_system.resourcesdir, 'IOR')

@run_after('init')
def load_cray_module(self):
if self.current_system.name in ['eiger', 'pilatus']:
self.modules = ['cray']

@run_before('compile')
def prepare_build(self):
self.build_system = 'Make'
self.build_system.options = ['posix', 'mpiio']
self.build_system.max_concurrency = 1
self.num_gpus_per_node = 0

@run_before('run')
def prepare_run(self):
# Default umask is 0022, which generates file permissions -rw-r--r--
Expand All @@ -131,30 +168,34 @@ def prepare_run(self):
test_file = os.path.join(test_dir,
f'.ior.{self.current_partition.name}')
self.prerun_cmds = [f'mkdir -p {test_dir}']
self.executable = os.path.join('src', 'C', 'IOR')
self.executable = os.path.join(
self.ior_binaries.stagedir,
self.ior_binaries.build_prefix,
'src', 'ior'
)

# executable options depends on the file system
block_size = self.fs[self.base_dir]['ior_block_size']
access_type = self.fs[self.base_dir]['ior_access_type']
self.executable_opts = ['-B', '-F', '-C ', '-Q 1', '-t 4m', '-D 30',
self.executable_opts = ['-F', '-C ', '-Q 1', '-t 4m', '-D 30',
'-b', block_size, '-a', access_type,
'-o', test_file]
'-o', test_file, '--posix.odirect']

@sanity_function
def assert_finished(self):
return sn.assert_found(r'^Finished\s+:', self.stdout)


@rfm.simple_test
class IorWriteCheck(IorCheck):
executable_opts += ['-w', '-k']
tags |= {'write'}

@sanity_function
def assert_output(self):
return sn.assert_found(r'^Max Write: ', self.stdout)

@run_after('init')
def set_perf_patterns(self):
self.perf_patterns = {
'write_bw': sn.extractsingle(
r'^Max Write:\s+(?P<write_bw>\S+) MiB/sec', self.stdout,
r'^Operation(.*\n)*^write\s+(?P<write_bw>\S+)', self.stdout,
'write_bw', float)
}

Expand All @@ -164,15 +205,11 @@ class IorReadCheck(IorCheck):
executable_opts += ['-r']
tags |= {'read'}

@sanity_function
def assert_output(self):
return sn.assert_found(r'^Max Read: ', self.stdout)

@run_after('init')
def set_perf_patterns(self):
self.perf_patterns = {
'read_bw': sn.extractsingle(
r'^Max Read:\s+(?P<read_bw>\S+) MiB/sec', self.stdout,
r'^Operation(.*\n)*^read\s+(?P<read_bw>\S+)', self.stdout,
'read_bw', float)
}

Expand Down

0 comments on commit a044288

Please sign in to comment.