-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Unix benchmark #32
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
- name: install gcc | ||
dnf: | ||
name: gcc | ||
state: present | ||
become: true | ||
when: ansible_distribution != 'Ubuntu' | ||
|
||
- name: install make | ||
dnf: | ||
name: make | ||
state: present | ||
become: true | ||
when: ansible_distribution != 'Ubuntu' | ||
|
||
- name: Install git | ||
dnf: | ||
name: git | ||
state: present | ||
become: true | ||
when: ansible_distribution != 'Ubuntu' | ||
|
||
- name: copy over data extraction | ||
ansible.builtin.template: | ||
src: extract_results.sh.j2 | ||
dest: ~/extract_results.sh | ||
mode: '0755' | ||
|
||
- name: Install unix-bench | ||
git: | ||
repo: https://github.com/kdlucas/byte-unixbench | ||
dest: ~/byte-unixbench | ||
|
||
- name: Run Unix bench | ||
shell: cd byte-unixbench/UnixBench; ./Run | ||
|
||
- name: extract results | ||
shell: cd results; ./extract_results.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#! /bin/bash | ||
|
||
# get file name | ||
cd ~/byte-unixbench/UnixBench/results/ | ||
pattern="unix*" | ||
files=( $pattern ) | ||
file="${files[0]}" | ||
echo $file | ||
|
||
sed -i -e 's/(//g' $file | ||
sed -i -e 's/)//g' $file | ||
|
||
extract_data() { | ||
string=$1 | ||
# Extarct the number of numbers in the string to calculate which ones to extract | ||
numbers=$(echo $string | grep -oP "\d+(?:\.\d+)?" | wc -l) | ||
n1=$((1 + $numbers)) | ||
n2=$(($n1 + $numbers + $numbers + 2)) | ||
# Index score only appears twice, not 4 times | ||
if [[ $string == 'System Benchmarks Index Score' ]]; then | ||
n2=2 | ||
fi | ||
# extract benchmark results | ||
echo ------------------------------------ | ||
r1=$(grep -ioP "$string +(?)\d+(?:\.\d+)?" $file | grep -oP "\d+(?:\.\d+)?" | head -n$n1 | tail -1) | ||
r2=$(grep -ioP "$string +(?)\d+(?:\.\d+)?" $file | grep -oP "\d+(?:\.\d+)?" | head -n$n2 | tail -1) | ||
# Remove spaces from benchmark name for sending results to DB | ||
bench=$(echo $string | sed -r 's/[ -]/_/g') | ||
echo $bench | ||
echo $r1 | ||
echo $r2 | ||
# Specify if benchmarks are single core or multicore | ||
bench1="${bench}_single_core" | ||
bench2="${bench}_multi_core" | ||
# Send data to DB | ||
curl -H "Authorization: Basic `echo -n "{{ db_username }}:{{ db_password }}" | base64`" -d 'unix_bench,image='"$image"',flavor='"$flavor"' '"$bench1"'='"$r1"'' -X POST $DB --insecure | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a comment about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the host has an invalid cert we can get a proper DNS record and TLS certificate? |
||
curl -H "Authorization: Basic `echo -n "{{ db_username }}:{{ db_password }}" | base64`" -d 'unix_bench,image='"$image"',flavor='"$flavor"' '"$bench2"'='"$r2"'' -X POST $DB --insecure | ||
|
||
} | ||
|
||
|
||
# Get VM infor | ||
server_UUID=$(curl http://169.254.169.254/openstack/latest/meta_data.json -s | grep -ioP .{8}-.{4}-.{4}-.{4}-.{12}) | ||
vm_info=$(openstack server show $server_UUID --os-cloud openstack) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we get this from the same There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will address this in future PR |
||
#hypervisor=$(echo $vm_info | grep -ioP "\w*.nubes.rl.ac.uk" | head -1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this line commented out? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is there in case we ever want HV information, but it requires admin creds to do so |
||
flavor=$(echo $vm_info | grep -ioP "flavor\s\|\s\S*" | cut -c 10-) | ||
image=$(echo $vm_info | grep -ioP "image\s\|\s\S*" | cut -c 9-) | ||
|
||
DB="https://{{ db_ip }}:{{ db_port }}/write" | ||
|
||
|
||
benchmarks=( | ||
'Dhrystone 2 using register variables' | ||
'Double-Precision Whetstone' | ||
'Execl Throughput' | ||
'File Copy 1024 bufsize 2000 maxblocks' | ||
'File Copy 256 bufsize 500 maxblocks' | ||
'File Copy 4096 bufsize 8000 maxblocks' | ||
'Pipe Throughput' | ||
'Pipe-based Context Switching' | ||
'Process Creation' | ||
'Shell Scripts 1 concurrent' | ||
'Shell Scripts 8 concurrent' | ||
'System Call Overhead' | ||
'System Benchmarks Index Score' | ||
) | ||
|
||
|
||
for i in ${!benchmarks[@]}; do | ||
extract_data "${benchmarks[$i]}" | ||
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set -euo pipefail
so it will fail if something goes wrongAdditionally can we setup shell-check like so: https://github.com/stfc/SCD-OpenStack-Utils/blob/master/.github/workflows/gpu_benchmark.yaml#L11
Since this more scripts we add without linting the harder it will be in the future