2015年5月14日 星期四

Ubuntu 15.04 CUDA 配置


首先,我安裝一些編譯的包
sudo apt-get install build-essential
接著,用ALT+ CTRL +F1 進入文字模式,並把 lightdm 關掉
sudo service lightdm stop
安裝驅動源(這步驟我不清楚是什麼)
sudo add-apt-repository ppa:xorg-edgers/ppa
sudo apt-get update
安裝 nvidaia 的驅動程式
sudo apt-get install nvidia-340
sudo apt-get install nvidia-340-uvm
到官方網站下載CUDA 7 
選擇Linux x86 中的 Ubuntu 14.10 版本並下載
https://developer.nvidia.com/cuda-downloads
安裝下載的檔案:
sudo dpkg –i [剛剛下載的那個檔案]
更新 apt-get 
sudo apt-get update
安裝CUDA TOOLKIT(這步我也不是很理解,在windows下只要安裝完下載的那個檔案就可以了)
sudo apt-get install -y cuda
修改環境變數,這部分和windows差不多,讓系統可以很方便的去找到庫文件
export cuda_home=/usr/local/cuda-7.0
export LD_LIBRARY_PATH=${cuda_homw}/lib64
PATH=${cuda_homw}/bin:${PATH}
export PATH
以上過程如果沒出錯,那大概就算完成了。
如果需要測試的話,可以到 /usr/local/cuda-7.0/samples 中去找範例來執行看看,照理來說應該是可以直接跑。
這裡我是使用 1_Utilities/bandwidthTest 來測試,跑出來的結果應該類似下面這種格式:

[CUDA Bandwidth Test] - Starting...
Running on...

Device 0: GeForce GT 540M
Quick Mode

Host to Device Bandwidth, 1 Device(s)
PINNED Memory Transfers
   Transfer Size (Bytes)        Bandwidth(MB/s)
   33554432                     6458.8

Device to Host Bandwidth, 1 Device(s)
PINNED Memory Transfers
   Transfer Size (Bytes)        Bandwidth(MB/s)
   33554432                     5794.6

Device to Device Bandwidth, 1 Device(s)
PINNED Memory Transfers
   Transfer Size (Bytes)        Bandwidth(MB/s)
   33554432                     24402.9

Result = PASS

NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.

沒有留言:

張貼留言