Skip to content

Instantly share code, notes, and snippets.

@sandip4n
Created October 7, 2020 10:21
Show Gist options
  • Save sandip4n/18f67d0d6888511249869e40967d990c to your computer and use it in GitHub Desktop.
Save sandip4n/18f67d0d6888511249869e40967d990c to your computer and use it in GitHub Desktop.
#!/usr/bin/fish
if not set -q argv[1]; or not set -q argv[2]; or not set -q argv[3]; or not set -q argv[4]
echo "usage: run-mbw <instances> <node> <iterations> <size>"
exit 1
end
for i in (seq $argv[1])
set result[$i] (mktemp)
numactl --cpunodebind=$argv[2] --membind=$argv[2] mbw -b 65536 -n $argv[3] $argv[4] > $result[$i] &
end
wait numactl
set total_memcpy 0
set total_dumb 0
set total_mcblock 0
for i in (seq $argv[1])
set k 0
for j in (cat $result[$i] | grep AVG | cut -d ' ' -f 5)
set k (math $k + 1)
switch $k
case 1
set total_memcpy (math $total_memcpy + $j)
case 2
set total_dumb (math $total_memcpy + $j)
case 3
set total_mcblock (math $total_memcpy + $j)
end
end
rm $result[$i]
end
printf 'AVG MEMCPY = %f MiB/s\\n' (math $total_memcpy / $argv[1])
printf 'AVG DUMB = %f MiB/s\\n' (math $total_dumb / $argv[1])
printf 'AVG MCBLOCK = %f MiB/s\\n' (math $total_mcblock / $argv[1])
set -e result
set -e total_memcpy
set -e total_dumb
set -e total_mcblock
set -e i
set -e j
set -e k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment