From b10a0a4d586e8b7c1010861b62b4e588f499410a Mon Sep 17 00:00:00 2001 From: jgp Date: Mon, 4 Feb 2019 19:23:12 +0100 Subject: [PATCH 1/5] gperftools --- .../profiling_and_debugging/gperftools.py | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 cscs-checks/tools/profiling_and_debugging/gperftools.py diff --git a/cscs-checks/tools/profiling_and_debugging/gperftools.py b/cscs-checks/tools/profiling_and_debugging/gperftools.py new file mode 100644 index 0000000000..55a5f8ddd0 --- /dev/null +++ b/cscs-checks/tools/profiling_and_debugging/gperftools.py @@ -0,0 +1,70 @@ +import os + +import reframe as rfm +import reframe.utility.sanity as sn + + +@rfm.required_version('>=2.14') +@rfm.parameterized_test(*([lang] for lang in ['C', 'Cpp', 'F90'])) +class GperftoolsCheck(rfm.RegressionTest): + def __init__(self, lang): + super().__init__() + self.valid_systems = ['daint:gpu', 'dom:gpu', + 'daint:mc', 'dom:mc'] + + self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu', + 'PrgEnv-intel', 'PrgEnv-pgi'] + + # NOTE: Reduce time limit because for PrgEnv-pgi even if the output + # is correct, the batch job uses all the time. + self.time_limit = (0, 1, 0) + + self.num_gpus_per_node = 1 + self.executable = 'perftools_check' + self.prgenv_flags = { + 'PrgEnv-cray': ['-g', '-h nomessage=3140', '-homp'], + 'PrgEnv-gnu': ['-g', '-fopenmp'], + 'PrgEnv-intel': ['-g', '-openmp'], + 'PrgEnv-pgi': ['-g', '-mp'] + } + + self.rpt_file = 'gperftools.rpt' + self.rpt_file_txt = '%s.txt' % self.rpt_file + self.sanity_patterns = sn.all([ + sn.assert_found('SUCCESS', self.stdout), + sn.assert_found(r'^Total:\s\d+\ssamples', self.rpt_file_txt), + ]) + + self.modules = ['gperftools'] + self.build_system = 'Make' + self.build_system.makefile = 'Makefile_perftools' + self.build_system.cppflags = ['-D_CSCS_ITMAX=1', '-DUSE_MPI'] + + if lang == 'Cpp': + self.sourcesdir = os.path.join('src', 'C++') + else: + self.sourcesdir = os.path.join('src', lang) + + # NOTE: Restrict concurrency to allow creation of Fortran modules + if lang == 'F90': + self.build_system.max_concurrency = 1 + + self.num_tasks_per_node = 2 + self.maintainers = ['MK', 'JG'] + self.tags = {'production'} + self.variables = { + 'OMP_NUM_THREADS': '2', + 'CPUPROFILE': self.rpt_file, + } + self.post_run = [ + 'pprof --text ./perftools_check $CPUPROFILE &> %s' % self.rpt_file_txt + ] + + def setup(self, environ, partition, **job_opts): + super().setup(environ, partition, **job_opts) + flags = self.prgenv_flags[self.current_environ.name] + self.build_system.cflags = flags + self.build_system.cxxflags = flags + self.build_system.fflags = flags + self.ldflags = [' -dynamic `pkg-config --libs libprofiler`'] + self.build_system.ldflags = flags + self.ldflags From 9238a8f5544a3765ca17459fb1ebc5510778e5da Mon Sep 17 00:00:00 2001 From: jgp Date: Mon, 4 Feb 2019 19:25:32 +0100 Subject: [PATCH 2/5] pep8 --- cscs-checks/tools/profiling_and_debugging/gperftools.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cscs-checks/tools/profiling_and_debugging/gperftools.py b/cscs-checks/tools/profiling_and_debugging/gperftools.py index 55a5f8ddd0..122fb78a47 100644 --- a/cscs-checks/tools/profiling_and_debugging/gperftools.py +++ b/cscs-checks/tools/profiling_and_debugging/gperftools.py @@ -57,7 +57,8 @@ def __init__(self, lang): 'CPUPROFILE': self.rpt_file, } self.post_run = [ - 'pprof --text ./perftools_check $CPUPROFILE &> %s' % self.rpt_file_txt + 'pprof --text ./perftools_check $CPUPROFILE &> %s' + % self.rpt_file_txt ] def setup(self, environ, partition, **job_opts): From 1f984403b20bab16bc63a797b39e69c8713f71cb Mon Sep 17 00:00:00 2001 From: jgp Date: Tue, 5 Feb 2019 10:18:13 +0100 Subject: [PATCH 3/5] pep --- cscs-checks/tools/profiling_and_debugging/gperftools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cscs-checks/tools/profiling_and_debugging/gperftools.py b/cscs-checks/tools/profiling_and_debugging/gperftools.py index 122fb78a47..7f413218df 100644 --- a/cscs-checks/tools/profiling_and_debugging/gperftools.py +++ b/cscs-checks/tools/profiling_and_debugging/gperftools.py @@ -58,7 +58,7 @@ def __init__(self, lang): } self.post_run = [ 'pprof --text ./perftools_check $CPUPROFILE &> %s' - % self.rpt_file_txt + % self.rpt_file_txt ] def setup(self, environ, partition, **job_opts): From 70bb7ad6c774c66f945b0ef128f8a1562a9c7339 Mon Sep 17 00:00:00 2001 From: jgp Date: Mon, 11 Feb 2019 17:09:52 +0100 Subject: [PATCH 4/5] checking daint is enough --- cscs-checks/tools/profiling_and_debugging/gperftools.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cscs-checks/tools/profiling_and_debugging/gperftools.py b/cscs-checks/tools/profiling_and_debugging/gperftools.py index 7f413218df..76a38827fb 100644 --- a/cscs-checks/tools/profiling_and_debugging/gperftools.py +++ b/cscs-checks/tools/profiling_and_debugging/gperftools.py @@ -9,16 +9,11 @@ class GperftoolsCheck(rfm.RegressionTest): def __init__(self, lang): super().__init__() - self.valid_systems = ['daint:gpu', 'dom:gpu', - 'daint:mc', 'dom:mc'] + self.valid_systems = ['daint:gpu', 'daint:mc'] self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu', 'PrgEnv-intel', 'PrgEnv-pgi'] - # NOTE: Reduce time limit because for PrgEnv-pgi even if the output - # is correct, the batch job uses all the time. - self.time_limit = (0, 1, 0) - self.num_gpus_per_node = 1 self.executable = 'perftools_check' self.prgenv_flags = { From d91617df54a9965016d10d7da1798ffc6ac689e5 Mon Sep 17 00:00:00 2001 From: jgp Date: Tue, 12 Feb 2019 09:08:38 +0100 Subject: [PATCH 5/5] https://github.com/eth-cscs/reframe/pull/670#pullrequestreview-202523146 --- cscs-checks/tools/profiling_and_debugging/gperftools.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cscs-checks/tools/profiling_and_debugging/gperftools.py b/cscs-checks/tools/profiling_and_debugging/gperftools.py index 76a38827fb..7b331a0269 100644 --- a/cscs-checks/tools/profiling_and_debugging/gperftools.py +++ b/cscs-checks/tools/profiling_and_debugging/gperftools.py @@ -10,10 +10,8 @@ class GperftoolsCheck(rfm.RegressionTest): def __init__(self, lang): super().__init__() self.valid_systems = ['daint:gpu', 'daint:mc'] - self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu', 'PrgEnv-intel', 'PrgEnv-pgi'] - self.num_gpus_per_node = 1 self.executable = 'perftools_check' self.prgenv_flags = { @@ -62,5 +60,5 @@ def setup(self, environ, partition, **job_opts): self.build_system.cflags = flags self.build_system.cxxflags = flags self.build_system.fflags = flags - self.ldflags = [' -dynamic `pkg-config --libs libprofiler`'] - self.build_system.ldflags = flags + self.ldflags + self.build_system.ldflags = flags + ['-dynamic', + '`pkg-config --libs libprofiler`']