-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_cg_RDNA_af5.sh
executable file
·91 lines (78 loc) · 2.42 KB
/
run_cg_RDNA_af5.sh
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
MTX_HOME="/home/kasia/LAP"
RES_OUT_HOME="./output_results"
RES_HOME="./power_results"
SCRIPT="/home/kasia/LAP/lap_hip_cg " ## This is were the command go
PRECOND=('GS_std' 'GS_it' 'GS_it2' 'it_jacobi' 'line_jacobi' 'ichol')
MATRIX=('af_5_k101/af_5_k101.mtx')
RHS=( 'af_5_k101/af_5_k101_b.mtx' )
declare -A ARGX
ARGX+=(["${MATRIX[0]}_${PRECOND[0]}"]='2 2')
ARGX+=(["${MATRIX[0]}_${PRECOND[1]}"]='3 0')
ARGX+=(["${MATRIX[0]}_${PRECOND[2]}"]='1 2')
ARGX+=(["${MATRIX[0]}_${PRECOND[3]}"]='3 3')
ARGX+=(["${MATRIX[0]}_${PRECOND[4]}"]='1 1')
ARGX+=(["${MATRIX[0]}_${PRECOND[5]}"]='1 1')
NUM_GPUS=1
RES_COLLECTIVE="./rdna_cg_results/"
sleep 1s
for idx in {1..5}; do
for precond in "${PRECOND[@]}"; do
x=0
for mtx in "${MATRIX[@]}"; do
cd ${MTX_HOME}
key="${mtx}_${precond}"
if [[ ${ARGX[${key}]} == '-1' ]]; then
let x++
continue; fi
echo "Preconditioner = ${precond}; Matrix = ${mtx}; Repetition: $idx"
echo "Creating directories"
sleep 1s
# mtxs=${mtx/\//_}
mtxs=`dirname $mtx`
# dir_name="PC_${precond}_MTX_${mtxs}_REP_${idx}_CG"
dir_name="REP_${idx}_CG/${mtxs}/"
mkdir -p ${dir_name}
echo "Entering directory: " $dir_name
cd ${dir_name}
sleep 1s
mkdir -p ${RES_HOME}
mkdir -p ${RES_OUT_HOME}
# rm -rf ${RES_HOME}/*
# rm -rf ${RES_OUT_HOME}/*
echo "Starting power collecion"
sleep 1s
power_sids=()
for ((i = 0; i < 1 ; i++)); do
echo "Will be putting results in "${RES_HOME}/${precond}.txt
/home/kasia/Downloads/power_tools/power_analysis-main/power_profiler/power_profiler ${RES_HOME}/${precond}.txt 600 20 &
power_sids+=($!)
done
echo "Running the code"
mtxr=${MTX_HOME}/${mtx}
hrsxr=''
if [[ ${RHS[$x]} != '' ]]; then
hrsxr=${MTX_HOME}/${RHS[$x]}
fi
echo "RHS: " $hrsxr "x: " $x
sleep 1s
full_command="${SCRIPT} ${mtxr} ${precond} 1e-12 25000 ${ARGX[${key}]} ${hrsxr}"
echo "CMD: " + $full_command
echo "Will be putting (numerical) results in " ${RES_OUT_HOME}/$precond.txt
${full_command} > ${RES_OUT_HOME}/$precond.txt
echo "Killing power collectin"
sleep 1s
for sid in "${power_sids[@]}"; do
kill ${sid}
done
pkill tegrastats
echo "Done"
sleep 1s
cd ..
let x++
done
done
done
mkdir -p ${RES_COLLECTIVE}
rm -rf ${RES_COLLECTIVE}/*
mv PC_* ${RES_COLLECTIVE}