ampere_research/trilinos/run_old.sh.old
2024-10-22 00:50:41 -04:00

59 lines
1.4 KiB
Bash
Executable File

#! /bin/bash
#SBATCH --account oasis
#SBATCH --partition oasis
#SBATCH --qos oasis-exempt # Up to 160 cores and 28114M of RAM.
#SBATCH --tasks-per-node
#SBATCH --cpus-per-task 20
#SBATCH --nodes 1
#SBATCH --output run.out
#SBATCH --error run.out
filename="$@"
filename="${filename// /_}"
baseline_time_s="$1"
function record_power {
#srun --cpus-per-task 1 ./power.sh &
echo "Recording power..."
srun --cpus-per-task 1 bash -c "sensors | awk '/CPU power:/ {printf \"Socket\"++count[\$1] \" \"; print \$3}' >> power.output" &
}
function record_power_baseline {
echo "Recording power baseline..."
for i in {1..$baseline_time_s}; do
#record_power
echo "Recording power..."
srun --cpus-per-task 1 bash -c "sensors | awk '/CPU power:/ {printf \"Socket\"++count[\$1] \" \"; print \$3}' >> power.output"
sleep 1s
done
echo "Finished power baseline..."
}
hostname | cat
record_power_baseline
echo "Start" >> power.output
srun --cpus-per-task 20 apptainer run ./testing.sif stress -c 20 -t 10 &
# srun --nodelist $node --cpus-per-task 16 perf stat -M branch_misprediction_ratio apptainer run ./testing.sif stress -c 16 -t 10 > testing
pid=$!
# If this script is killed, kill the program above.
trap "kill $pid 2> /dev/null" EXIT
# While program is running, record power.
while kill -0 $pid 2> /dev/null; do
record_power
sleep 1s
done
echo "End" >> power.output
record_power_baseline
# Disable the trap on a normal exit.
trap - EXIT
wait