ZZ 如何在Ubuntu 12.04上配置CUDA 4.2
2012-08-10 22:44
549 查看
原文地址 http://www.bfcat.com/index.php/2012/06/ubuntu-12-04-cuda-4-2/
今天运行一个UCLA的光流程序,非常耗时间。看到作者在网站上提供了GPU版的,所以希望能使用CUDA加速的版本。今天晚上按照NVidia论坛上的一个教程,成功的配置好了ubuntu
12.04 64bit版的CUDA 4.2. 现将原文分享如下:
http://forums.nvidia.com/index.php?showtopic=231150
Posted 06 June 2012 -
10:40 PM
This post is to give a complete picture on how to install and
test CUDA 4.2 on Ubuntu 12.04 64 bit. I have found that everything
that needs to be done is quite scattered and needs bringing
together to make CUDA more accessible to more novice users such as
my self. So if this doesn't work for you please post and let us
know and if you know a quicker or better way please enlighten
us!!!
Thanks,
CDS
I hope you find this useful and I would like to credit my
sources:
FCNS
sn0v
The NVIDIA CUDA Getting Started Guide
(Linux)
Note one must have a nVidia GPU which is CUDA capable http://developer.nvidia.com/cuda-gpus
Check is the OS is 32 or 64 bit by running
in a terminal. i686 denotes a 32-bit system, and x86_64 denotes a
64-bit one.
Proceed to CUDA Downloads page: http://developer.nvidia.com/cu
For the toolkit, I chose the one titled Ubuntu 11.04, and save all
three files in an easy to access location, like your Home
folder.
Make sure the requisite tools are installed using the following
command :
Next, blacklist the required modules (so that they don’t interfere
with the driver installation)
Add the following lines to the end of the file, one per line:
Save the file and exit gedit.
In order to get rid of any nVidia residuals, run the following
command in a terminal:
Once it’s done, reboot your machine. At the login screen, don’t
login just yet. Press Ctrl+Alt+F1 to switch to a
text-based login. Login and switch to the directory which contains
the downloaded drivers, toolkit and SDK. Run the following
commands:
Follow the onscreen instructions. If the installer throws up an
error about nouveau kernel still running,
allow it to create a blacklist for nouveau, quit the installation
and reboot. In that case, run the following commands again:
The installation should now proceed smoothly. When it asks you if
you want the 32-bit libraries and if you want it to edit
xorg.conf to use these drivers by default, allow
both.
Reboot once the installation completes.
Next, enter the following in a terminal window (in the directory
where the files are stored):
where cudatoolkit*.run is the full name of the
toolkit installer. I recommend leaving the installation path to its
default setting (/usr/local/cuda) unless you have a
specific reason for not doing so.
The following lines must be added into the .bashrc
file in your home directory:
SDK must be installed as a regular user (and not as root) to prevent access issues with the SDK files.
Once the toolkit is installed, enter the following in a
terminal:
where gpucomputingsdk*.run is the full name of the
SDK installer. Again, follow the instructions onscreen to complete
the installation.
Since there are several linking errors in this compilation several
modifications must be make. You are made aware of this when you
change your working directory to
NVIDIA_GPU_Computing_SDK in your home directory
and then run:
This will result in the following error:
http://www.cnblogs.com/lib/librendercheckgl_x86_64.a(rendercheck_gl. cpp.o): In
function `CheckBackBuffer::checkStatus(char const*, int,
bool)':rendercheck_gl.cpp:(.text+0xfbb): undefined reference to
`gluErrorString'
The fix is contained in the following three steps.
1) change the order for all occurrences of RENDERCHECKLIB in BOTH
/C/common/common.mk and
/CUDALibraries/common/common_cudalib.mk like
this:
OLD:
NEW:
and add -Lhttp://www.cnblogs.com/../C/lib in common_cudalib.mk
RENDERCHECKGLLIB definition line:
OLD:
NEW:
2) In all files that use UtilNPP (boxFilterNPP,
imageSegmentationNPP,
freeImageInteropNPP,
histEqualizationNPP), the makefiles have the wrong
order of library linking ($LIB is before the source/out files), so
go to the /CUDALibraries/src/*NPP/Makefile and
change the order like (note this is an example of the
freeImageInteropNPP file modification, all others
are done similarly):
OLD:
NEW:
3) For randomFog, you also need to add
to the Makefile.
Now go back to the working directory
NVIDIA_GPU_Computing_SDKand run
, this will take some time to fully compile to be patient. Also the
compiler will throw several warning but these should be
ignored.
The version of the CUDA Toolkit can be checked by running
in a terminal window. The nvcc command runs the compiler driver
that compiles CUDA programs. It calls the gcc compiler for C code
and the NVIDIA PTX compiler for the CUDA code.
NVIDIA includes sample programs in source form in the GPU Computing
SDK. You should compile them all by changing to
~/NVIDIA_GPU_Computing_SDK/Cand running
. The resulting binaries will be installed in
~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release.
After compilation, go to
~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release and
run
. If the CUDA software is installed and configured correctly, the
output for deviceQuery should look similar to that shown in Figure
1 of the reference guide provided by NVIDIA. The exact
appearance and the output lines might be different on your system.
The important outcomes are that a device was found (the first
highlighted line), that the device matches the one on your system
(the second highlighted line), and that the test passed (the final
highlighted line). If a CUDA-enabled device and the CUDA Driver are
installed but deviceQuery reports that no CUDA-capable devices are
present, this likely means that the /dev/nvidia* files are missing
or have the wrong permissions.
今天运行一个UCLA的光流程序,非常耗时间。看到作者在网站上提供了GPU版的,所以希望能使用CUDA加速的版本。今天晚上按照NVidia论坛上的一个教程,成功的配置好了ubuntu
12.04 64bit版的CUDA 4.2. 现将原文分享如下:
http://forums.nvidia.com/index.php?showtopic=231150
Posted 06 June 2012 -
10:40 PM
This post is to give a complete picture on how to install and
test CUDA 4.2 on Ubuntu 12.04 64 bit. I have found that everything
that needs to be done is quite scattered and needs bringing
together to make CUDA more accessible to more novice users such as
my self. So if this doesn't work for you please post and let us
know and if you know a quicker or better way please enlighten
us!!!
Thanks,
CDS
I hope you find this useful and I would like to credit my
sources:
FCNS
sn0v
The NVIDIA CUDA Getting Started Guide
(Linux)
Note one must have a nVidia GPU which is CUDA capable http://developer.nvidia.com/cuda-gpus
Check is the OS is 32 or 64 bit by running
uname -m
in a terminal. i686 denotes a 32-bit system, and x86_64 denotes a
64-bit one.
Proceed to CUDA Downloads page: http://developer.nvidia.com/cu
For the toolkit, I chose the one titled Ubuntu 11.04, and save all
three files in an easy to access location, like your Home
folder.
Make sure the requisite tools are installed using the following
command :
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
Next, blacklist the required modules (so that they don’t interfere
with the driver installation)
gksu gedit /etc/modprobe.d/blacklist.conf
Add the following lines to the end of the file, one per line:
blacklist amd76x_edac blacklist vga16fb blacklist nouveau blacklist rivafb blacklist nvidiafb blacklist rivatv
Save the file and exit gedit.
In order to get rid of any nVidia residuals, run the following
command in a terminal:
sudo apt-get remove --purge nvidia*
Once it’s done, reboot your machine. At the login screen, don’t
login just yet. Press Ctrl+Alt+F1 to switch to a
text-based login. Login and switch to the directory which contains
the downloaded drivers, toolkit and SDK. Run the following
commands:
sudo service lightdm stopchmod +x devdriver*.run
Follow the onscreen instructions. If the installer throws up an
error about nouveau kernel still running,
allow it to create a blacklist for nouveau, quit the installation
and reboot. In that case, run the following commands again:
sudo service lightdm stop sudo ./devdriver*.run
The installation should now proceed smoothly. When it asks you if
you want the 32-bit libraries and if you want it to edit
xorg.conf to use these drivers by default, allow
both.
Reboot once the installation completes.
Next, enter the following in a terminal window (in the directory
where the files are stored):
sudo chmod +x cudatoolkit*.run sudo ./cudatoolkit*.run
where cudatoolkit*.run is the full name of the
toolkit installer. I recommend leaving the installation path to its
default setting (/usr/local/cuda) unless you have a
specific reason for not doing so.
The following lines must be added into the .bashrc
file in your home directory:
export PATH=/usr/local/cuda/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=/usr/lib/nvidia-current:$LD_LIBRARY_PATH export CUDA_ROOT=/usr/local/cuda/bin
SDK must be installed as a regular user (and not as root) to prevent access issues with the SDK files.
Once the toolkit is installed, enter the following in a
terminal:
sudo chmod +x gpucomputingsdk*.run sudo ./gpucomputingsdk*.run
where gpucomputingsdk*.run is the full name of the
SDK installer. Again, follow the instructions onscreen to complete
the installation.
Since there are several linking errors in this compilation several
modifications must be make. You are made aware of this when you
change your working directory to
NVIDIA_GPU_Computing_SDK in your home directory
and then run:
sudo make
This will result in the following error:
http://www.cnblogs.com/lib/librendercheckgl_x86_64.a(rendercheck_gl. cpp.o): In
function `CheckBackBuffer::checkStatus(char const*, int,
bool)':rendercheck_gl.cpp:(.text+0xfbb): undefined reference to
`gluErrorString'
The fix is contained in the following three steps.
1) change the order for all occurrences of RENDERCHECKLIB in BOTH
/C/common/common.mk and
/CUDALibraries/common/common_cudalib.mk like
this:
OLD:
LIB += ${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB) ${LIB} -ldl -rdynamic
NEW:
LIB += $(RENDERCHECKGLLIB) ${OPENGLLIB} $(PARAMGLLIB) ${LIB} -ldl –rdynamic
and add -Lhttp://www.cnblogs.com/../C/lib in common_cudalib.mk
RENDERCHECKGLLIB definition line:
OLD:
RENDERCHECKGLLIB := -lrendercheckgl_$(LIB_ARCH)$(LIBSUFFIX)
NEW:
RENDERCHECKGLLIB := -Lhttp://www.cnblogs.com/../C/lib -lrendercheckgl_$(LIB_ARCH)$(LIBSUFFIX)
2) In all files that use UtilNPP (boxFilterNPP,
imageSegmentationNPP,
freeImageInteropNPP,
histEqualizationNPP), the makefiles have the wrong
order of library linking ($LIB is before the source/out files), so
go to the /CUDALibraries/src/*NPP/Makefile and
change the order like (note this is an example of the
freeImageInteropNPP file modification, all others
are done similarly):
OLD:
$(CXX) $(INC) $(LIB) -o freeImageInteropNPP freeImageInteropNPP.cpp -lUtilNPP_$(LIB_ARCH) -lfreeimage$(FREEIMAGELIBARCH)
NEW:
$(CXX) $(INC) -o freeImageInteropNPP freeImageInteropNPP.cpp $(LIB) -lUtilNPP_$(LIB_ARCH) -lfreeimage$(FREEIMAGELIBARCH)
3) For randomFog, you also need to add
USERENDERCHECKGL := 1
to the Makefile.
Now go back to the working directory
NVIDIA_GPU_Computing_SDKand run
make
, this will take some time to fully compile to be patient. Also the
compiler will throw several warning but these should be
ignored.
The version of the CUDA Toolkit can be checked by running
nvcc -V
in a terminal window. The nvcc command runs the compiler driver
that compiles CUDA programs. It calls the gcc compiler for C code
and the NVIDIA PTX compiler for the CUDA code.
NVIDIA includes sample programs in source form in the GPU Computing
SDK. You should compile them all by changing to
~/NVIDIA_GPU_Computing_SDK/Cand running
sudo make
. The resulting binaries will be installed in
~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release.
After compilation, go to
~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release and
run
deviceQuery
. If the CUDA software is installed and configured correctly, the
output for deviceQuery should look similar to that shown in Figure
1 of the reference guide provided by NVIDIA. The exact
appearance and the output lines might be different on your system.
The important outcomes are that a device was found (the first
highlighted line), that the device matches the one on your system
(the second highlighted line), and that the test passed (the final
highlighted line). If a CUDA-enabled device and the CUDA Driver are
installed but deviceQuery reports that no CUDA-capable devices are
present, this likely means that the /dev/nvidia* files are missing
or have the wrong permissions.
相关文章推荐
- 如何在Ubuntu 12.04上配置CUDA 4.2
- Linux Mint 13/Ubuntu 12.04 配置CUDA 4.2 & OpenCV 2.4.2 方法
- ubuntu 12.04如何安装配置samba(windows访问ubuntu)
- Ubuntu 12.04 安装NVIDIA 驱动、CUDA、CAFFE配置
- VS2010下如何配置CUDA4.2
- 转【翻译】如何在Ubuntu 12.04上配置Apache SSL证书
- Ubuntu 12.04 Unity桌面环境vnc配置手记[zz]
- VS2010下如何配置CUDA4.2
- 如何安装Eclipse 4.3 Kepler 或 Eclipse 4.2 Juno 和 先决条件 Oracle Java 7 在 Ubuntu 13.04 Raring / Ubuntu 12.04 Precise LTS / Linux Mint 上
- Caffe + Ubuntu 12.04 64bit + CUDA 5.5 配置说明
- Ubuntu 16.04 LTS 安装 Cuda 配置 GPU加速,不断在登录界面循环,如何解决?
- [梯子搬运]Caffe + Ubuntu 12.04 64bit + CUDA 6.5 配置说明
- GPU学习日记(一)------VS2010下如何配置CUDA4.2
- VS2010下如何配置CUDA4.2
- VS2010下如何配置CUDA4.2
- VS2010下如何配置CUDA4.2
- Caffe + Ubuntu 12.04 64bit + CUDA 6.5 配置说明
- 如何在ubuntu上配置QT
- ubuntu中如何配置mysql