diff --git a/cscs-checks/microbenchmarks/osu/osu_tests.py b/cscs-checks/microbenchmarks/osu/osu_tests.py index 761b2e8ef0..a9d8449100 100644 --- a/cscs-checks/microbenchmarks/osu/osu_tests.py +++ b/cscs-checks/microbenchmarks/osu/osu_tests.py @@ -1,17 +1,16 @@ -import os -import itertools +import reframe as rfm import reframe.utility.sanity as sn -from reframe.core.pipeline import RegressionTest - -class AlltoallBaseTest(RegressionTest): - def __init__(self, name, **kwargs): - super().__init__(name, - os.path.dirname(__file__), **kwargs) +@rfm.parameterized_test(['production']) +class AlltoallTest(rfm.RegressionTest): + def __init__(self, variant): + super().__init__() self.strict_check = False self.valid_systems = ['daint:gpu', 'dom:gpu'] self.descr = 'Alltoall osu microbenchmark' + self.build_system = 'Make' + self.build_system.makefile = 'Makefile_alltoall' self.executable = './osu_alltoall' # The -x option controls the number of warm-up iterations # The -i option controls the number of iterations @@ -24,6 +23,15 @@ def __init__(self, name, **kwargs): 'perf': sn.extractsingle(r'^8\s+(?P\S+)', self.stdout, 'perf', float) } + self.tags = {variant} + self.reference = { + 'dom:gpu': { + 'perf': (8.23, None, 0.1) + }, + 'daint:gpu': { + 'perf': (20.73, None, 2.0) + }, + } self.num_tasks_per_node = 1 self.num_gpus_per_node = 1 if self.current_system.name == 'dom': @@ -38,28 +46,11 @@ def __init__(self, name, **kwargs): } } - def compile(self): - super().compile(makefile='Makefile_alltoall') - -class AlltoallProdTest(AlltoallBaseTest): - def __init__(self, **kwargs): - super().__init__('alltoall_osu_microbenchmark', **kwargs) - self.tags = {'production'} - self.reference = { - 'dom:gpu': { - 'perf': (8.23, None, 0.1) - }, - 'daint:gpu': { - 'perf': (20.73, None, 2.0) - }, - } - - -class AlltoallMonchAcceptanceTest(AlltoallBaseTest): - def __init__(self, num_tasks, **kwargs): - super().__init__('alltoall_osu_microbenchmark_monch_%s' - % num_tasks, **kwargs) +@rfm.parameterized_test(*({'num_tasks': i} for i in range(2, 10, 2))) +class AlltoallMonchAcceptanceTest(AlltoallTest): + def __init__(self, num_tasks): + super().__init__('monch_acceptance') self.valid_systems = ['monch:compute'] self.num_tasks = num_tasks reference_by_node = { @@ -79,20 +70,23 @@ def __init__(self, num_tasks, **kwargs): self.reference = { 'monch:compute': reference_by_node[self.num_tasks] } - self.tags = {'monch_acceptance'} -class G2GBaseTest(RegressionTest): - def __init__(self, name, **kwargs): - super().__init__('g2g_osu_microbenchmark_p2p_%s' % name, - os.path.dirname(__file__), **kwargs) +class P2PBaseTest(rfm.RegressionTest): + def __init__(self): + super().__init__() self.exclusive_access = True self.strict_check = False self.num_tasks = 2 self.num_tasks_per_node = 1 - self.descr = 'G2G microbenchmark P2P ' + name.upper() - self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu', - 'PrgEnv-intel'] + self.descr = 'P2P microbenchmark ' + self.build_system = 'Make' + self.build_system.makefile = 'Makefile_p2p' + if self.current_system.name == 'kesch': + self.valid_prog_environs = ['PrgEnv-cray'] + else: + self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu', + 'PrgEnv-intel'] self.maintainers = ['RS', 'VK'] self.tags = {'production'} self.sanity_patterns = sn.assert_found(r'^4194304', self.stdout) @@ -103,34 +97,16 @@ def __init__(self, name, **kwargs): } } - def setup(self, partition, environ, **job_opts): - if partition.name == 'gpu': - self.num_gpus_per_node = 1 - self.modules = ['cudatoolkit'] - self.variables = {'MPICH_RDMA_ENABLED_CUDA': '1'} - if partition.name == 'cn': - self.variables = {'MV2_USE_CUDA': '1'} - - super().setup(partition, environ, **job_opts) - if self.num_gpus_per_node >= 1: - self.current_environ.cflags = ' -D_ENABLE_CUDA_ -DCUDA_ENABLED ' - - def compile(self): - super().compile(makefile='Makefile_g2g') - - -class G2GCPUBandwidthTest(G2GBaseTest): - def __init__(self, **kwargs): - super().__init__('cpu_bandwidth', **kwargs) +@rfm.simple_test +class P2PCPUBandwidthTest(P2PBaseTest): + def __init__(self): + super().__init__() self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc', 'monch:compute', 'kesch:cn'] - if self.current_system.name == 'kesch': - self.valid_prog_environs = ['PrgEnv-cray'] - - self.executable = './g2g_osu_bw' + self.executable = './p2p_osu_bw' self.executable_opts = ['-x', '100', '-i', '1000'] self.reference = { @@ -160,18 +136,17 @@ def __init__(self, **kwargs): self.tags |= {'monch_acceptance'} -class G2GCPULatencyTest(G2GBaseTest): - def __init__(self, **kwargs): - super().__init__('cpu_latency', **kwargs) +@rfm.simple_test +class P2PCPULatencyTest(P2PBaseTest): + def __init__(self): + super().__init__() self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc', 'monch:compute', 'kesch:cn'] - if self.current_system.name == 'kesch': - self.valid_prog_environs = ['PrgEnv-cray'] self.executable_opts = ['-x', '100', '-i', '1000'] - self.executable = './g2g_osu_latency' + self.executable = './p2p_osu_latency' self.reference = { 'daint:gpu': { 'latency': (1.16, None, 1.0) @@ -199,15 +174,13 @@ def __init__(self, **kwargs): self.tags |= {'monch_acceptance'} -class G2GCUDABandwidthTest(G2GBaseTest): - def __init__(self, **kwargs): - super().__init__('gpu_bandwidth', **kwargs) +@rfm.simple_test +class G2GBandwidthTest(P2PBaseTest): + def __init__(self): + super().__init__() self.valid_systems = ['daint:gpu', 'dom:gpu', 'kesch:cn'] - if self.current_system.name == 'kesch': - self.valid_prog_environs = ['PrgEnv-cray'] - self.num_gpus_per_node = 1 - self.executable = './g2g_osu_bw' + self.executable = './p2p_osu_bw' self.executable_opts = ['-x', '100', '-i', '1000', '-d', 'cuda', 'D', 'D'] @@ -226,17 +199,24 @@ def __init__(self, **kwargs): 'bw': sn.extractsingle(r'^4194304\s+(?P\S+)', self.stdout, 'bw', float) } + if self.current_system.name in ['daint', 'dom']: + self.num_gpus_per_node = 1 + self.modules = ['craype-accel-nvidia60'] + self.variables = {'MPICH_RDMA_ENABLED_CUDA': '1'} - -class G2GCUDALatencyTest(G2GBaseTest): - def __init__(self, **kwargs): - super().__init__('gpu_latency', **kwargs) - self.valid_systems = ['daint:gpu', 'dom:gpu', 'kesch:cn'] if self.current_system.name == 'kesch': - self.valid_prog_environs = ['PrgEnv-cray'] + self.variables = {'MV2_USE_CUDA': '1'} + + self.build_system.cppflags = ['-D_ENABLE_CUDA_'] + +@rfm.simple_test +class G2GLatencyTest(P2PBaseTest): + def __init__(self): + super().__init__() + self.valid_systems = ['daint:gpu', 'dom:gpu', 'kesch:cn'] self.num_gpus_per_node = 1 - self.executable = './g2g_osu_latency' + self.executable = './p2p_osu_latency' self.executable_opts = ['-x', '100', '-i', '1000', '-d', 'cuda', 'D', 'D'] @@ -255,14 +235,12 @@ def __init__(self, **kwargs): 'latency': sn.extractsingle(r'^8\s+(?P\S+)', self.stdout, 'latency', float) } + if self.current_system.name in ['daint', 'dom']: + self.num_gpus_per_node = 1 + self.modules = ['craype-accel-nvidia60'] + self.variables = {'MPICH_RDMA_ENABLED_CUDA': '1'} + if self.current_system.name == 'kesch': + self.variables = {'MV2_USE_CUDA': '1'} -def _get_checks(**kwargs): - fixed_tests = [AlltoallProdTest(**kwargs), - G2GCPUBandwidthTest(**kwargs), - G2GCPULatencyTest(**kwargs), - G2GCUDABandwidthTest(**kwargs), - G2GCUDALatencyTest(**kwargs)] - return list(itertools.chain(fixed_tests, - map(lambda n: AlltoallMonchAcceptanceTest( - n, **kwargs), range(2, 10, 2)))) + self.build_system.cppflags = ['-D_ENABLE_CUDA_'] diff --git a/cscs-checks/microbenchmarks/osu/src/Makefile_alltoall b/cscs-checks/microbenchmarks/osu/src/Makefile_alltoall index 04ded7a657..5c514508cb 100644 --- a/cscs-checks/microbenchmarks/osu/src/Makefile_alltoall +++ b/cscs-checks/microbenchmarks/osu/src/Makefile_alltoall @@ -3,16 +3,15 @@ EXECUTABLE := osu_alltoall all: $(EXECUTABLE) SRCS += osu_util.c \ - osu_alltoall.c + osu_alltoall.c OBJS := $(SRCS:.c=.o) $(OBJS): - $(CC) $(CFLAGS) -o $(@) -c $(@:.o=.c) + $(CC) $(CPPFLAGS) $(CFLAGS) -o $(@) -c $(@:.o=.c) $(EXECUTABLE): $(OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $(@) + $(CC) $(CPPFLAGS) $(CFLAGS) -o $(@) $(OBJS) $(LDFLAGS) clean: rm -f $(OBJS) $(EXECUTABLE) - diff --git a/cscs-checks/microbenchmarks/osu/src/Makefile_g2g b/cscs-checks/microbenchmarks/osu/src/Makefile_g2g deleted file mode 100644 index 4a62a2bdc1..0000000000 --- a/cscs-checks/microbenchmarks/osu/src/Makefile_g2g +++ /dev/null @@ -1,25 +0,0 @@ -EXECUTABLES := g2g_osu_bw g2g_osu_latency - -all: $(EXECUTABLES) - -SRCS += osu_util.c \ - osu_latency.c \ - osu_bw.c - -OBJS_BW = osu_util.o osu_bw.o -OBJS_LT = osu_util.o osu_latency.o - -OBJS := $(SRCS:.c=.o) - -$(OBJS): - $(CC) $(CFLAGS) -o $(@) -c $(@:.o=.c) - -g2g_osu_bw: $(OBJS_BW) - $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_BW) -o $(@) - -g2g_osu_latency: $(OBJS_LT) - $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_LT) -o $(@) - -clean: - rm -f $(OBJS) $(EXECUTABLES) - diff --git a/cscs-checks/microbenchmarks/osu/src/Makefile_p2p b/cscs-checks/microbenchmarks/osu/src/Makefile_p2p new file mode 100644 index 0000000000..4700f3638c --- /dev/null +++ b/cscs-checks/microbenchmarks/osu/src/Makefile_p2p @@ -0,0 +1,24 @@ +EXECUTABLES := p2p_osu_bw p2p_osu_latency + +all: $(EXECUTABLES) + +SRCS += osu_util.c \ + osu_latency.c \ + osu_bw.c + +OBJS_BW = osu_util.o osu_bw.o +OBJS_LT = osu_util.o osu_latency.o + +OBJS := $(SRCS:.c=.o) + +$(OBJS): + $(CC) $(CPPFLAGS) $(CXXFLAGS) -o $(@) -c $(@:.o=.c) + +p2p_osu_bw: $(OBJS_BW) + $(CC) $(CPPFLAGS) $(CXXFLAGS) -o $(@) $(OBJS_BW) $(LDFLAGS) + +p2p_osu_latency: $(OBJS_LT) + $(CC) $(CPPFLAGS) $(CXXFLAGS) -o $(@) $(OBJS_LT) $(LDFLAGS) + +clean: + rm -f $(OBJS) $(EXECUTABLES)