From 03fb4d26a9b7221bba8677b26575785123d6ef14 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Tue, 14 Aug 2018 13:39:08 +0200 Subject: [PATCH 1/3] Adapt cuda checks to build systems * Adapt cuda regression tests to build systems. * Change to new regression test syntax. --- cscs-checks/cuda/cuda_checks.py | 65 ++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/cscs-checks/cuda/cuda_checks.py b/cscs-checks/cuda/cuda_checks.py index 895ebd6b9c..3ec9fcb617 100644 --- a/cscs-checks/cuda/cuda_checks.py +++ b/cscs-checks/cuda/cuda_checks.py @@ -1,61 +1,69 @@ import os +import reframe as rfm import reframe.utility.sanity as sn -from reframe.core.pipeline import RegressionTest -class CudaCheck(RegressionTest): - def __init__(self, name, **kwargs): - super().__init__('cuda_%s_check' % name, - os.path.dirname(__file__), **kwargs) +class CudaCheck(rfm.RegressionTest): + def __init__(self, name): + super().__init__() + self.name = 'cuda_%s_check' % name self.valid_systems = ['daint:gpu', 'dom:gpu', 'kesch:cn'] self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu'] self.sourcesdir = os.path.join(self.current_system.resourcesdir, 'CUDA', 'essentials') self.modules = ['craype-accel-nvidia60'] - self.maintainers = ['AJ', 'VK'] self.num_gpus_per_node = 1 - self.tags = {'production'} - - def compile(self): - # Set nvcc flags - nvidia_sm = '60' + self.nvidia_sm = '60' if self.current_system.name == 'kesch': - nvidia_sm = '37' - self.current_environ.cxxflags = ('-ccbin g++ -m64 -lcublas ' - '-arch=sm_%s' % nvidia_sm) - super().compile() + self.nvidia_sm = '37' + self.maintainers = ['AJ', 'VK'] + self.tags = {'production'} + +@rfm.simple_test class MatrixmulCublasCheck(CudaCheck): - def __init__(self, **kwargs): - super().__init__('matrixmulcublas', **kwargs) + def __init__(self): + super().__init__('matrixmulcublas') self.descr = 'Implements matrix multiplication using CUBLAS' self.sourcepath = 'matrixmulcublas.cu' + self.build_system = 'SingleSource' + self.build_system.cxxflags = ['-I.', '-ccbin g++ -m64 -lcublas', + '-arch=sm_%s' % self.nvidia_sm] self.sanity_patterns = sn.assert_found( r'Comparing CUBLAS Matrix Multiply with CPU results: PASS', self.stdout) +@rfm.simple_test class DeviceQueryCheck(CudaCheck): - def __init__(self, **kwargs): - super().__init__('devicequery', **kwargs) + def __init__(self): + super().__init__('devicequery') self.descr = 'Queries the properties of the CUDA devices' self.sourcepath = 'devicequery.cu' + self.build_system = 'SingleSource' + self.build_system.cxxflags = ['-I.', '-ccbin g++ -m64 -lcublas', + '-arch=sm_%s' % self.nvidia_sm] self.sanity_patterns = sn.assert_found(r'Result = PASS', self.stdout) +@rfm.simple_test class ConcurrentKernelsCheck(CudaCheck): - def __init__(self, **kwargs): - super().__init__('concurrentkernels', **kwargs) + def __init__(self): + super().__init__('concurrentkernels') self.descr = 'Use of streams for concurrent execution' self.sourcepath = 'concurrentkernels.cu' + self.build_system = 'SingleSource' + self.build_system.cxxflags = ['-I.', '-ccbin g++ -m64 -lcublas', + '-arch=sm_%s' % self.nvidia_sm] self.sanity_patterns = sn.assert_found(r'Test passed', self.stdout) +@rfm.simple_test class SimpleMPICheck(CudaCheck): - def __init__(self, **kwargs): - super().__init__('simplempi', **kwargs) + def __init__(self): + super().__init__('simplempi') self.descr = 'Simple example demonstrating how to use MPI with CUDA' self.sourcesdir = os.path.join(self.current_system.resourcesdir, 'CUDA', 'simplempi') @@ -70,15 +78,12 @@ def __init__(self, **kwargs): else: self.variables = {'CRAY_CUDA_MPS': '1'} + self.build_system = 'Make' + self.build_system.cxxflags = ['-I.', '-ccbin g++ -m64 -lcublas', + '-arch=sm_%s' % self.nvidia_sm] + def setup(self, partition, environ, **job_opts): if (self.current_system.name == 'kesch' and environ.name == 'PrgEnv-gnu'): self.modules = ['mvapich2gdr_gnu/2.2_cuda_8.0'] super().setup(partition, environ, **job_opts) - - -def _get_checks(**kwargs): - return [ConcurrentKernelsCheck(**kwargs), - DeviceQueryCheck(**kwargs), - MatrixmulCublasCheck(**kwargs), - SimpleMPICheck(**kwargs)] From 7445ea77f47b61892a1cee24abd0f080b1f0a478 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Thu, 16 Aug 2018 13:28:58 +0200 Subject: [PATCH 2/3] Address PR comments --- cscs-checks/cuda/cuda_checks.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/cscs-checks/cuda/cuda_checks.py b/cscs-checks/cuda/cuda_checks.py index 3ec9fcb617..9c588a1785 100644 --- a/cscs-checks/cuda/cuda_checks.py +++ b/cscs-checks/cuda/cuda_checks.py @@ -5,9 +5,8 @@ class CudaCheck(rfm.RegressionTest): - def __init__(self, name): + def __init__(self): super().__init__() - self.name = 'cuda_%s_check' % name self.valid_systems = ['daint:gpu', 'dom:gpu', 'kesch:cn'] self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu'] self.sourcesdir = os.path.join(self.current_system.resourcesdir, @@ -23,9 +22,9 @@ def __init__(self, name): @rfm.simple_test -class MatrixmulCublasCheck(CudaCheck): +class CudaMatrixmulCublasCheck(CudaCheck): def __init__(self): - super().__init__('matrixmulcublas') + super().__init__() self.descr = 'Implements matrix multiplication using CUBLAS' self.sourcepath = 'matrixmulcublas.cu' self.build_system = 'SingleSource' @@ -37,9 +36,9 @@ def __init__(self): @rfm.simple_test -class DeviceQueryCheck(CudaCheck): +class CudaDeviceQueryCheck(CudaCheck): def __init__(self): - super().__init__('devicequery') + super().__init__() self.descr = 'Queries the properties of the CUDA devices' self.sourcepath = 'devicequery.cu' self.build_system = 'SingleSource' @@ -49,9 +48,9 @@ def __init__(self): @rfm.simple_test -class ConcurrentKernelsCheck(CudaCheck): +class CudaConcurrentKernelsCheck(CudaCheck): def __init__(self): - super().__init__('concurrentkernels') + super().__init__() self.descr = 'Use of streams for concurrent execution' self.sourcepath = 'concurrentkernels.cu' self.build_system = 'SingleSource' @@ -61,9 +60,9 @@ def __init__(self): @rfm.simple_test -class SimpleMPICheck(CudaCheck): +class CudaSimpleMPICheck(CudaCheck): def __init__(self): - super().__init__('simplempi') + super().__init__() self.descr = 'Simple example demonstrating how to use MPI with CUDA' self.sourcesdir = os.path.join(self.current_system.resourcesdir, 'CUDA', 'simplempi') From 67022983de175a24a9dbb196af80562697d1fbc7 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Thu, 23 Aug 2018 10:52:44 +0200 Subject: [PATCH 3/3] Use craype-accel-nvidia35 for kesch --- cscs-checks/cuda/cuda_checks.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cscs-checks/cuda/cuda_checks.py b/cscs-checks/cuda/cuda_checks.py index 9c588a1785..3f0f92f48e 100644 --- a/cscs-checks/cuda/cuda_checks.py +++ b/cscs-checks/cuda/cuda_checks.py @@ -11,7 +11,11 @@ def __init__(self): self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu'] self.sourcesdir = os.path.join(self.current_system.resourcesdir, 'CUDA', 'essentials') - self.modules = ['craype-accel-nvidia60'] + if self.current_system.name == 'kesch': + self.modules = ['craype-accel-nvidia35'] + else: + self.modules = ['craype-accel-nvidia60'] + self.num_gpus_per_node = 1 self.nvidia_sm = '60' if self.current_system.name == 'kesch':