-
Notifications
You must be signed in to change notification settings - Fork 1
/
cuda-memcheck-script
executable file
·84 lines (80 loc) · 4.04 KB
/
cuda-memcheck-script
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
#A simply script to automate memory leak checking, this script does NOT take into account symbolic links
debug_build_output="debug-build-output.txt"
debug_output="debug-output.txt"
release_build_output="release-build-output.txt"
release_output="release-output.txt"
if [ $# -eq 0 ]
then
printf "USAGE: $0 <some valid number list below>\n"
printf "0: Erase all files matching the regex < cuda-memcheck.file* >\n"
printf "1: Run cuda-memcheck on binary located at: /debug/test/ann_tests\n"
printf "2: Run cuda-memcheck on binary located at: /release/test/ann_tests\n"
#possible future options here
fi
if [[ $# -eq 1 && $1 -eq 0 ]] ; then
printf "Removing file matching regex < cuda-memcheck.file* >\n"
rm -f cuda-memcheck.file*
fi
if [[ $# -eq 1 && $1 -eq 1 ]] ; then
truncate -s 0 debug-output.txt
printf "Running cuda-memcheck on binary < ann_tests >located at: /debug/test/\n"
if [ -d debug ]
then
printf "Removing debug directory\n"
rm -rf debug
printf "Finished removing debug directory\n"
printf "Executing ./debug-script\n"
./debug-script
printf "Finished executing debug-script results are in: debug-build-output.txt\n"
printf "Executing cuda-memcheck --leak-check full ./debug/test/ann_tests"
cuda-memcheck --leak-check full --racecheck-report all --show-backtrace yes ./debug/test/ann_tests > debug-memcheck-output.txt 2>&1
printf "Finished executing cuda-memcheck output file is debug-memcheck-output.txt\n"
printf "Concatenating results of debug-build-output.txt and debug-memcheck-output.txt into debug-output.txt\n"
cat debug-build-output.txt debug-memcheck-output.txt >> debug-output.txt
printf "debug-output.txt complete\n"
else
printf "Binary < ann_tests > was not found at /debug/test/\n"
printf "Executing ./debug-script\n"
./debug-script
printf "Finished executing debug-script results are in: debug-build-output.txt\n"
printf "Executing cuda-memcheck --leak-check full ./debug/test/ann_tests"
cuda-memcheck --leak-check full ./debug/test/ann_tests > debug-memcheck-output.txt 2>&1
printf "Finished executing cuda-memcheck output file is debug-memcheck-output.txt\n"
printf "Concatenating results of debug-build-output.txt and debug-memcheck-output.txt into debug-output.txt\n"
cat debug-build-output.txt debug-memcheck-output.txt >> debug-output.txt
printf "debug-output.txt complete\n"
fi
fi
if [[ $# -eq 1 && $1 -eq 2 ]] ; then
truncate -s 0 release-output.txt
printf "Running cuda-memcheck on binary < ann_tests >located at: /release/test/\n"
if [ -d release ]
then
printf "Removing release directory\n"
rm -rf release
printf "Finished removing release directory\n"
printf "Executing ./release-script\n"
./release-script
printf "Finished executing release-script results are in: release-build-output.txt\n"
printf "Executing cuda-memcheck --leak-check full ./release/test/ann_tests"
cuda-memcheck --leak-check full ./release/test/ann_tests 2>&1
printf "Finished executing cuda-memcheck output file is release-memcheck-output.txt\n"
printf "Concatenating results of release-build-output.txt and release-memcheck-output.txt into release-output.txt\n"
cat release-build-output.txt release-memcheck-output.txt >> release-output.txt
printf "release-output.txt complete\n"
else
printf "Binary < ann_tests > was not found at /release/test/\n"
printf "Executing ./release-script\n"
./release-script
printf "Finished executing release-script results are in: release-build-output.txt\n"
printf "Executing cuda-memcheck --leak-check full ./release/test/ann_tests"
cuda-memcheck --leak-check full ./release/test/ann_tests 2>&1
printf "Finished executing cuda-memcheck output file is release-memcheck-output.txt\n"
printf "Concatenating results of release-build-output.txt and release-memcheck-output.txt into release-output.txt\n"
cat release-build-output.txt release-memcheck-output.txt >> release-output.txt
printf "release-output.txt complete\n"
cuda-memcheck --leak-check full ./release/test/ann_tests > release-memcheck-output.txt 2>&1
fi
fi
#if $# = 3,4,5 etc
printf "Written by Arom Zinhart DeGraca\n"