-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·48 lines (44 loc) · 1.43 KB
/
build.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
#!/bin/sh -ex
###############################################################################
# File : build.sh
###############################################################################
tempdirname=$(mktemp -d)
PTXSTATS=$(dirname $0)/ptx-stats.py
ARCH=70
CELERITAS=${HOME}/Code/celeritas
if [ -e ${CELERITAS} ]; then
CUDA_FLAGS="${CUDA_FLAGS} -I${CELERITAS}/src -I${CELERITAS}/test
-I${CELERITAS}/build-ndebug/include"
fi
CUDA_FLAGS="${CUDA_FLAGS} -O3"
for filename in $*; do
basename="${filename%.*}"
tempname=${tempdirname}/${basename##*/}.o
time nvcc -std=c++17 \
--gpu-architecture compute_${ARCH} \
${CUDA_FLAGS} \
-c \
-o ${tempname} \
${filename}
cuobjdump --dump-ptx ${tempname} \
> ${basename}.ptx
$PTXSTATS ${basename}.ptx > ${basename}.ptx-stats.txt
cubinname=${tempdirname}/${basename##*/}.cubin
time nvcc -std=c++17 \
--gpu-architecture compute_${ARCH} \
--gpu-code sm_${ARCH} \
--cubin \
${CUDA_FLAGS} -G \
-c \
-o ${cubinname} \
${filename}
cuobjdump --dump-resource-usage ${cubinname} \
> ${basename}.usage.txt
nvdisasm --print-line-info --print-line-info-inline --print-code \
${cubinname} \
| sed -e "s'\s*/\* 0x[a-f0-9]\+ \*/\s*$''" \
> ${basename}.s
done
###############################################################################
# end of build.sh
###############################################################################