aboutsummaryrefslogtreecommitdiffstats
path: root/resources/ansible_roles/ramspeed/tasks/main.yml
blob: 34b38fa1e6dd0540dd9ec3a55a5139d19383e578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
##############################################################################
# Copyright (c) 2017 ZTE Corporation and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

- name: making ramspeed working directory
  file:
    path: "{{ workdir }}"
    state: directory

- name: downloading ramsmp
  get_url:
    url: http://www.alasir.com/software/ramspeed/ramsmp-3.5.0.tar.gz
    dest: "{{ workdir }}"
    checksum: "sha256:39fb15493fb3c293575746d56f6ab9faaa1d876d8b1f0d8e5a4042d2ace95839"

- name: extracting ramsmp
  # TODO(yujunz) unarchive may not work with long path (local: macOS, workdir: /root/qtip-workdir-20170423-0836/)
  command: "tar zxf ramsmp-3.5.0.tar.gz"
  args:
    chdir: "{{ workdir }}"
    creates: ramsmp-3.5.0

- name: build ramsmp
  command: ./build.sh
  args:
    chdir: "{{ workdir }}/ramsmp-3.5.0"
    creates: ramsmp

- name: intmem benchmarking
  command: ./ramsmp -b 3 -l 5 -p 1
  args:
    chdir: "{{ workdir }}/ramsmp-3.5.0"
  register: ramsmp_int_out

- name: floatmem benchmarking
  command: ./ramsmp -b 6 -l 5 -p 1
  args:
    chdir: "{{ workdir }}/ramsmp-3.5.0"
  register: ramsmp_float_out

- name: generating log filename
  set_fact:
    int_logfile: "{{ output }}/ramsmp-int.log"
    float_logfile: "{{ output }}/ramsmp-float.log"

- name: saving integer output to log
  copy:
    content: "{{ ramsmp_int_out.stdout }}"
    dest: "{{ int_logfile }}"
  delegate_to: localhost

- name: saving floating point output to log
  copy:
    content: "{{ ramsmp_float_out.stdout }}"
    dest: "{{ float_logfile }}"
  delegate_to: localhost

- name: collect integer memory metrics from ramspeed
  collect:
    string: "{{ lookup('file', int_logfile) }}"
    patterns:
      - '^INTEGER\s+BatchRun\s+Copy:\s+?(?P<copy>\d+\.\d+)\sMB/s$'
      - '^INTEGER\s+BatchRun\s+Scale:\s+?(?P<scale>\d+\.\d+)\sMB/s$'
      - '^INTEGER\s+BatchRun\s+Add:\s+?(?P<add>\d+\.\d+)\sMB/s$'
      - '^INTEGER\s+BatchRun\s+Triad:\s+?(?P<triad>\d+\.\d+)\sMB/s$'
      - '^INTEGER\s+BatchRun\s+AVERAGE:\s+?(?P<average>\d+\.\d+)\sMB/s$'
    dest: "{{ output }}/integer-metrics.json"
  register: intmem_metrics

- name: collect float memory metrics from ramspeed
  collect:
    string: "{{ lookup('file', float_logfile) }}"
    patterns:
      - '^FL-POINT\s+BatchRun\s+Copy:\s+?(?P<copy>\d+\.\d+)\sMB/s$'
      - '^FL-POINT\s+BatchRun\s+Scale:\s+?(?P<scale>\d+\.\d+)\sMB/s$'
      - '^FL-POINT\s+BatchRun\s+Add:\s+?(?P<add>\d+\.\d+)\sMB/s$'
      - '^FL-POINT\s+BatchRun\s+Triad:\s+?(?P<triad>\d+\.\d+)\sMB/s$'
      - '^FL-POINT\s+BatchRun\s+AVERAGE:\s+?(?P<average>\d+\.\d+)\sMB/s$'
    dest: "{{ output }}/float-metrics.json"
  register: floatmem_metrics

- name: create memory metrics report
  template:
    src: "memory-metrics.j2"
    dest: "{{ output }}/report"
  delegate_to: localhost