|
| 1 | +# Copyright 2016-2020 Swiss National Supercomputing Centre (CSCS/ETH Zurich) |
| 2 | +# ReFrame Project Developers. See the top-level LICENSE file for details. |
| 3 | +# |
| 4 | +# SPDX-License-Identifier: BSD-3-Clause |
| 5 | + |
| 6 | +import os |
| 7 | +import reframe as rfm |
| 8 | +import reframe.utility.sanity as sn |
| 9 | + |
| 10 | + |
| 11 | +class QuantumESPRESSOCheck(rfm.RunOnlyRegressionTest): |
| 12 | + def __init__(self): |
| 13 | + self.valid_prog_environs = ['builtin'] |
| 14 | + self.executable = 'pw.x' |
| 15 | + self.executable_opts = ['-in', 'ausurf.in'] |
| 16 | + |
| 17 | + self.sanity_patterns = sn.all([ |
| 18 | + sn.assert_found(r'convergence has been achieved', self.stdout), |
| 19 | + ]) |
| 20 | + |
| 21 | + self.perf_patterns = { |
| 22 | + 'time': sn.extractsingle(r'electrons.+\s(?P<wtime>\S+)s WALL', |
| 23 | + self.stdout, 'wtime', float) |
| 24 | + } |
| 25 | + |
| 26 | + self.maintainers = ['LM'] |
| 27 | + self.tags = {'scs'} |
| 28 | + self.strict_check = False |
| 29 | + self.extra_resources = { |
| 30 | + 'switches': { |
| 31 | + 'num_switches': 1 |
| 32 | + } |
| 33 | + } |
| 34 | + |
| 35 | + |
| 36 | +@rfm.parameterized_test(*([s, v] |
| 37 | + for s in ['small', 'large'] |
| 38 | + for v in ['maint', 'prod'])) |
| 39 | +class QuantumESPRESSOCpuCheck(QuantumESPRESSOCheck): |
| 40 | + def __init__(self, scale, variant): |
| 41 | + super().__init__() |
| 42 | + self.descr = f'QuantumESPRESSO CPU check (version: {scale}, {variant})' |
| 43 | + self.valid_systems = ['daint:mc'] |
| 44 | + self.modules = ['QuantumESPRESSO/6.5-CrayIntel-19.10'] |
| 45 | + if scale == 'small': |
| 46 | + self.valid_systems += ['dom:mc'] |
| 47 | + self.num_tasks = 216 |
| 48 | + energy_reference = -11427.09017162 |
| 49 | + else: |
| 50 | + self.num_tasks = 576 |
| 51 | + energy_reference = -11427.09017152 |
| 52 | + |
| 53 | + self.num_tasks_per_node = 36 |
| 54 | + |
| 55 | + energy = sn.extractsingle(r'!\s+total energy\s+=\s+(?P<energy>\S+) Ry', |
| 56 | + self.stdout, 'energy', float) |
| 57 | + energy_diff = sn.abs(energy-energy_reference) |
| 58 | + self.sanity_patterns = sn.all([ |
| 59 | + self.sanity_patterns, |
| 60 | + sn.assert_lt(energy_diff, 1e-8) |
| 61 | + ]) |
| 62 | + |
| 63 | + references = { |
| 64 | + 'maint': { |
| 65 | + 'small': { |
| 66 | + 'dom:mc': {'time': (115.0, None, 0.05, 's')}, |
| 67 | + 'daint:mc': {'time': (115.0, None, 0.10, 's')} |
| 68 | + }, |
| 69 | + 'large': { |
| 70 | + 'daint:mc': {'time': (115.0, None, 0.10, 's')} |
| 71 | + } |
| 72 | + }, |
| 73 | + 'prod': { |
| 74 | + 'small': { |
| 75 | + 'dom:mc': {'time': (115.0, None, 0.05, 's')}, |
| 76 | + 'daint:mc': {'time': (115.0, None, 0.10, 's')} |
| 77 | + }, |
| 78 | + 'large': { |
| 79 | + 'daint:mc': {'time': (115.0, None, 0.10, 's')} |
| 80 | + } |
| 81 | + } |
| 82 | + } |
| 83 | + |
| 84 | + self.reference = references[variant][scale] |
| 85 | + self.tags |= {'maintenance' if variant == 'maint' else 'production'} |
| 86 | + |
| 87 | + |
| 88 | +@rfm.parameterized_test(*([s, v] |
| 89 | + for s in ['small', 'large'] |
| 90 | + for v in ['maint', 'prod'])) |
| 91 | +class QuantumESPRESSOGpuCheck(QuantumESPRESSOCheck): |
| 92 | + def __init__(self, scale, variant): |
| 93 | + super().__init__() |
| 94 | + self.descr = f'QuantumESPRESSO GPU check (version: {scale}, {variant})' |
| 95 | + self.valid_systems = ['daint:gpu'] |
| 96 | + self.modules = ['QuantumESPRESSO/6.5a1-CrayPGI-19.10-cuda-10.1'] |
| 97 | + self.num_gpus_per_node = 1 |
| 98 | + if scale == 'small': |
| 99 | + self.valid_systems += ['dom:gpu'] |
| 100 | + self.num_tasks = 6 |
| 101 | + energy_reference = -11427.09017176 |
| 102 | + else: |
| 103 | + self.num_tasks = 16 |
| 104 | + energy_reference = -11427.09017179 |
| 105 | + |
| 106 | + self.num_tasks_per_node = 1 |
| 107 | + self.num_cpus_per_task = 12 |
| 108 | + |
| 109 | + energy = sn.extractsingle(r'!\s+total energy\s+=\s+(?P<energy>\S+) Ry', |
| 110 | + self.stdout, 'energy', float) |
| 111 | + energy_diff = sn.abs(energy-energy_reference) |
| 112 | + self.sanity_patterns = sn.all([ |
| 113 | + self.sanity_patterns, |
| 114 | + sn.assert_lt(energy_diff, 1e-8) |
| 115 | + ]) |
| 116 | + |
| 117 | + references = { |
| 118 | + 'maint': { |
| 119 | + 'small': { |
| 120 | + 'dom:gpu': {'time': (60.0, None, 0.05, 's')}, |
| 121 | + 'daint:gpu': {'time': (60.0, None, 0.10, 's')} |
| 122 | + }, |
| 123 | + 'large': { |
| 124 | + 'daint:gpu': {'time': (60.0, None, 0.10, 's')} |
| 125 | + } |
| 126 | + }, |
| 127 | + 'prod': { |
| 128 | + 'small': { |
| 129 | + 'dom:gpu': {'time': (60.0, None, 0.05, 's')}, |
| 130 | + 'daint:gpu': {'time': (60.0, None, 0.10, 's')} |
| 131 | + }, |
| 132 | + 'large': { |
| 133 | + 'daint:gpu': {'time': (60.0, None, 0.10, 's')} |
| 134 | + } |
| 135 | + } |
| 136 | + } |
| 137 | + |
| 138 | + self.reference = references[variant][scale] |
| 139 | + self.tags |= {'maintenance' if variant == 'maint' else 'production'} |
0 commit comments