|
1 | 1 | #!/bin/bash |
2 | 2 | set -euxo pipefail |
3 | 3 |
|
| 4 | + |
4 | 5 | tests() { |
| 6 | + # Where are we? (A40 or Orin?) |
| 7 | + cpp_version=17 # default |
| 8 | + sm_arch=86 # default |
| 9 | + hwInfoOrin=`lshw | grep Orin` || |
| 10 | + if [ ! -z "${hwInfoOrin}" ]; then |
| 11 | + echo "Running on Orin"; |
| 12 | + sm_arch=87 |
| 13 | + cpp_version=17 |
| 14 | + else |
| 15 | + echo "Not running on Orin"; |
| 16 | + sm_arch=86 |
| 17 | + cpp_version=20 |
| 18 | + fi |
| 19 | + |
5 | 20 | # ------------------------------------ |
6 | 21 | # Run tensor gtests |
7 | 22 | # ------------------------------------ |
8 | 23 |
|
9 | 24 | # -- create build files |
10 | | - cmake -S . -B ./build -Wno-dev |
| 25 | + cmake -DCPPVERSION=${cpp_version} -DSM_ARCH=${sm_arch} -S . -B ./build -Wno-dev |
11 | 26 |
|
12 | 27 | # -- build files in build folder |
13 | 28 | cmake --build ./build |
14 | 29 |
|
15 | 30 | # -- run tests |
16 | 31 | ctest --test-dir ./build/test --output-on-failure |
17 | 32 |
|
18 | | - # -- run compute sanitizer |
19 | | - cd ./build/test |
20 | | - mem=$(/usr/local/cuda-12.3/bin/compute-sanitizer --tool memcheck --leak-check=full ./device_test) |
21 | | - grep "0 errors" <<< "$mem" |
22 | | - cd ../.. |
| 33 | + if [ -z "${hwInfoOrin}" ]; then |
23 | 34 |
|
24 | | - # ------------------------------------ |
25 | | - # Run example executable |
26 | | - # ------------------------------------ |
| 35 | + # -- run compute sanitizer |
| 36 | + cd ./build/test |
| 37 | + mem=$(/usr/local/cuda/bin/compute-sanitizer --tool memcheck --leak-check=full ./device_test) |
| 38 | + grep "0 errors" <<< "$mem" |
| 39 | + cd ../.. |
27 | 40 |
|
28 | | - # -- create build files |
29 | | - cd example |
30 | | - cmake -S . -B ./build -Wno-dev |
| 41 | + # ------------------------------------ |
| 42 | + # Run example executable |
| 43 | + # ------------------------------------ |
31 | 44 |
|
32 | | - # -- build files in build folder |
33 | | - cmake --build ./build |
| 45 | + # -- create build files |
| 46 | + cd example |
| 47 | + cmake -DCPPVERSION=${cpp_version} -DSM_ARCH=${sm_arch} -S . -B ./build -Wno-dev |
| 48 | + |
| 49 | + # -- build files in build folder |
| 50 | + cmake --build ./build |
34 | 51 |
|
35 | | - # -- run main.cu |
36 | | - ./build/example_main |
| 52 | + # -- run main.cu |
| 53 | + ./build/example_main |
37 | 54 |
|
38 | | - # -- run compute sanitizer |
39 | | - cd ./build |
40 | | - mem=$(/usr/local/cuda-12.3/bin/compute-sanitizer --tool memcheck --leak-check=full ./example_main) |
41 | | - grep "0 errors" <<< "$mem" |
| 55 | + # -- run compute sanitizer |
| 56 | + cd ./build |
| 57 | + mem=$(/usr/local/cuda/bin/compute-sanitizer --tool memcheck --leak-check=full ./example_main) |
| 58 | + grep "0 errors" <<< "$mem" |
| 59 | + fi |
42 | 60 | } |
43 | 61 |
|
44 | 62 |
|
|
0 commit comments