ubuntu12.04搭建CUDA4.2开发环境

实验室老师让调试一个DeepLearning的程序,叫做DropConnecte,必须要在64bit的Linux系统上运行,还要配置CUDA,本人比较笨,重装了好多次Ubuntu之后才整成功,特把整理的资料发到这里

1,动态链接库解决方案http://blog.csdn.net/aquakguo0he1/article/details/9764063



3 显卡问题http://www.linuxidc.com/Linux/2012-08/68629.htm
http://wla137996229.blog.163.com/blog/static/656993572013754243238/
4.ubuntu论坛http://ubuntuforums.org/showthread.php?t=1722306
一,安装python依赖包
sudo apt-get update
sudo apt-get install python-dev 
sudo apt-get install python-numpy
sudo apt-get install python-magic
sudo apt-get install python-matplotlib
sudo apt-get install libatlas-base-dev
二,安装boost
sudo apt-get install libboost-dev
三,安装各种依赖包
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev




附 :
在安装cuda samples的时候需要一个贡献库文件libglut.so,默认没有安装,在终端下输入:
sudo apt-get install freeglut3
这个共享库对于32位的Ubuntu被安装在/usr/lib/i386-linux-gnu/libglut.so.3,而对于64位的Ubuntu被安装在 /usr/lib/x86_64-linux-gnu/libglut.so.3,但cuda默认会去寻找/usr/lib/libglut.so,因此我们还需要加一个软链接:
对于64位系统,在终端下输入:
sudo ln -s /usr/lib/x86_64-linux-gnu/libglut.so.3 /usr/lib/libglut.so


四,将原有驱动加入黑名单
gedit /etc/modprobe.d/blacklist.conf
blacklist amd76x_edac
blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv
五,卸载原有驱动
sudo apt-get remove --purge nvidia*
六,Xwidows操作安装驱动
sudo service lightdm stop
chmod +x。。。。。
七,安装cudatoolkit
cd /media/Work/ubuntu/cudainstallfile
sudo chmod +x cudatoolkit_4.2.9_linux_64_ubuntu11.04.run
sudo cudatoolkit_4.2.9_linux_64_ubuntu11.04.run


八,修改配置文件
gedit ~/.bashrc
    1,在bashrc文本末尾添加如下内容:
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


2,在sudo gedit /etc/ld.so.conf添加
/usr/local/cuda/lib64
        /lib
九,安装SDK
cd /home/laonan/NVIDIA_GPU_Computing_SDK/C
sudo make
 测试安装是否成功
cd /home/laonan/NVIDIA_GPU_Computing_SDK/C/bin/linux/release


十,常见问题解决
1,编译时若是出现类似这样的问题:


    /usr/bin/ld: cannot find -lXi
    /usr/bin/ld: cannot find -lXmu
    /usr/bin/ld: cannot find -lglut
    collect2: ld returned 1 exit status


是表示有一些必要的 Library 没装,用 apt-cache 找一下再用 apt-get 装起来就可以了:


apt-get install libxi-dev libxmu-dev libglut3-dev


2,若出现


    /usr/bin/ld: cannot find -lcuda
    collect2: ld returned 1 exit status





    /usr/bin/ld: cannot find -lGL
    collect2: ld returned 1 exit status


是表示找不到 NVIDIA GL 或 CUDA Library,若是您是使用 Ubuntu 内建的驱动程式管理介面安装的 NVIDIA Driver,则将 /usr/lib/nvidia-current 下面的 so 档件一个连结到 /usr/lib 下面即可:


sudo ln -s /usr/lib/nvidia-current/libcuda.so /usr/lib/libcuda.so
sudo ln -s /usr/lib/nvidia-current/libGL.so /usr/lib/libGL.so




3,解决分辨率变低的问题
 (1)sudo apt-get install v86d


(2)gksu gedit /etc/default/grub
enter your password when asked and hit the Enter key.


- Replace the following line (line number 9):


GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"


with this one:


GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset video=uvesafb:mode_option=1280x1024-24,mtrr=3,scroll=ywrap"


- Replace the following line (line number 18):


#GRUB_GFXMODE=640x480


with this one:


GRUB_GFXMODE=1280x1024


save the file and close it!
(3)gksu gedit /etc/initramfs-tools/modules


When the text window appears, add the following line at the end of the file:


uvesafb mode_option=1280x1024-24 mtrr=3 scroll=ywrap
(4)
echo FRAMEBUFFER=y | sudo tee /etc/initramfs-tools/conf.d/splash


you will get right result like this:FRAMEBUFFER=y
(5)sudo update-grub2
(6)sudo update-initramfs -u


第二种解决分辨率的方法
编辑 gedit /etc/X11/xorg.conf
Section "Device"
   Identifier    "Configured Video Device"
EndSection


Section "Monitor"
   Identifier    "Configured Monitor"
   Horizsync 30-81
   Vertrefresh 56-75
EndSection


Section "Screen"
   Identifier    "Default Screen"
   Monitor        "Configured Monitor"
   Device        "Configured Video Device"
   SubSection "Display"
   Modes "1024x768" "1152x864"
   EndSubSection
EndSection


如果你的xorg.conf编写不正确,导致进不了桌面,请在开机的时候选择recovery mode进入,以root身份登陆文本界面,输入:


rm /etc/X11/xorg.conf


这个命令会删除掉xorg.conf文件


问题三:undefined reference to `gluErrorString'


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 -L../../../C/lib in common_cudalib.mk RENDERCHECKGLLIB definition line:


OLD:
RENDERCHECKGLLIB := -lrendercheckgl_$(LIB_ARCH)$(LIBSUFFIX)


 


NEW:
RENDERCHECKGLLIB := -L../../../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.




附:glx问题
http://superuser.com/questions/484991/nvidia-graphics-driver-in-ubuntu-12-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值