From 6802b3446b38606361e6f6a4f0276b52abc72808 Mon Sep 17 00:00:00 2001 From: Victor Holanda Date: Fri, 30 Nov 2018 10:44:18 +0100 Subject: [PATCH 1/2] Add HPX hello world --- cscs-checks/libraries/hpx/hpx_hello_world.py | 62 ++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 cscs-checks/libraries/hpx/hpx_hello_world.py diff --git a/cscs-checks/libraries/hpx/hpx_hello_world.py b/cscs-checks/libraries/hpx/hpx_hello_world.py new file mode 100644 index 0000000000..43e482d250 --- /dev/null +++ b/cscs-checks/libraries/hpx/hpx_hello_world.py @@ -0,0 +1,62 @@ +import itertools +import os + +import reframe as rfm +import reframe.utility.sanity as sn + + +@rfm.simple_test +class HelloWorldHPXCheck(rfm.RunOnlyRegressionTest): + def __init__(self): + super().__init__() + + self.descr = 'HPX hello, world check' + self.valid_systems = ['daint:gpu, daint:mc', 'dom:gpu', 'dom:mc'] + self.valid_prog_environs = ['PrgEnv-gnu'] + + self.modules = ['HPX'] + self.executable = 'hello_world' + self.sourcesdir = None + + self.use_multithreading = None + + self.tags = {'production'} + self.maintainers = ['VH', 'JG'] + + def setup(self, partition, environ, **job_opts): + result = sn.findall(r'hello world from OS-thread \s*(\d+) on ' + r'locality (\d+)', self.stdout) + + if partition.fullname == 'daint:gpu': + self.num_tasks = 2 + self.num_tasks_per_node = 1 + self.num_cpus_per_task = 12 + elif partition.fullname == 'daint:mc': + self.num_tasks = 2 + self.num_tasks_per_node = 1 + self.num_cpus_per_task = 36 + elif partition.fullname == 'dom:gpu': + self.num_tasks = 2 + self.num_tasks_per_node = 1 + self.num_cpus_per_task = 12 + elif partition.fullname == 'dom:mc': + self.num_tasks = 2 + self.num_tasks_per_node = 1 + self.num_cpus_per_task = 36 + self.executable_opts = ['--hpx:threads=%s' % self.num_cpus_per_task] + + num_localities = self.num_tasks // self.num_tasks_per_node + self.sanity_patterns = sn.all( + sn.chain([sn.assert_eq(sn.count(result), self.num_tasks * + self.num_cpus_per_task)], + sn.map( + lambda x: sn.assert_lt(int(x.group(1)), + self.num_cpus_per_task), + result), + sn.map( + lambda x: sn.assert_lt(int(x.group(2)), + num_localities), + result), + ) + ) + super().setup(partition, environ, **job_opts) From dd73dfb639140d2a4db50e2196d935972aa7566e Mon Sep 17 00:00:00 2001 From: Victor Holanda Date: Tue, 8 Jan 2019 09:09:40 +0100 Subject: [PATCH 2/2] Fix PR remarks --- cscs-checks/libraries/hpx/hpx_hello_world.py | 33 +++++++++----------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/cscs-checks/libraries/hpx/hpx_hello_world.py b/cscs-checks/libraries/hpx/hpx_hello_world.py index 43e482d250..81c3cd6675 100644 --- a/cscs-checks/libraries/hpx/hpx_hello_world.py +++ b/cscs-checks/libraries/hpx/hpx_hello_world.py @@ -1,6 +1,3 @@ -import itertools -import os - import reframe as rfm import reframe.utility.sanity as sn @@ -24,8 +21,8 @@ def __init__(self): self.maintainers = ['VH', 'JG'] def setup(self, partition, environ, **job_opts): - result = sn.findall(r'hello world from OS-thread \s*(\d+) on ' - r'locality (\d+)', self.stdout) + hellos = sn.findall(r'hello world from OS-thread \s*(?P\d+) on ' + r'locality (?P\d+)', self.stdout) if partition.fullname == 'daint:gpu': self.num_tasks = 2 @@ -43,20 +40,20 @@ def setup(self, partition, environ, **job_opts): self.num_tasks = 2 self.num_tasks_per_node = 1 self.num_cpus_per_task = 36 + self.executable_opts = ['--hpx:threads=%s' % self.num_cpus_per_task] + # https://stellar-group.github.io/hpx/docs/sphinx/branches/master/html/terminology.html#term-locality num_localities = self.num_tasks // self.num_tasks_per_node - self.sanity_patterns = sn.all( - sn.chain([sn.assert_eq(sn.count(result), self.num_tasks * - self.num_cpus_per_task)], - sn.map( - lambda x: sn.assert_lt(int(x.group(1)), - self.num_cpus_per_task), - result), - sn.map( - lambda x: sn.assert_lt(int(x.group(2)), - num_localities), - result), - ) - ) + assert_num_tasks = sn.assert_eq(sn.count(hellos), + self.num_tasks*self.num_cpus_per_task) + assert_threads = sn.map(lambda x: sn.assert_lt(int(x.group('tid')), + self.num_cpus_per_task), hellos) + assert_localities = sn.map(lambda x: sn.assert_lt(int(x.group('lid')), + num_localities), hellos) + + self.sanity_patterns = sn.all(sn.chain([assert_num_tasks], + assert_threads, + assert_localities)) + super().setup(partition, environ, **job_opts)