MacへCUDAの入れ方,最低限の動かし方に関するメモ
ここから,以下の3つをダウンロードします.
ここでは,バージョン4.2を対象として話を進めます. なお、OSはSnow Leopard上で行っています.
基本的にインストーラが整備されているので,インストーラの指示に従ってそのまま入れてください. すべて指示通りにインストールすると,下記の場所にインストールされます.
CUDAのコンパイル等するために,次のパスを下記の環境変数として登録する必要があります.
PATH | /usr/local/cuda/bin |
DYLD_LIBRARY_PATH | /usr/local/cuda/lib |
CUDAのGetting Startedによると.
bash_profileを作成して,そこに書くように書いてあるので,その通りにします.
.bash_profile内 export PATH=/usr/local/cuda/bin:$PATH export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PATH
サンプルプログラムをコンパイルするために,下記のディレクトリに移動し,makeを実行します.
cd /Developer/GPU Computing make
環境変数がきちんと設定されていれば,上記は問題なくいくと思います. いかない場合は,環境変数を確認してください.
コンパイルが行われたサンプルプログラムは下記に出力されます.
/Developer/GPU Computing/C/bin/darwin/release
サンプルプログラムとして,「deviceQuery」を実行します.
cd /Developer/GPU Computing/C/bin/darwin/release ./deviceQuery
MacBook Air 2010年版では,以下のように出ました.
./deviceQuery Starting... CUDA Device Query (Runtime API) version (CUDART static linking) There is 1 device supporting CUDA Device 0: "GeForce 320M" CUDA Driver Version: 3.20 CUDA Runtime Version: 3.20 CUDA Capability Major/Minor version number: 1.2 Total amount of global memory: 265027584 bytes Multiprocessors x Cores/MP = Cores: 6 (MP) x 8 (Cores/MP) = 48 (Cores) Total amount of constant memory: 65536 bytes Total amount of shared memory per block: 16384 bytes Total number of registers available per block: 16384 Warp size: 32 Maximum number of threads per block: 512 Maximum sizes of each dimension of a block: 512 x 512 x 64 Maximum sizes of each dimension of a grid: 65535 x 65535 x 1 Maximum memory pitch: 2147483647 bytes Texture alignment: 256 bytes Clock rate: 0.95 GHz Concurrent copy and execution: Yes Run time limit on kernels: Yes Integrated: Yes Support host page-locked memory mapping: Yes Compute mode: Default (multiple host threads can use this device simultaneously) Concurrent kernel execution: No Device has ECC support enabled: No Device is using TCC driver mode: No deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 3.20, CUDA Runtime Version = 3.20, NumDevs = 1, Device = GeForce 320M PASSED Press <Enter> to Quit... -----------------------------------------------------------