[go: up one dir, main page]

Menu

[r352]: / release-5 / configure.sh  Maximize  Restore  History

Download this file

137 lines (123 with data), 4.1 kB

  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
#!/bin/bash
# Check for nVidias CUDA compiler
echo "Testing for 'nvcc' compiler ..."
if test "$(which nvcc)" == ""
then
echo
echo "*** FAILED TO LOCATE CUDA COMPILER ***"
echo
echo "The CUDA compiler 'nvcc' is not in the current path."
echo "To compile cocolib and the examples, download and install the"
echo "CUDA toolkit version 4.2 or higher from the CUDA zone on"
echo
echo "www.nvidia.com".
echo
echo "After installation, make sure your PATH variable includes the"
echo "install path to the 'nvcc' executable (default /usr/local/cuda/bin)."
echo
exit
else
echo " nVidia CUDA compiler detected ... " `which nvcc`
fi
source local_flags.inc
# Check for supported toolkit version
nvcc_test=$(nvcc --version | grep "release 4.2")
if [ -z "$nvcc_test" ]; then
echo "WARNING: CUDA toolkit is not version 4.2."
echo " If you have a lower version number,"
echo " you have to make sure to use gcc version 4.4"
echo " or older."
else
echo " CUDA toolkit version 4.2 detected."
fi
# Check if minimal example compiles
echo "Testing minimal example compilation ..."
nvcc -o ./config_tests/test_compute_capability ./config_tests/test_compute_capability.cu -lcudart
if [ $? -ne 0 ]; then
echo " ERROR: compiler returned an error."
exit
else
echo " compiled successfully."
fi
# Check compute capability of the device
rm -f extra_nvcc_flags.inc
touch extra_nvcc_flags.inc
./config_tests/test_compute_capability
COMPUTE_CAPABILITY=$?
if [ $COMPUTE_CAPABILITY -lt 13 ]; then
echo "WARNING: Your GPU has compute capability less than 1.3."
echo " This is not completely supported by cocolib - some algorithms may fail."
else
echo " GPU compute capability at least 1.3, which is good."
#
# Vanilla GPU architecture
#
echo "NVFLAGS += --gpu-architecture sm_13" >> extra_nvcc_flags.inc
#
# Use the following instead to optimize GPU architecture - this will invalidate the
# reference results, since exact numeric results will now depend on compiler optimization
# strategy.
#
# echo "NVFLAGS += --gpu-architecture sm_"$COMPUTE_CAPABILITY >> extra_nvcc_flags.inc
#
fi
# Check for GSL library
echo "Testing for GSL library ..."
nvcc -o ./config_tests/test_gsl ./config_tests/test_gsl.cu -lgsl -lgslcblas -I$LOCAL_INCLUDE_PATH -L$LOCAL_LIB_PATH -m64 -lcudart
if [ $? -ne 0 ]; then
echo " ERROR: compiler returned an error."
echo " GSL library might not be installed."
echo " On Ubuntu systems, this is the package libgsl0-dev."
exit
else
echo " compiled successfully."
fi
./config_tests/test_gsl
if [ $? -ne 0 ]; then
echo "WARNING: GSL example returned an error code."
echo " Something might be wrong with the installation."
else
echo " run successfully."
fi
# Create new cocolib defs file
cp cocolib/defs.h.in cocolib/defs.h
rm -f extra_libs.inc
touch extra_libs.inc
# Check for ANN library
echo "Testing for ANN library ..."
nvcc -o ./config_tests/test_ann ./config_tests/test_ann.cu -lann -I$LOCAL_INCLUDE_PATH -L$LOCAL_LIB_PATH -m64
if [ $? -ne 0 ]; then
echo " failed to compile ANN library example."
echo " the library is probably not installed,"
echo " cocolib will compile without ANN support."
echo "//#define LIB_ANN" >> cocolib/defs.h
else
echo " compiled successfully, library seems to be installed."
echo "#define LIB_ANN" >> cocolib/defs.h
echo "LIBS += -lann" >> extra_libs.inc
fi
echo "#endif" >> cocolib/defs.h
# QT4 development tools
echo "Testing for qt4 development tools ..."
qt4_test=$(qmake-qt4 --version | grep "version 4.")
if [ -z "$qt4_test" ]; then
echo " ERROR: failed to detect Qt4."
echo " Make sure you have libqt4-dev installed."
exit
else
echo " success."
fi
# run qmake to create Makefile
echo "Running 'qmake-qt4' for cocolib ..."
qmake-qt4 cocolib.pro
if [ $? -ne 0 ]; then
echo " ERROR: qmake-qt4 returned an error."
exit
else
echo " success."
fi
# clean up
echo "Cleaning up previous builds ..."
make --quiet clean
# done.
echo "Ready, run 'make' to build cocolib."