diff --git a/cscs-checks/libraries/io/hdf5_compile_run.py b/cscs-checks/libraries/io/hdf5_compile_run.py index c632966b3e..491c9868e6 100644 --- a/cscs-checks/libraries/io/hdf5_compile_run.py +++ b/cscs-checks/libraries/io/hdf5_compile_run.py @@ -7,7 +7,6 @@ for linkage in ['static', 'dynamic'])) class HDF5Test(rfm.RegressionTest): def __init__(self, lang, linkage): - super().__init__() lang_names = { 'c': 'C', 'f90': 'Fortran 90' @@ -20,6 +19,7 @@ def __init__(self, lang, linkage): 'PrgEnv-intel', 'PrgEnv-pgi'] self.modules = ['cray-hdf5'] self.keep_files = ['h5dump_out.txt'] + # C and Fortran write transposed matrix if lang == 'c': self.sanity_patterns = sn.all([ diff --git a/cscs-checks/libraries/io/netcdf_compile_run.py b/cscs-checks/libraries/io/netcdf_compile_run.py index 90eb9d97fd..9dcbbf297f 100644 --- a/cscs-checks/libraries/io/netcdf_compile_run.py +++ b/cscs-checks/libraries/io/netcdf_compile_run.py @@ -9,7 +9,6 @@ for linkage in ['dynamic', 'static'])) class NetCDFTest(rfm.RegressionTest): def __init__(self, lang, linkage): - super().__init__() lang_names = { 'c': 'C', 'cpp': 'C++', @@ -42,7 +41,9 @@ def __init__(self, lang, linkage): self.maintainers = ['AJ', 'SO'] self.tags = {'production', 'craype', 'external-resources'} - def setup(self, partition, environ, **job_opts): + @rfm.run_before('compile') + def setflags(self): + environ = self.current_environ if self.current_system.name == 'kesch': if environ.name == 'PrgEnv-cray-nompi': self.modules = ['netcdf/4.4.1.1-gmvolf-17.02', @@ -83,5 +84,3 @@ def setup(self, partition, environ, **job_opts): ] else: self.build_system.ldflags = ['-%s' % self.linkage] - - super().setup(partition, environ, **job_opts) diff --git a/cscs-checks/libraries/math/scalapack_compile_run.py b/cscs-checks/libraries/math/scalapack_compile_run.py index 5784ca3eac..75ec4a33b6 100644 --- a/cscs-checks/libraries/math/scalapack_compile_run.py +++ b/cscs-checks/libraries/math/scalapack_compile_run.py @@ -6,7 +6,6 @@ class ScaLAPACKTest(rfm.RegressionTest): def __init__(self, linkage): - super().__init__() self.sourcesdir = os.path.join(self.current_system.resourcesdir, 'scalapack') self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:mc', @@ -16,7 +15,6 @@ def __init__(self, linkage): self.num_tasks = 16 self.num_tasks_per_node = 8 self.variables = {'CRAYPE_LINK_TYPE': linkage} - if self.current_system.name == 'kesch': self.exclusive_access = True self.valid_prog_environs = ['PrgEnv-cray'] diff --git a/cscs-checks/libraries/petsc/petsc_helloworld.py b/cscs-checks/libraries/petsc/petsc_helloworld.py index 51ef917844..ff589b266c 100644 --- a/cscs-checks/libraries/petsc/petsc_helloworld.py +++ b/cscs-checks/libraries/petsc/petsc_helloworld.py @@ -5,28 +5,28 @@ @rfm.required_version('>=2.14') @rfm.parameterized_test(['dynamic'], ['static']) class PetscPoisson2DCheck(rfm.RegressionTest): - def __init__(self, variant): - super().__init__() + def __init__(self, linkage): self.descr = ('Compile/run PETSc 2D Poisson example with cray-petsc ' - '(%s linking)') % variant + '(%s linking)') % linkage self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc', 'tiger:gpu'] - self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu', - 'PrgEnv-intel'] + self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu'] + if linkage == 'dynamic': + # FIXME: static compilation yields a link error in case of + # PrgEnv-intel (Cray Bug #255701) + self.valid_prog_environs += ['PrgEnv-intel'] + self.sourcepath = 'poisson2d.c' self.modules = ['cray-petsc'] self.num_tasks = 16 self.num_tasks_per_node = 8 self.build_system = 'SingleSource' - if variant == 'dynamic': - self.build_system.cflags = ['-dynamic'] - + self.variables = {'CRAYPE_LINK_TYPE': linkage} self.executable_opts = ['-da_grid_x 4', '-da_grid_y 4', '-ksp_monitor'] # Check the final residual norm for convergence norm = sn.extractsingle(r'\s+\d+\s+KSP Residual norm\s+(?P\S+)', self.stdout, 'norm', float, -1) self.sanity_patterns = sn.assert_lt(norm, 1.0e-5) - self.tags = {'production', 'craype'} self.maintainers = ['AJ', 'CB'] diff --git a/cscs-checks/prgenv/helloworld.py b/cscs-checks/prgenv/helloworld.py index d7ad04c8fe..399ebbfb59 100644 --- a/cscs-checks/prgenv/helloworld.py +++ b/cscs-checks/prgenv/helloworld.py @@ -6,7 +6,6 @@ class HelloWorldBaseTest(rfm.RegressionTest): def __init__(self, variant, lang, linkage): - super().__init__() self.variables = {'CRAYPE_LINK_TYPE': linkage} self.prgenv_flags = {} self.lang_names = { @@ -36,62 +35,68 @@ def __init__(self, variant, lang, linkage): self.maintainers = ['VH', 'EK'] self.tags = {'production', 'craype'} - def setup(self, partition, environ, **job_opts): result = sn.findall(r'Hello World from thread \s*(\d+) out ' r'of \s*(\d+) from process \s*(\d+) out of ' r'\s*(\d+)', self.stdout) + num_tasks = sn.getattr(self, 'num_tasks') + num_cpus_per_task = sn.getattr(self, 'num_cpus_per_task') + + def tid(match): + return int(match.group(1)) + + def num_threads(match): + return int(match.group(2)) + + def rank(match): + return int(match.group(3)) + + def num_ranks(match): + return int(match.group(4)) + self.sanity_patterns = sn.all( - sn.chain([sn.assert_eq(sn.count(result), self.num_tasks * - self.num_cpus_per_task)], - sn.map( - lambda x: sn.assert_lt(int(x.group(1)), - int(x.group(2))), - result), - sn.map( - lambda x: sn.assert_lt(int(x.group(3)), - int(x.group(4))), - result), - sn.map( - lambda x: sn.assert_lt(int(x.group(1)), - self.num_cpus_per_task), - result), - sn.map( - lambda x: sn.assert_eq(int(x.group(2)), - self.num_cpus_per_task), - result), - sn.map( - lambda x: sn.assert_lt(int(x.group(3)), - self.num_tasks), - result), - sn.map( - lambda x: sn.assert_eq(int(x.group(4)), - self.num_tasks), - result), - ) + sn.chain( + [sn.assert_eq(sn.count(result), num_tasks*num_cpus_per_task)], + sn.map(lambda x: sn.assert_lt(tid(x), num_threads(x)), result), + sn.map(lambda x: sn.assert_lt(rank(x), num_ranks(x)), result), + sn.map( + lambda x: sn.assert_lt(tid(x), num_cpus_per_task), result + ), + sn.map( + lambda x: sn.assert_eq(num_threads(x), num_cpus_per_task), + result + ), + sn.map(lambda x: sn.assert_lt(rank(x), num_tasks), result), + sn.map( + lambda x: sn.assert_eq(num_ranks(x), num_tasks), result + ), + ) ) - self.perf_patterns = { 'compilation_time': sn.getattr(self, 'compilation_time_seconds') } self.reference = { '*': { - 'compilation_time': (60, None, 0.1) + 'compilation_time': (60, None, 0.1, 's') } } - envname = environ.name.replace('-nompi', '') + @rfm.run_before('compile') + def setflags(self): + envname = self.current_environ.name.replace('-nompi', '') prgenv_flags = self.prgenv_flags[envname] self.build_system.cflags = prgenv_flags self.build_system.cxxflags = prgenv_flags self.build_system.fflags = prgenv_flags - super().setup(partition, environ, **job_opts) - def compile(self): + @rfm.run_before('compile') + def compile_timer_start(self): self.compilation_time_seconds = datetime.now() - super().compile() - self.compilation_time_seconds = ( - datetime.now() - self.compilation_time_seconds).total_seconds() + + @rfm.run_after('compile') + def compile_timer_end(self): + elapsed = datetime.now() - self.compilation_time_seconds + self.compilation_time_seconds = elapsed.total_seconds() @rfm.required_version('>=2.14') @@ -99,8 +104,8 @@ def compile(self): for lang in ['cpp', 'c', 'f90'] for linkage in ['dynamic', 'static'])) class HelloWorldTestSerial(HelloWorldBaseTest): - def __init__(self, lang, linkage, **kwargs): - super().__init__('serial', lang, linkage, **kwargs) + def __init__(self, lang, linkage): + super().__init__('serial', lang, linkage) self.valid_systems += ['kesch:pn'] self.sourcepath += '_serial.' + lang self.descr += ' Serial ' + linkage.capitalize()