Appendix 1

Download and Install the CUDA Library

A1.1 CUDA Toolkit Download

To get started with CUDA on our system, we first need to install the CUDA development tools and ensure the correct operation of these tools. We can download the CUDA toolkit from the NVIDIA website at http://www.nvidia.com/content/cuda/cuda-downloads.html (Figure A1.1).

image

Figure A1.1 CUDA downloads for various systems.

A1.2 Installation

You choose and download the installer for the system you use from the link in Figure A1.1. Once the download is complete, you can start installing by executing the installer and following the on-screen prompts, for example,

• For Widows 7 64 bit, see Figure A1.2.

• For Mac OS X, see Figure A1.3.

• For Linux, see Figure A1.4.

image

Figure A1.2 Windows CUDA Installer.

image

Figure A1.3 Mac OS X CUDA Installer.

image

Figure A1.4 Linux CUDA Installer.

Once the installation is complete, verify if CUDA is installed and configured correctly. Knowing where the CUDA toolkit is installed and how it is configured on the system makes the CUDA programming experience much more pleasant. If we follow the default installation options, we have CUDA installed for each system as follows:

• For Window 7 64 bit, C:Program FilesNVIDIA GPU Computing ToolkitCUDAv5.0 (Figure A1.5).

• For Mac OS X, /Developer/NVIDIA/CUDA-5.0 (Figure A1.6).

• For Linux, /usr/local/cuda-5.0 (Figure A1.7).

image

Figure A1.5 Windows CUDA Default Installation Directory.

image

Figure A1.6 Mac OS X Default Installation Directory.

image

Figure A1.7 Linux Default Installation Directory (Ubuntu, in this example).

For each system, try to identify the following files in the following subdirectories.

• nvcc.exe or nvcc at bin.

• cuda_runtime.h at include.

• cudart.lib at lib64 for Windows 7 64 bit.

• libcudart.so at lib for Linux.

• libcudart.dylib at lib for Mac OS X.

A1.3 Verification

Now, the most important thing is to be able to execute the CUDA compiler, nvcc, from the command prompt. Open the command prompt window in Windows or shell in Linux or Mac OS X. Try to execute the command in Figure A1.8 at the prompt. If you are unable to run nvcc at the command prompt, make sure the bin directory of the installed CUDA toolkit is in your system environment.

• For Windows 7 64 bit, enter PATH at the prompt and see if the directory that has nvcc is specified as in Figure A1.9.

• For Mac OS X and Linux, type in echo $PATH at the prompt in the shell and make sure the path to nvcc is specified Figures A1.10 and A1.11).

image

Figure A1.8 The nvcc version verification.

image

Figure A1.9 The nvcc PATH in the Windows environment.

image

Figure A1.10 The nvcc PATH in the Mac OS X.

image

Figure A1.11 The nvcc PATH in the Linux environment.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.167.248