CUDA is a parallel computing platform and programming model that enables dramatic increases in computing performance by harnessing the power of the graphics processing unit (GPU).
In this post, I will tell you how to get started with CUDA on Mac OS. To use CUDA on your system, you will need the following installed:
- CUDA-enabled GPU. A list of such GPUs is available here
- Mac OS X v. 10.5.6 or later (10.6.3 or later for 64-bit CUDA applications)
- The gcc compiler and toolchain installed using Xcode
- CUDA software (available at no cost from http://developer.nvidia.com/cuda/cuda-downloads)
Once you have verified that you have a supported NVIDIA processor and a supported version the Mac OS, you need to download the CUDA software. Download the following packages for the latest version of the Development Tools from the site above:
- CUDA Driver
- CUDA Toolkit
- GPU Computing SDK
Installation:
- Install the CUDA Driver
Install the CUDA driver package by executing the installer and following the on-screen prompts. This will install /Library/Framework/CUDA.framework and the UNIX-compatibility stub /usr/local/cuda/lib/libcuda.dylib that refers to it - Install the CUDA Toolkit
Install the CUDA Toolkit by executing the Toolkit installer package and following the on-screen prompts. The CUDA Toolkit supplements the CUDA Driver with compilers and additional libraries and header files that are installed into /usr/local/cuda by default - Define the environment variables
– The PATH variable needs to include /usr/local/cuda/bin
– DYLD_LIBRARY_PATH needs to contain /usr/local/cuda/lib
The typical way to place these values in your environment is with the following commands:
export PATH=/usr/local/cuda/bin:$PATH
export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PAT
To make these settings permanent, place them in ~/.bash_profile - Install CUDA SDK
The default installation process places the files in/Developer/GPU Computing
To compile the examples, cd into /Developer/GPU Computing/C and type make. The resulting binaries will be installed under the home directory in /Developer/GPU Computing/C/bin/darwin/release
Verify the installation by running ./deviceQuery, the output of which should be something like this
Now, you are all set to start with CUDA programming!
References: