Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 34 additions & 46 deletions cscs-checks/tools/profiling_and_debugging/ddt.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
import os

import reframe as rfm
import reframe.utility.sanity as sn

from reframe.core.launchers import LauncherWrapper
from reframe.core.pipeline import RegressionTest


class DdtCheck(RegressionTest):
def __init__(self, lang, extension, **kwargs):
super().__init__('ddt_check_' + lang.replace('+', 'p'),
os.path.dirname(__file__), **kwargs)
class DdtCheck(rfm.RegressionTest):
def __init__(self, lang, extension):
super().__init__()
self.name = 'DDtCheck_' + lang.replace('+', 'p')
self.descr = 'DDt Check for %s' % lang
self.lang = lang
self.extension = extension
self.makefile = 'Makefile'
self.build_system = 'Make'
# NOTE: Restrict concurrency to allow creation of Fortran modules
if lang == 'F90':
self.build_system.max_concurrency = 1

self.executable = './jacobi'
self.sourcesdir = os.path.join('src', lang)
self.valid_prog_environs = ['PrgEnv-gnu']
self.modules = ['ddt']
self.prgenv_flags = {
# 'PrgEnv-cray': ' -O2 -homp',
'PrgEnv-gnu': ' -O2 -fopenmp',
'PrgEnv-gnu': ['-g', '-O2', '-fopenmp'],
# 'PrgEnv-intel': ' -O2 -qopenmp',
# 'PrgEnv-pgi': ' -O2 -mp'
}
self.flags = ' -g'
self.num_tasks = 1
self.num_tasks_per_node = 1
self.num_cpus_per_task = 4
Expand All @@ -41,34 +46,27 @@ def __init__(self, lang, extension, **kwargs):
self.maintainers = ['MK', 'JG']
self.tags = {'production'}
self.post_run = ['ddt -V ; which ddt ;']
self.ddt_options = []
self.keep_files = ['ddtreport.txt']

def _set_compiler_flags(self):
prgenv_flags = self.prgenv_flags[self.current_environ.name]
self.current_environ.cflags = self.flags + prgenv_flags
self.current_environ.cxxflags = self.flags + prgenv_flags
self.current_environ.fflags = self.flags + prgenv_flags
self.current_environ.ldflags = self.flags + prgenv_flags

def compile(self, **job_opts):
self._set_compiler_flags()
super().compile(makefile=self.makefile, **job_opts)

def setup(self, partition, environ, **job_opts):
super().setup(partition, environ, **job_opts)
prgenv_flags = self.prgenv_flags[self.current_environ.name]
self.build_system.cflags = prgenv_flags
self.build_system.cxxflags = prgenv_flags
self.build_system.fflags = prgenv_flags
self.job.launcher = LauncherWrapper(self.job.launcher, 'ddt',
self.ddt_options)


@rfm.parameterized_test(['F90', 'F90'], ['C', 'c'], ['C++', 'cc'])
class DdtCpuCheck(DdtCheck):
def __init__(self, lang, extension, **kwargs):
super().__init__(lang, extension, **kwargs)
def __init__(self, lang, extension):
super().__init__(lang, extension)
self.valid_systems = ['daint:gpu', 'daint:mc',
'dom:gpu', 'dom:mc', 'kesch:cn']

if self.current_system.name == 'kesch' and self.lang == 'C':
self.flags += ' -lm '
self.build_system.ldflags = ['-lm']

residual_pattern = '_jacobi.%s:%d,residual'
self.ddt_options = [
Expand All @@ -89,17 +87,17 @@ def __init__(self, lang, extension, **kwargs):
])


@rfm.parameterized_test(['Cuda', 'cu'])
class DdtGpuCheck(DdtCheck):
def __init__(self, lang, extension, **kwargs):
super().__init__(lang, extension, **kwargs)
def __init__(self, lang, extension):
super().__init__(lang, extension)
self.valid_systems = ['daint:gpu', 'dom:gpu', 'kesch:cn']
self.num_gpus_per_node = 1
self.num_tasks_per_node = 1

self.system_modules = {
'daint': ['craype-accel-nvidia60'],
'dom': ['craype-accel-nvidia60',
'cudatoolkit/9.0.103_3.7-6.0.4.1_2.1__g72b395b'],
'dom': ['craype-accel-nvidia60'],
'kesch': ['cudatoolkit']
}
sysname = self.current_system.name
Expand All @@ -115,6 +113,15 @@ def __init__(self, lang, extension, **kwargs):
'--trace-at _jacobi-cuda-kernel.cu:111,residue'
]

self.build_system.cppflags = ['-DUSE_MPI', '-D_CSCS_ITMAX=5']

if self.current_system.name == 'kesch':
arch = 'sm_37'
self.build_system.ldflags = ['-lm', '-lcudart']
else:
arch = 'sm_60'
self.build_system.options = ['NVCCFLAGS="-g -arch=%s"' % arch]

self.sanity_patterns = sn.all([
sn.assert_found('MPI implementation', 'ddtreport.txt'),
sn.assert_found('Evaluate', 'ddtreport.txt'),
Expand All @@ -127,22 +134,3 @@ def __init__(self, lang, extension, **kwargs):
sn.assert_found(r'Every process in your program has terminated\.',
'ddtreport.txt')
])

def compile(self):
self.flags += ' -DUSE_MPI'
self.flags += ' -D_CSCS_ITMAX=5'

if self.current_system.name == 'kesch':
arch = 'sm_37'
self.flags += ' -lm -lcudart'
else:
arch = 'sm_60'
options = ' NVCCFLAGS="-g -arch=%s"' % arch
super().compile(options=options)


def _get_checks(**kwargs):
return [DdtCpuCheck('F90', 'F90', **kwargs),
DdtCpuCheck('C', 'c', **kwargs),
DdtCpuCheck('C++', 'cc', **kwargs),
DdtGpuCheck('Cuda', 'cu', **kwargs)]
17 changes: 0 additions & 17 deletions cscs-checks/tools/profiling_and_debugging/src/C++/Makefile_ddt

This file was deleted.

17 changes: 0 additions & 17 deletions cscs-checks/tools/profiling_and_debugging/src/C/Makefile_ddt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ LIB =
$(PREP) nvcc $(NVCCFLAGS) $(DDTFLAGS) -c $< -o $@

%.o: %.c
$(PREP) $(CC) $(CFLAGS) $(DDTFLAGS) -c $< -o $@
$(PREP) $(CC) $(CPPFLAGS) $(CFLAGS) $(DDTFLAGS) -c $< -o $@

$(EXECUTABLE): $(OBJS)
$(PREP) $(LD) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIB) -o $@
Expand Down
22 changes: 0 additions & 22 deletions cscs-checks/tools/profiling_and_debugging/src/Cuda/Makefile_ddt

This file was deleted.

17 changes: 0 additions & 17 deletions cscs-checks/tools/profiling_and_debugging/src/F90/Makefile_ddt

This file was deleted.