From ac5e728731ed00cedfc1cca9fe14d6c26ad932f9 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Tue, 21 Aug 2018 08:26:50 +0200 Subject: [PATCH 1/2] Adapt netcdf tests to build systems --- .../libraries/io/netcdf_compile_run.py | 54 ++++++++----------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/cscs-checks/libraries/io/netcdf_compile_run.py b/cscs-checks/libraries/io/netcdf_compile_run.py index 7f39fabb39..c7cddf4142 100644 --- a/cscs-checks/libraries/io/netcdf_compile_run.py +++ b/cscs-checks/libraries/io/netcdf_compile_run.py @@ -1,51 +1,43 @@ import os -import reframe.utility.sanity as sn - -from reframe.core.pipeline import RegressionTest +import reframe as rfm +import reframe.utility.sanity as sn -class NetCDFTest(RegressionTest): - def __init__(self, lang, linkage, **kwargs): - super().__init__('netcdf_read_write_%s_%s' % (linkage, lang), - os.path.dirname(__file__), **kwargs) - self.flags = ' -%s ' % linkage - self.lang_names = { +@rfm.parameterized_test(*([lang, linkage] for lang in ['cpp', 'c', 'f90'] + for linkage in ['dynamic', 'static'])) +class NetCDFTest(rfm.RegressionTest): + def __init__(self, lang, linkage): + super().__init__() + lang_names = { 'c': 'C', 'cpp': 'C++', 'f90': 'Fortran 90' } - - self.descr = self.lang_names[lang] + ' NetCDF ' + linkage.capitalize() - self.sourcesdir = os.path.join(self.current_system.resourcesdir, - 'netcdf') - self.sourcepath = 'netcdf_read_write.' + lang + self.lang = lang + self.linkage = linkage + self.descr = lang_names[lang] + ' NetCDF ' + linkage.capitalize() self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc'] self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu', 'PrgEnv-intel', 'PrgEnv-pgi'] - + self.sourcesdir = os.path.join(self.current_system.resourcesdir, + 'netcdf') + self.build_system = 'SingleSource' + self.build_system.ldflags = ['-%s' % linkage] + self.sourcepath = 'netcdf_read_write.' + lang self.modules = ['cray-netcdf'] - self.sanity_patterns = sn.assert_found(r'SUCCESS', self.stdout) - self.num_tasks = 1 self.num_tasks_per_node = 1 + self.sanity_patterns = sn.assert_found(r'SUCCESS', self.stdout) self.maintainers = ['AJ', 'VK'] self.tags = {'production'} - def compile(self): - self.current_environ.cflags = self.flags - self.current_environ.cxxflags = self.flags - self.current_environ.fflags = self.flags - - super().compile() - - -def _get_checks(**kwargs): - ret = [] - for lang in ['cpp', 'c', 'f90']: - for linkage in ['dynamic', 'static']: - ret.append(NetCDFTest(lang, linkage, **kwargs)) + def setup(self, partition, environ, **job_opts): + # NOTE: Workaround to fix static linking for C++ with PrgEnv-pgi + if (environ.name == 'PrgEnv-pgi' and self.lang == 'cpp' + and self.linkage == 'static'): + self.build_system.ldflags += ['-lstdc++'] - return ret + super().setup(partition, environ, **job_opts) From e1fa212c0fadad4be6b3e1a931e89ac264177a6b Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Sat, 1 Sep 2018 15:29:54 +0200 Subject: [PATCH 2/2] Address PR comments --- cscs-checks/libraries/io/netcdf_compile_run.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cscs-checks/libraries/io/netcdf_compile_run.py b/cscs-checks/libraries/io/netcdf_compile_run.py index c7cddf4142..5991360947 100644 --- a/cscs-checks/libraries/io/netcdf_compile_run.py +++ b/cscs-checks/libraries/io/netcdf_compile_run.py @@ -36,8 +36,9 @@ def __init__(self, lang, linkage): def setup(self, partition, environ, **job_opts): # NOTE: Workaround to fix static linking for C++ with PrgEnv-pgi - if (environ.name == 'PrgEnv-pgi' and self.lang == 'cpp' - and self.linkage == 'static'): + if (environ.name == 'PrgEnv-pgi' and + self.lang == 'cpp'and + self.linkage == 'static'): self.build_system.ldflags += ['-lstdc++'] super().setup(partition, environ, **job_opts)