From ab57d42b5964831daa617327996fc9ee2785a493 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Tue, 31 Jul 2018 09:22:02 +0200 Subject: [PATCH] Adapt nvprof test to PE 18.07 * Use new build system feature * Use new syntax for test --- .../tools/profiling_and_debugging/nvprof.py | 58 +++++++++---------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/cscs-checks/tools/profiling_and_debugging/nvprof.py b/cscs-checks/tools/profiling_and_debugging/nvprof.py index c01961344f..4df31f1f01 100644 --- a/cscs-checks/tools/profiling_and_debugging/nvprof.py +++ b/cscs-checks/tools/profiling_and_debugging/nvprof.py @@ -1,47 +1,43 @@ -import os +import reframe as rfm import reframe.utility.sanity as sn -from reframe.core.pipeline import RegressionTest - -class NvprofCheck(RegressionTest): - def __init__(self, **kwargs): - super().__init__('nvprof_check', - os.path.dirname(__file__), **kwargs) +@rfm.simple_test +class NvprofCheck(rfm.RegressionTest): + def __init__(self): + super().__init__() self.descr = 'Checks the nvprof tool' self.valid_systems = ['daint:gpu', 'dom:gpu', 'kesch:cn'] self.valid_prog_environs = ['PrgEnv-gnu'] - self.num_gpus_per_node = 1 - self.num_tasks_per_node = 1 + self.num_gpus_per_node = 1 + self.num_tasks_per_node = 1 self.sourcesdir = 'src/Cuda' self.executable = 'nvprof' - self.executable_opts = [os.path.join('.', self.name)] + self.executable_opts = ['./nvprof_check'] self.sanity_patterns = sn.all([ sn.assert_found('Profiling application: ./nvprof_check', - 'nvprof_check.err'), - sn.assert_found('[CUDA memcpy HtoD]', 'nvprof_check.err'), - sn.assert_found('[CUDA memcpy DtoH]', 'nvprof_check.err'), - sn.assert_found(r'\s+100(\s+\S+){3}\s+jacobi_kernel', - 'nvprof_check.err') + self.stderr), + sn.assert_found('[CUDA memcpy HtoD]', self.stderr), + sn.assert_found('[CUDA memcpy DtoH]', self.stderr), + sn.assert_found(r'\s+100(\s+\S+){3}\s+jacobi_kernel', self.stderr) ]) - self.modules = ['cudatoolkit'] - self.makefile = 'Makefile_nvprof' - self.maintainers = ['MK', 'JG'] - self.tags = {'production'} - def compile(self): - self.current_environ.cflags = ('-g -D_CSCS_ITMAX=100' - ' -DOMP_MEMLOCALITY -DUSE_MPI' - ' -DEVS_PER_NODE=1 -fopenmp -std=c99') - self.current_environ.cxxflags = '-g -G' - self.current_environ.ldflags = '-g -fopenmp -std=c99' + self.build_system = 'Make' + self.build_system.makefile = 'Makefile_nvprof' + self.build_system.cflags = [ + '-g', '-D_CSCS_ITMAX=100', '-DOMP_MEMLOCALITY', '-DUSE_MPI', + '-DEVS_PER_NODE=1', '-fopenmp', '-std=c99' + ] + self.build_system.cxxflags = ['-g', '-G'] + self.build_system.ldflags = ['-g', '-fopenmp', '-std=c99'] + # FIXME temporary workaround # the programming environment should be adapted / fixed if self.current_system.name == 'kesch': - self.current_environ.ldflags += ' -lcudart -lm' + self.modules = ['cudatoolkit'] + self.build_system.ldflags += ['-lcudart', '-lm'] + else: + self.modules = ['craype-accel-nvidia60'] - super().compile(makefile=self.makefile) - - -def _get_checks(**kwargs): - return [NvprofCheck(**kwargs)] + self.maintainers = ['MK', 'JG'] + self.tags = {'production'}