-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathconfigure.sh
executable file
·69 lines (46 loc) · 1.5 KB
/
configure.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
#!/bin/bash
cuda_path=$1
RED='\033[0;31m'
NC='\033[0m' # No Color
if [ "$cuda_path" = "" ]; then
echo -e "${RED}Must provide path to CUDA installation directory${NC}"
echo -e "${RED}Configuration incomplete${NC}"
echo -e "${RED}Exiting${NC}"
exit 1
fi
cuda_nvcc_path=$cuda_path/bin/nvcc
if [ -f $cuda_nvcc_path ]; then
echo "NVCC found ($cuda_nvcc_path)"
else
echo -e "${RED}NVCC not found${NC}"
echo -e "${RED}Configuration incomplete${NC}"
echo -e "${RED}Exiting${NC}"
exit 1
fi
cuda_lib_path="${cuda_path}/targets/x86_64-linux/lib"
if [ -d $cuda_lib_path ]; then
echo "CUDA runtime library found (${cuda_lib_path})"
else
echo -e "${RED}CUDA runtime library not found${NC}"
echo -e "${RED}Configuration incomplete${NC}"
echo -e "${RED}Exiting${NC}"
exit 1
fi
cuda_runtime_file="${cuda_path}/targets/x86_64-linux/include/cuda_runtime.h"
if [ -f $cuda_runtime_file ]; then
echo "CUDA runtime header file found (${cuda_runtime_file})"
else
echo -e "${RED}CUDA runtime header file not found${NC}"
echo -e "${RED}Configuration incomplete${NC}"
echo -e "${RED}Exiting${NC}"
exit 1
fi
echo "Configuring Makefile..."
sed -i "s,NVCC=.*,NVCC=$cuda_nvcc_path,g" Makefile
echo "Configuring gasal.h..."
sed -i "s,.*cuda_runtime\.h\",\#include \"$cuda_runtime_file\",g" ./src/gasal.h
echo "Configuring Makefile of test program..."
sed -i "s,CUDA_LD_LIBRARY=.*,CUDA_LD_LIBRARY=$cuda_lib_path,g" ./test_prog/Makefile
#mkdir -p include
#cp ./src/gasal.h ./include
echo "Done"