47 lines
1001 B
Bash
Executable File
47 lines
1001 B
Bash
Executable File
#! /bin/bash
|
|
|
|
output_dir="$1"
|
|
baseline_time_s="$2"
|
|
file="$3"
|
|
iterations="$4"
|
|
|
|
filename="altra $baseline_time_s $file $iterations"
|
|
filename="${filename// /_}"
|
|
output_file="${output_dir}${filename}".output
|
|
power_file="${output_dir}${filename}".power
|
|
|
|
program=(apptainer run pytorch-altra.sif -c 'numactl --cpunodebind=0 --membind=0 python spmv.py ${file} ${iterations}')
|
|
|
|
function record_power {
|
|
sensors | awk '/CPU power:/ {printf "Socket"++count[$1] " "; print $3}' >> "$power_file"
|
|
}
|
|
|
|
function record_power_baseline {
|
|
for i in $(seq 1 $baseline_time_s); do
|
|
record_power
|
|
sleep 1s
|
|
done
|
|
}
|
|
|
|
mkdir "$output_dir"
|
|
rm -fv "$output_file"
|
|
|
|
hostname | tee "$output_file"
|
|
echo "$@" | tee --append "$output_file"
|
|
echo "${program[@]}" | tee --append "$output_file"
|
|
|
|
record_power_baseline
|
|
|
|
"${program[@]}" | tee --append "$output_file" &
|
|
|
|
pid=$!
|
|
while kill -0 $pid 2> /dev/null; do
|
|
record_power
|
|
sleep 1s
|
|
done
|
|
|
|
record_power_baseline
|
|
wait
|
|
|
|
#perf stat -d -d "${program[@]}" 2>&1 | tee --append "$output_file"
|