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
73 changes: 39 additions & 34 deletions cscs-checks/tools/profiling_and_debugging/perftools.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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 PerftoolsCheck(RegressionTest):
def __init__(self, lang, **kwargs):
super().__init__('perftools_check_' + lang.replace('+', 'p'),
os.path.dirname(__file__), **kwargs)
@rfm.parameterized_test(*([lang] for lang in ['C', 'Cpp', 'F90', 'Cuda']))
class PerftoolsCheck(rfm.RegressionTest):
def __init__(self, lang):
super().__init__()
if lang == 'Cuda':
self.valid_systems = ['daint:gpu', 'dom:gpu']
else:
Expand All @@ -22,48 +22,53 @@ def __init__(self, lang, **kwargs):
# FIXME: PGI Fortran is hanging after completion
self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu']

# NOTE: Reduce time limit because for PrgEnv-pgi even if the output
# is correct, the batch job uses all the time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we open a ticket to ops for that?

Copy link
Contributor

@kraushm kraushm Sep 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgphpc also suggested earlier today to open a ticket. (yet, I could imagine he meant the tools-rt and not immediately ops)

self.time_limit = (0, 1, 0)

self.num_gpus_per_node = 1
self.executable = 'perftools_check'

self.prgenv_flags = {
'PrgEnv-cray': ' -h nomessage=3140 -homp ',
'PrgEnv-gnu': ' -fopenmp ',
'PrgEnv-intel': ' -openmp ',
'PrgEnv-pgi': ' -mp ',
'PrgEnv-cray': ['-g', '-h nomessage=3140', '-homp'],
'PrgEnv-gnu': ['-g', '-fopenmp'],
'PrgEnv-intel': ['-g', '-openmp'],
'PrgEnv-pgi': ['-g', '-mp']
}

if self.current_system.name == 'kesch':
# `-lcudart -lm` must be passed explicitly on kesch
self.prgenv_flags['PrgEnv-gnu'] = ' -fopenmp -lcudart -lm '
self.prgenv_flags['PrgEnv-gnu'] = ['-fopenmp', '-lcudart', '-lm']

self.sanity_patterns = sn.assert_found('Table 1: Profile by Function',
self.stdout)
self.modules = ['perftools-base', 'perftools-lite', 'cudatoolkit']
self.makefile = 'Makefile_perftools'
self.sourcesdir = os.path.join('src', lang)
self.maintainers = ['MK', 'JG']
self.tags = {'production'}

self.modules = ['perftools-lite', 'craype-accel-nvidia60']
self.build_system = 'Make'
self.build_system.makefile = 'Makefile_perftools'
self.build_system.cppflags = ['-D_CSCS_ITMAX=1', '-DUSE_MPI']
self.build_system.options = ['NVCCFLAGS="-arch=sm_60"']

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

if lang != 'Cuda':
self.num_tasks_per_node = 2
self.variables = {'OMP_NUM_THREADS': '2'}
else:
self.num_tasks_per_node = 1

def compile(self):
self.flags = ' -g -D_CSCS_ITMAX=1 -DUSE_MPI '
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
super().compile(makefile=self.makefile,
options='NVCCFLAGS="-arch=sm_60"')


def _get_checks(**kwargs):
ret = []
for lang in ['C', 'C++', 'F90', 'Cuda']:
ret.append(PerftoolsCheck(lang, **kwargs))
self.maintainers = ['MK', 'JG']
self.tags = {'production'}

return ret
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.build_system.ldflags = flags
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LIB =
.SUFFIXES: .o .cc

%.o: %.cc
$(CXX) $(CXXFLAGS) -c $< -o $(PE_ENV)$@
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $(PE_ENV)$@

perftools_check: $(OBJ)
$(LD) $(LDFLAGS) $(OBJ2) $(LIB) -o $@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LIB =
.SUFFIXES: .o .c

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

perftools_check: $(OBJ)
$(LD) $(LDFLAGS) $(OBJ2) $(LIB) -o $@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LIB =
.SUFFIXES: .o .c

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

perftools_check: $(OBJ)
$(LD) $(LDFLAGS) $(OBJ2) $(LIB) -o $@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LIB =
.SUFFIXES: .o .F90

%.o: %.F90
$(FC) $(FFLAGS) -c $< -o $(PE_ENV)$@
$(FC) $(CPPFLAGS) $(FFLAGS) -c $< -o $(PE_ENV)$@

perftools_check: $(OBJ)
$(LD) $(LDFLAGS) $(OBJ2) $(LIB) -o $@
Expand Down