@@ -32,82 +32,89 @@ def __init__(self, variant, lang, linkage):
3232 self .valid_prog_environs = []
3333
3434 self .compilation_time_seconds = None
35- self .maintainers = ['VH' , 'EK' ]
36- self .tags = {'production' , 'craype' }
37-
38- def compile (self ):
39- self .compilation_time_seconds = datetime .now ()
40- super ().compile ()
41- self .compilation_time_seconds = (
42- datetime .now () - self .compilation_time_seconds ).total_seconds ()
43-
44- @rfm .run_after ('setup' )
45- def set_flags (self ):
46- # FIXME: static compilation yields a link error in case of
47- # PrgEnv-cray(Cray Bug #255707)
48- if (self .linkage == 'static' and
49- self .current_system .name == 'dom' and
50- self .current_environ .name .startswith ('PrgEnv-cray' )):
51- self .variables = {'LINKER_X86_64' : '/usr/bin/ld' ,
52- 'LINKER_AARCH64' : '=/usr/bin/ld' }
5335
5436 result = sn .findall (r'Hello World from thread \s*(\d+) out '
5537 r'of \s*(\d+) from process \s*(\d+) out of '
5638 r'\s*(\d+)' , self .stdout )
5739
40+ num_tasks = sn .getattr (self , 'num_tasks' )
41+ num_cpus_per_task = sn .getattr (self , 'num_cpus_per_task' )
42+
43+ def tid (match ):
44+ return int (match .group (1 ))
45+
46+ def num_threads (match ):
47+ return int (match .group (2 ))
48+
49+ def rank (match ):
50+ return int (match .group (3 ))
51+
52+ def num_ranks (match ):
53+ return int (match .group (4 ))
54+
5855 self .sanity_patterns = sn .all (
59- sn .chain ([sn .assert_eq (sn .count (result ), self .num_tasks *
60- self .num_cpus_per_task )],
61- sn .map (
62- lambda x : sn .assert_lt (int (x .group (1 )),
63- int (x .group (2 ))),
64- result ),
65- sn .map (
66- lambda x : sn .assert_lt (int (x .group (3 )),
67- int (x .group (4 ))),
68- result ),
69- sn .map (
70- lambda x : sn .assert_lt (int (x .group (1 )),
71- self .num_cpus_per_task ),
72- result ),
73- sn .map (
74- lambda x : sn .assert_eq (int (x .group (2 )),
75- self .num_cpus_per_task ),
76- result ),
77- sn .map (
78- lambda x : sn .assert_lt (int (x .group (3 )),
79- self .num_tasks ),
80- result ),
81- sn .map (
82- lambda x : sn .assert_eq (int (x .group (4 )),
83- self .num_tasks ),
84- result ),
85- )
56+ sn .chain (
57+ [sn .assert_eq (sn .count (result ), num_tasks * num_cpus_per_task )],
58+ sn .map (lambda x : sn .assert_lt (tid (x ), num_threads (x )), result ),
59+ sn .map (lambda x : sn .assert_lt (rank (x ), num_ranks (x )), result ),
60+ sn .map (
61+ lambda x : sn .assert_lt (tid (x ), num_cpus_per_task ), result
62+ ),
63+ sn .map (
64+ lambda x : sn .assert_eq (num_threads (x ), num_cpus_per_task ),
65+ result
66+ ),
67+ sn .map (lambda x : sn .assert_lt (rank (x ), num_tasks ), result ),
68+ sn .map (
69+ lambda x : sn .assert_eq (num_ranks (x ), num_tasks ), result
70+ ),
71+ )
8672 )
87-
8873 self .perf_patterns = {
8974 'compilation_time' : sn .getattr (self , 'compilation_time_seconds' )
9075 }
9176 self .reference = {
9277 '*' : {
93- 'compilation_time' : (60 , None , 0.1 )
78+ 'compilation_time' : (60 , None , 0.1 , 's' )
9479 }
9580 }
9681
82+ self .maintainers = ['VH' , 'EK' ]
83+ self .tags = {'production' , 'craype' }
84+
85+ @rfm .run_before ('compile' )
86+ def setflags (self ):
87+ # FIXME: static compilation yields a link error in case of
88+ # PrgEnv-cray(Cray Bug #255707)
89+ if (self .linkage == 'static' and
90+ self .current_system .name == 'dom' and
91+ self .current_environ .name .startswith ('PrgEnv-cray' )):
92+ self .variables = {'LINKER_X86_64' : '/usr/bin/ld' ,
93+ 'LINKER_AARCH64' : '=/usr/bin/ld' }
94+
9795 envname = self .current_environ .name .replace ('-nompi' , '' )
9896 prgenv_flags = self .prgenv_flags [envname ]
9997 self .build_system .cflags = prgenv_flags
10098 self .build_system .cxxflags = prgenv_flags
10199 self .build_system .fflags = prgenv_flags
102100
101+ @rfm .run_before ('compile' )
102+ def compile_timer_start (self ):
103+ self .compilation_time_seconds = datetime .now ()
104+
105+ @rfm .run_after ('compile' )
106+ def compile_timer_end (self ):
107+ elapsed = datetime .now () - self .compilation_time_seconds
108+ self .compilation_time_seconds = elapsed .total_seconds ()
109+
103110
104111@rfm .required_version ('>=2.14' )
105112@rfm .parameterized_test (* ([lang , linkage ]
106113 for lang in ['cpp' , 'c' , 'f90' ]
107114 for linkage in ['dynamic' , 'static' ]))
108115class HelloWorldTestSerial (HelloWorldBaseTest ):
109- def __init__ (self , lang , linkage , ** kwargs ):
110- super ().__init__ ('serial' , lang , linkage , ** kwargs )
116+ def __init__ (self , lang , linkage ):
117+ super ().__init__ ('serial' , lang , linkage )
111118 self .valid_systems += ['kesch:pn' ]
112119 self .sourcepath += '_serial.' + lang
113120 self .descr += ' Serial ' + linkage .capitalize ()
0 commit comments