| 185 | |
| 186 | == 步驟九: 安裝 CUDA Toolkit & SDK == |
| 187 | '''# 安裝環境所需套件''' [[BR]] |
| 188 | rider@nvidia:~$ sudo apt-get install autoconf automake build-essential gcc make mesa-common-dev libglu1-mesa-dev mesa-utils libxmu-headers libxmu6 libxmu-dev zlib1g-dev libjpeg62 libjpeg62-dev xutils-dev libxaw-headers libxaw7 libxaw7-dev libxext6 libxext-dev rxvt lwm xauth xvfb xfonts-100dpi xfonts-75dpi culmus xfonts-scalable xfonts-base libtool initramfs-tools libxi6 libxi-dev linux-kernel-devel xserver-xorg xserver-xorg-core xserver-xorg-dev[[BR]] |
| 189 | '''# 下載 NVIDIA CUDA toolkit''' [[BR]] |
| 190 | rider@nvidia:~$ mkdir -p nvidia [[BR]] |
| 191 | rider@nvidia:~$ mkdir -p ./nvidia/cuda [[BR]] |
| 192 | rider@nvidia:~$ cd ./nvidia/cuda/ [[BR]] |
| 193 | rider@nvidia:~/nvidia/cuda$ wget http://developer.download.nvidia.com/compute/cuda/2_1/toolkit/cudatoolkit_2.1_linux64_ubuntu8.04.run [[BR]] |
| 194 | |
| 195 | '''# 下載 NVIDIA CUDA SDK''' [[BR]] |
| 196 | rider@nvidia:~/nvidia/cuda$ wget http://developer.download.nvidia.com/compute/cuda/2_1/SDK/cuda-sdk-linux-2.10.1215.2015-3233425.run [[BR]] |
| 197 | rider@nvidia:~/nvidia/cuda$ chmod a+x * [[BR]] |
| 198 | rock@cloud:~$ sudo apt-get install autoconf automake build-essential gcc make libtool initramfs-tools libxi6 libxi-dev libxmu6 libxmu-dev xserver-xorg-core xserver-xorg-dev [[BR]] |
| 199 | |
| 200 | '''# 安裝 NVIDIA CUDA toolkit''' [[BR]] |
| 201 | rider@nvidia:~/nvidia/cuda$ sudo sh cudatoolkit_2.1_linux64_ubuntu8.04.run [[BR]] |
| 202 | {{{ |
| 203 | Enter install path (default /usr/local/cuda, '/cuda' will be appended): |
| 204 | }}} |
| 205 | |
| 206 | # Note: |
| 207 | {{{ |
| 208 | * Please make sure your PATH includes /usr/local/cuda/bin |
| 209 | * Please make sure your LD_LIBRARY_PATH includes /usr/local/cuda/lib |
| 210 | * or add /usr/local/cuda/lib to /etc/ld.so.conf and run ldconfig as root |
| 211 | |
| 212 | * Please read the release notes in /usr/local/cuda/doc/ |
| 213 | |
| 214 | * To uninstall CUDA, delete /usr/local/cuda |
| 215 | * Installation Complete |
| 216 | }}} |
| 217 | |
| 218 | '''# 安裝 NVIDIA CUDA SDK''' [[BR]] |
| 219 | rock@cloud:~/nvidia/cuda$ sudo sh cuda-sdk-linux-2.10.1215.2015-3233425.run [[BR]] |
| 220 | |
| 221 | # Note: |
| 222 | {{{ |
| 223 | {{{ |
| 224 | Enter install path (default /usr/local/cuda, '/cuda' will be appended): /usr/local/NVIDIA_CUDA_SDK |
| 225 | }}} |
| 226 | |
| 227 | }}} |
| 228 | {{{ |
| 229 | Configuring SDK Makefile (/usr/local/NVIDIA_CUDA_SDK/common/common.mk)... |
| 230 | |
| 231 | * Please make sure your PATH includes /usr/local/cuda/bin |
| 232 | * Please make sure your LD_LIBRARY_PATH includes /usr/local/cuda/lib |
| 233 | |
| 234 | * To uninstall the NVIDIA CUDA SDK, please delete /usr/local/NVIDIA_CUDA_SDK |
| 235 | }}} |
| 236 | |
| 237 | '''# 設定 CUDA 執行環境''' [[BR]] |
| 238 | rider@cloud:~$ sudo su |
| 239 | root@cloud:~$ echo "export PATH=$PATH:/usr/local/cuda/bin" >> /etc/profile [[BR]] |
| 240 | root@cloud:~$ source /etc/profile [[BR]] |
| 241 | root@cloud:~$ echo "/usr/local/cuda/lib" >> /etc/ld.so.conf [[BR]] |
| 242 | root@cloud:~$ ldconfig [[BR]] |
| 243 | root@cloud:~$ exit |
| 244 | |
| 245 | == 步驟十: 試跑 CUDA 範例 == |
| 246 | '''# 進入 CUDA 專案目錄''' [[BR]] |
| 247 | rider@nvidia:~$ cd /usr/local/NVIDIA_CUDA_SDK/projects/ [[BR]] |
| 248 | '''# 編譯建構全部範例''' [[BR]] |
| 249 | rider@nvidia:/usr/local/NVIDIA_CUDA_SDK/projects$ sudo make [[BR]] |
| 250 | '''# 選擇一各 CUDA 範例''' [[BR]] |
| 251 | rider@nvidia:/usr/local/NVIDIA_CUDA_SDK/projects$ cd ./deviceQuery/ [[BR]] |
| 252 | rider@nvidia:/usr/local/NVIDIA_CUDA_SDK/projects/deviceQuery$ sudo make [[BR]] |
| 253 | '''# 進入編譯完成的專案目錄''' [[BR]] |
| 254 | rider@nvidia:/usr/local/NVIDIA_CUDA_SDK/projects/deviceQuery$ cd ../../bin/linux/release/ [[BR]] |
| 255 | '''# 執行''' [[BR]] |
| 256 | rider@nvidia:/usr/local/NVIDIA_CUDA_SDK/projects/deviceQuery$ sudo ./deviceQuery [[BR]] |
| 257 | '''# 輸出結果''' [[BR]] |
| 258 | {{{ |
| 259 | Device 0: "GeForce 9800 GT" |
| 260 | Major revision number: 0 |
| 261 | Minor revision number: 0 |
| 262 | Total amount of global memory: 6385920 bytes |
| 263 | Number of multiprocessors: 11007 |
| 264 | Number of cores: 88056 |
| 265 | Total amount of constant memory: 6385872 bytes |
| 266 | Total amount of shared memory per block: 3236702400 bytes |
| 267 | Total number of registers available per block: 6385904 |
| 268 | Warp size: 0 |
| 269 | Maximum number of threads per block: 0 |
| 270 | Maximum sizes of each dimension of a block: 0 x 6385808 x 0 |
| 271 | Maximum sizes of each dimension of a grid: 0 x 0 x 2 |
| 272 | Maximum memory pitch: 3234490924 bytes |
| 273 | Texture alignment: 3236702608 bytes |
| 274 | Clock rate: 0.00 GHz |
| 275 | Concurrent copy and execution: Yes |
| 276 | }}} |
| 277 | |
| 278 | |