-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmit-job-rapl.sh
More file actions
39 lines (28 loc) · 982 Bytes
/
submit-job-rapl.sh
File metadata and controls
39 lines (28 loc) · 982 Bytes
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
#/bin/bash
#SBATCH --nodes=1
#SBATCH --tasks-per-node=1
#SBATCH --cpus-per-task=24
#SBATCH --partition=haswell64
#SBATCH --time=00:15:00
#SBATCH --exclusive
#SBATCH -J my_job
gettime ()
{
echo $(($(date +%s%N)/1000000))
}
STARTCPUENERGY=`cat /sys/class/powercap/intel-rapl/intel-rapl\:0/energy_uj`
STARTTIME=`gettime`
./my_application --parameters
ENDTIME=`gettime`
ENDCPUENERGY=`cat /sys/class/powercap/intel-rapl/intel-rapl\:0/energy_uj`
UJMAX=`cat /sys/class/powercap/intel-rapl/intel-rapl\:0/max_energy_range_uj`
if [[ $STARTCPUENERGY -gt $ENDCPUENERGY ]]; then
CPUENERGY=`echo "scale=3; (($UJMAX - $STARTCPUENERGY) + $ENDCPUENERGY) / 1000000" | bc -l `
else
CPUENERGY=`echo "scale=3; ($ENDCPUENERGY - $STARTCPUENERGY) / 1000000" | bc -l`
fi
TIME=`echo "scale=3; ($ENDTIME - $STARTTIME) / 1000" | bc -l`
CPUPOWER=`echo "scale=3; ($CPUENERGY / $TIME)" | bc -l`
echo "Runtime: ${TIME} seconds"
echo "CPU Energy: ${CPUENERGY} J"
echo "Power: ${CPUPOWER} W"