forked from amusecode/amuse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cuda_self_help
executable file
·143 lines (136 loc) · 4.76 KB
/
cuda_self_help
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#! /bin/bash
# Detects available hardware and various settings to provide help for
# setting up GPGPU with CUDA, required for executing code on a GPU.
# Note that nvidia-settings may not exist in all implementations
# (e.g. with the standard install on MacOS).
echo
echo "Welcome to the AMUSE self-help for setting up GPGPU with CUDA."
echo
echo -n "Checking whether you have the NVIDIA graphics driver... "
which nvidia-settings >& /dev/null
if [ $? -eq 0 ]; then
echo "ok"
echo -n "Checking the NVIDIA graphics driver version... "
echo `nvidia-settings -q NvidiaDriverVersion | gawk '{ORS = " " ; print $4}'`
else
echo "no"
echo " Couldn't find the nvidia-settings utility (used to configure "
echo " the NVIDIA graphics driver). Do you have an NVIDIA GPU card?"
echo " "
echo " "
fi
echo -n "Checking 32/64 bit... "
uname -i | grep '64' >& /dev/null
if [ $? -eq 0 ]; then
echo "64 bit hardware platform."
X_BITS_LIB="lib64"
else
echo "32 bit hardware platform."
X_BITS_LIB="lib"
fi
echo
echo "Checking relevant environment variables... "
echo -n "Searching LD_LIBRARY_PATH... "
found=0
IFS=$':'
for one_path in $LD_LIBRARY_PATH
do
if [ -e $one_path/libcudart.so ]; then
echo "found libcudart.so in directory " $one_path
found=1
fi
done
if [ $found == 0 ]; then
echo "libcudart.so not found in LD_LIBRARY_PATH. Do either of:"
echo " bash> export LD_LIBRARY_PATH=/path/to/cudalib:\$LD_LIBRARY_PATH"
echo " csh> setenv LD_LIBRARY_PATH /path/to/cudalib:\$LD_LIBRARY_PATH"
exit 1
fi
echo -n "Checking CUDA_SDK... "
if [ -n "$CUDA_SDK" ]; then
if [ -d $CUDA_SDK/common/inc ]; then
echo "ok"
else
echo "set, but unable to find CUDA SDK path. please set the CUDA_SDK "
echo " variable to the directory that holds the common/inc subdirectory, "
echo " typically: /path/to/cudasdk/C"
exit 1
fi
else
if [ -d /disks/koppoel1/CUDA23/cudasdk/C/common/inc ]; then
echo "not set, but default CUDA SDK path exists: ok"
else
echo "unable to find CUDA SDK path. Please set the CUDA_SDK variable "
echo " to the directory where you installed the CUDA SDK. Do either of:"
echo " bash> export CUDA_SDK=/path/to/cudasdk"
echo " csh> setenv CUDA_SDK /path/to/cudasdk"
exit 1
fi
fi
echo -n "Checking CUDA_TK... "
if [ -n "$CUDA_TK" ]; then
if [ -d $CUDA_TK/include ]; then
echo "ok"
else
echo "set, but unable to find CUDA TK path. please set the CUDA_TK "
echo " variable to the directory that holds the include subdirectory, "
echo " typically: /path/to/cuda"
exit 1
fi
else
if [ -d /disks/koppoel1/CUDA23/cuda/include ]; then
echo "not set, but default CUDA TK path exists: ok"
CUDA_TK=/disks/koppoel1/CUDA23/cuda
else
echo "unable to find CUDA TK path. Please set the CUDA_TK variable "
echo " to the directory where you installed the CUDA TK. Do either of:"
echo " bash> export CUDA_TK=/path/to/cuda"
echo " csh> setenv CUDA_TK /path/to/cuda"
exit 1
fi
fi
echo -n "Checking CUDA_LIBDIRS... "
if [ -n "$CUDA_LIBDIRS" ]; then
if [ -e $CUDA_LIBDIRS/libcudart.so ]; then
echo "ok"
else
echo "set, but unable to find the libraries. please set the CUDA_LIBDIRS "
echo " variable to the directory that holds the libcudart.so library, "
echo " typically: /path/to/cuda/$X_BITS_LIB"
exit 1
fi
else
if [ -e $CUDA_TK/$X_BITS_LIB/libcudart.so ]; then
echo "not set, but found libraries in default path: ok"
else
echo "unable to find the CUDA libraries. Please set the CUDA_LIBDIRS variable "
echo " to the directory where the CUDA libraries reside. Do either of:"
echo " bash> export CUDA_LIBDIRS=/path/to/cuda/$X_BITS_LIB"
echo " csh> setenv CUDA_LIBDIRS /path/to/cuda/$X_BITS_LIB"
exit 1
fi
fi
echo -n "Checking CUDA_LIBS... "
if [ -n "$CUDA_LIBS" ]; then
echo $CUDA_LIBS | grep 'lcudart' >& /dev/null
if [ $? -eq 0 ]; then
echo "ok"
else
echo "set, but cudart library not included. Add -lcudart to CUDA_LIBS"
exit 1
fi
else
echo "not set, using default: ok"
fi
echo
echo "Everything seems ok!"
echo "Now try building for example Octgrav and run the nosetests (from AMUSE root directory),"
echo "but first re-initialize mpd (or it will remember its original environment):"
echo "> mpdallexit"
echo "> mpd &"
echo "> make octgrav.code"
echo "> nosetests test/codes_tests/test_octgrav.py"
echo
echo "If this fails, please contact us at: vriesn (at) strw.leidenuniv.nl or"
echo "join us on the #amuse channel on irc.freenode.net."
echo