您对在Ubuntu 12.10上安装CUDA API的印象如何?我已经读到了与gcc的某些不兼容(此处即为),您必须重新安装v.4.4,但即使那样,您也可能会破坏系统。因为我不想再次重新安装sys(我最近做了几次:p),所以我想问一下这个脚本在amd proc上的x64 Ubuntu 12.10上是否安全。
我接受的答案允许使用4.6安装CUDA 3组件,但驱动程序不合适,也许只有gcc-4.4和g ++-4.4确实合适-现在我尝试4.4
因此,请阅读Soroosh129的答案,然后按照他的描述应用我的其他建议。
补充笔记:
您必须将CUDA添加到PATH和LD_LIBRARY_PATH,我已在我的主目录和根主目录文件夹中将以下内容添加到.bashrc中:
export PATH=$PATH:/usr/local/cuda-5.0/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-5.0/lib64:/lib
终于我安装了没有驱动程序。只是CUDA Toolkit和不带驱动程序的示例,并使用我的默认“ NVIDIA nvidia-current的NVIDIA二进制Xorg驱动程序,内核模块和VDPAU库”。结果
> Toolkit:Installed, Samples:Instaled
but also
> "Incomplete installation. this didn't install CUDA driver. driver
> version at least 304.54 required for CUDA 5.0 to work"
可能这是正确安装的,我在时钟示例中完成了make,结果如下:
me@comp:/usr/local/cuda-5.0/samples/0_Simple/clock$ ls
clock.cu Makefile NsightEclipse.xml readme.txt
me@comp:/usr/local/cuda-5.0/samples/0_Simple/clock$ sudo make
[sudo] password for me:
/usr/local/cuda-5.0/bin/nvcc -m64 -gencode arch=compute_10,code=sm_10 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -I/usr/local/cuda-5.0/include -I. -I.. -I../../common/inc -o clock.o -c clock.cu
g++ -m64 -o clock clock.o -L/usr/local/cuda-5.0/lib64 -lcudart
mkdir -p ../../bin/linux/release
cp clock ../../bin/linux/release
me@comp:/usr/local/cuda-5.0/samples/0_Simple/clock$ ./clock
CUDA Clock sample
GPU Device 0: "GeForce GT 630" with compute capability 2.1
Total clocks = 54830
me@comp:/usr/local/cuda-5.0/samples/0_Simple/clock$
再举一个例子:
me@comp:/usr/local/cuda-5.0/samples/0_Simple$ cd asyncAPI
me@comp:/usr/local/cuda-5.0/samples/0_Simple/asyncAPI$ ls
asyncAPI.cu Makefile NsightEclipse.xml readme.txt
me@comp:/usr/local/cuda-5.0/samples/0_Simple/asyncAPI$ sudo make
/usr/local/cuda-5.0/bin/nvcc -m64 -gencode arch=compute_10,code=sm_10 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -I/usr/local/cuda-5.0/include -I. -I.. -I../../common/inc -o asyncAPI.o -c asyncAPI.cu
g++ -m64 -o asyncAPI asyncAPI.o -L/usr/local/cuda-5.0/lib64 -lcudart
mkdir -p ../../bin/linux/release
cp asyncAPI ../../bin/linux/release
me@comp:/usr/local/cuda-5.0/samples/0_Simple/asyncAPI$ ls
asyncAPI asyncAPI.cu asyncAPI.o Makefile NsightEclipse.xml readme.txt
me@comp:/usr/local/cuda-5.0/samples/0_Simple/asyncAPI$ ./asyncAPI
[./asyncAPI] - Starting...
GPU Device 0: "GeForce GT 630" with compute capability 2.1
CUDA device [GeForce GT 630]
time spent executing by the GPU: 32.30
time spent by CPU in CUDA calls: 0.04
CPU executed 114066 iterations while waiting for GPU to finish
me@comp:/usr/local/cuda-5.0/samples/0_Simple/asyncAPI$
这是关于StackOverflow的相关问题。
谢谢Soroosh129!
安装CUDA工具包:
下载CUDA工具包:
首先从此处下载适用于Ubuntu 11.10的CUDA工具包。还可以从repos中获得CUDA工具包,因此也许可以使用,但我尚未对其进行测试:
sudo apt-get install nvidia-cuda-toolkit
After you have downloaded the *.run file place it where you can find it easily, for example on the desktop.
Prerequisites:
Before installing the CUDA toolkit, first install freeglut3 as it is needed by CUDA Samples:
sudo apt-get install freeglut3 freeglut3-dev
Then it is recommended that you make a sim link to this version of freeglut just in case, but you might be OK if you don't have any other versions of freeglut:
First remove the existing sim link:
sudo rm /usr/lib/libglut.so
Then add your own sim link:
sudo ln -s /usr/lib/x86_64-linux-gnu/libglut.so.3 /usr/lib/libglut.so
Now it is necessary to remove existing gcc
and g++
sim links because they already exist by default:
Remove the existing sim links:
sudo rm /usr/bin/cpp
sudo rm /usr/bin/gcc
sudo rm /usr/bin/g++
Then install gcc-4.6
and g++-4.6
(you have the option to install gcc 4.4 as well but in my opinion 4.6 is better):
sudo apt-get install gcc-4.6 g++-4.6
Then make a sim link to these compilers so that CUDA use this compiler as it's primary compiler:
sudo ln -s /usr/bin/cpp-4.6 /usr/bin/cpp
sudo ln -s /usr/bin/gcc-4.6 /usr/bin/gcc
sudo ln -s /usr/bin/g++-4.6 /usr/bin/g++
Installing the CUDA toolkit:
Press Ctrl + Alt + F1
, this will take you to the first virtual terminal. Enter your user and password, and navigate to the folder which you've located the file, for example in case you have placed it on Desktop use:
cd ~/Desktop/
Then add execution permissions to the *.run
file:
sudo chmod +x cudatoolkit*.run
Replace cudatoolkit*.run
with the actual name of the downloaded file, in your case cuda_5.0.35_linux_64_ubuntu11.10-1.run .
Then stop the lightdm
service:
sudo service lightdm stop
and finally run the CUDA toolkit:
sudo ./cudatoolkit*.run
again replace cudatoolkit*.run
with the actual name. Then follow the onscreen instructions.
Note:
In case something goes wrong, even with gcc-4.4 you can remove it using:
sudo apt-get remove gcc-4.x g++-4.x
Replace x with your version.
最后,您可以通过将sim链接还原为原始链接,将其还原为原来的样子:
sudo rm /usr/bin/cpp
sudo rm /usr/bin/gcc
sudo rm /usr/bin/g++
sudo ln -s /usr/bin/cpp-4.7 /usr/bin/cpp
sudo ln -s /usr/bin/gcc-4.7 /usr/bin/gcc
sudo ln -s /usr/bin/g++-4.7 /usr/bin/g++
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句