-
Notifications
You must be signed in to change notification settings - Fork 1
/
show_spill.sh
executable file
·72 lines (59 loc) · 1.85 KB
/
show_spill.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
#!/bin/bash
mkdir -p bin_an5d/
NVCC_FLAGS="-gencode=arch=compute_60,code=sm_60"
NVCC_FLAGS="$NVCC_FLAGS -gencode=arch=compute_70,code=sm_70"
NVCC_FLAGS="$NVCC_FLAGS --use_fast_math -Xptxas -v -Xcompiler -fopenmp -O3"
COMPILE ()
{
local input an5d_option regnum nvcc_option
input=$1
if [[ $input =~ "2d" ]]; then
an5d_option="--bs1=128"
elif [[ $input =~ "3d" ]]; then
an5d_option="--bs1=32 --bs2=32 --sl=512"
fi
if [[ $input =~ "j2d9pt-gol" ]]; then
an5d_option="--opt=none $an5d_option"
fi
for regnum in 32; do
for t in 4; do
for sb_type in "float"; do
if [ $regnum -gt 0 ]; then
outpath="$(pwd)/bin_an5d/${input%.*}.${sb_type}.${t}.reg${regnum}"
regopt="--maxrregcount=${regnum}"
else
outpath="$(pwd)/bin_an5d/${input%.*}.$sb_type.${t}"
regopt=""
fi
# if [ -f $outpath ] &&
# [ $outpath -nt common.h ] &&
# [ $outpath -nt make.sh ] &&
# [ $outpath -nt $input ]; then
# continue
# fi
echo $outpath
TEMP="$(mktemp -d)"
cp common.h $TEMP
cp $input $TEMP/src.c
cd $TEMP
an5d -D SB_TYPE=$sb_type $an5d_option --bt=$t src.c
nvcc -D SB_TYPE=$sb_type ${NVCC_FLAGS} $regopt src_*.cu 2>&1 | egrep 'register|sm_|spill|ptxas'
cd -
# cp $TEMP/a.out $outpath
rm -rf $TEMP
done
done
done
}
cd $(dirname "$0")
if [[ "$#" != "1" && "$#" != "2" ]] ||
[[ ! -f $(basename $1) ]] ||
[[ "$#" == "2" && ! $2 =~ ^[0-9]+$ ]]; then
echo "Usage: $0 KERNEL_FILE [REGNUM]" >&2
exit -1
fi
if [ "$#" == "1" ]; then
COMPILE $(basename $1) 0
else
COMPILE $(basename $1) $2
fi