|
| 1 | +import os |
| 2 | + |
| 3 | +import reframe as rfm |
| 4 | +import reframe.utility.sanity as sn |
| 5 | + |
| 6 | + |
| 7 | +@rfm.required_version('>=2.14') |
| 8 | +@rfm.parameterized_test(['C++'], ['F90']) |
| 9 | +class IntelVTuneAmplifierTest(rfm.RegressionTest): |
| 10 | + '''This test checks Intel VTune Amplifier: |
| 11 | + https://software.intel.com/en-us/intel-vtune-amplifier-xe |
| 12 | + and the -Cperf slurm constraint (that sets perf_event_paranoid to 0 for |
| 13 | + advanced performance analysis) |
| 14 | + ''' |
| 15 | + def __init__(self, lang): |
| 16 | + super().__init__() |
| 17 | + self.name = 'Intel_VTuneAmplifier_%s' % lang.replace('+', 'p') |
| 18 | + self.descr = self.name |
| 19 | + self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc'] |
| 20 | + self.valid_prog_environs = ['PrgEnv-intel'] |
| 21 | + self.prgenv_flags = { |
| 22 | + 'PrgEnv-gnu': ['-O2', '-g', '-fopenmp'], |
| 23 | + 'PrgEnv-cray': ['-O2', '-g', '-homp'], |
| 24 | + 'PrgEnv-intel': ['-O2', '-g', '-qopenmp'], |
| 25 | + 'PrgEnv-pgi': ['-O2', '-g', '-mp'] |
| 26 | + } |
| 27 | + self.sourcesdir = os.path.join('src', lang) |
| 28 | + self.executable = 'amplxe-cl' |
| 29 | + self.executable_opts = ['-trace-mpi -collect hotspots -r ./hotspots', |
| 30 | + '-data-limit=0 ./jacobi'] |
| 31 | + self.build_system = 'Make' |
| 32 | + if lang == 'F90': |
| 33 | + self.build_system.max_concurrency = 1 |
| 34 | + |
| 35 | + self.num_tasks = 3 |
| 36 | + self.num_tasks_per_node = 3 |
| 37 | + self.num_cpus_per_task = 4 |
| 38 | + self.num_iterations = 10 |
| 39 | + self.variables = { |
| 40 | + 'OMP_NUM_THREADS': str(self.num_cpus_per_task), |
| 41 | + 'ITERATIONS': str(self.num_iterations), |
| 42 | + 'OMP_PROC_BIND': 'true', |
| 43 | + 'CRAYPE_LINK_TYPE': 'dynamic', |
| 44 | + } |
| 45 | + self.version_rpt = 'Intel_VTuneAmplifier_version.rpt' |
| 46 | + self.summary_rpt = 'Intel_VTuneAmplifier_summary.rpt' |
| 47 | + self.paranoid_rpt = 'Intel_VTuneAmplifier_paranoid.rpt' |
| 48 | + self.pre_run = [ |
| 49 | + 'source $INTEL_PATH/../vtune_amplifier/amplxe-vars.sh', |
| 50 | + 'amplxe-cl -help collect |tail -20', |
| 51 | + ] |
| 52 | + self.post_run = [ |
| 53 | + 'amplxe-cl -V &> %s' % self.version_rpt, |
| 54 | + 'amplxe-cl -R hotspots -r hotspots* -column="CPU Time:Self" &>%s' % |
| 55 | + self.summary_rpt, |
| 56 | + 'srun -n1 cat /proc/sys/kernel/perf_event_paranoid &> %s' % |
| 57 | + self.paranoid_rpt, |
| 58 | + ] |
| 59 | + self.maintainers = ['JG'] |
| 60 | + self.tags = {'production'} |
| 61 | + |
| 62 | + def setup(self, partition, environ, **job_opts): |
| 63 | + super().setup(partition, environ, **job_opts) |
| 64 | + environ_name = self.current_environ.name |
| 65 | + prgenv_flags = self.prgenv_flags[environ_name] |
| 66 | + self.build_system.cflags = prgenv_flags |
| 67 | + self.build_system.cxxflags = prgenv_flags |
| 68 | + self.build_system.fflags = prgenv_flags |
| 69 | + partitiontype = partition.fullname.split(':')[1] |
| 70 | + if partitiontype == 'gpu': |
| 71 | + self.job.options = ['--constraint="gpu&perf"'] |
| 72 | + elif partitiontype == 'mc': |
| 73 | + self.job.options = ['--constraint="mc&perf"'] |
| 74 | + |
| 75 | + if self.current_system.name == 'dom': |
| 76 | + toolsversion = '579888' |
| 77 | + elif self.current_system.name == 'daint': |
| 78 | + toolsversion = '551022' |
| 79 | + |
| 80 | + self.sanity_patterns = sn.all([ |
| 81 | + # check the job: |
| 82 | + sn.assert_found('SUCCESS', self.stdout), |
| 83 | + sn.assert_found(r'amplxe: Executing actions \d+ %', self.stderr), |
| 84 | + # check the version: |
| 85 | + sn.assert_eq(sn.extractsingle( |
| 86 | + r'I*.\(build\s(?P<toolsversion>\d+)\s*.', self.version_rpt, |
| 87 | + 'toolsversion'), toolsversion), |
| 88 | + # check the perf_event setting: |
| 89 | + sn.assert_eq(sn.extractsingle(r'(?P<perfevent>\d)', |
| 90 | + self.paranoid_rpt, 'perfevent'), '0'), |
| 91 | + # check the hotspots: |
| 92 | + sn.assert_found(r'^[jJ]acobi.*\$omp\$parallel@\d+\s+\d+.\d+s', |
| 93 | + self.summary_rpt), |
| 94 | + ]) |
0 commit comments