NVIDIA CUDA C GETTING
STARTED GUIDE FOR MAC OS X
DU-05348-001_v02 | August 2010
Installation and Verification on Mac OS X
DOCUMENT CHANGE HISTORY
DU-05348-001_v02
Version Date
Authors
Description of Change
01
02
April 20, 2010
CW, TS
Release
August 19, 2010
CW
Updated for CUDA Toolkit 3.2
NVIDIA CUDA C Getting Started Guide for Mac OS X
DU-05348-001_v02 | ii
TABLE OF CONTENTS
Introduction .............................................................................. 1
System Requirements ........................................................................... 2
About This Document ........................................................................... 2
Installing CUDA Development Tools ............................................... 3
Verify You Have a CUDA-Enabled System .................................................... 3
Verify the Correct Version of Mac OS X ...................................................... 4
Verify That gcc Is Installed .................................................................. 4
Download the CUDA Software ................................................................. 5
Install the CUDA Driver and Software ........................................................ 5
Verify the Installation ........................................................................... 6
Verify the Driver Installation ................................................................ 6
Compiling the Examples ..................................................................... 7
Running the Binaries ......................................................................... 7
Additional Considerations .......................................................... 10
NVIDIA CUDA C Getting Started Guide for Mac OS X
DU-05348-001_v02 | iii
LIST OF FIGURES
Figure 1. About This Mac Dialog Box .......................................................... 4
Figure 2. Valid Results from Sample CUDA deviceQuery Program ......................... 8
Figure 3. Valid Results from Sample CUDA bandwidthTest Program ...................... 9
NVIDIA CUDA C Getting Started Guide for Mac OS X
DU-05348-001_v02 | iv
INTRODUCTION
NVIDIA® CUDATM is a general purpose parallel computing architecture introduced by
NVIDIA. It includes the CUDA Instruction Set Architecture (ISA) and the parallel
compute engine in the GPU. To program to the CUDA architecture, developers can use
C, one of the most widely used high-level programming languages, which can then be
run at great performance on a CUDA-enabled processor.
The CUDA architecture and its associated software were developed with several design
goals in mind:
Provide a small set of extensions to standard programming languages, like C, that
enable a straightforward implementation of parallel algorithms. With CUDA and C
for CUDA, programmers can focus on the task of parallelization of the algorithms
rather than spending time on their implementation.
Support heterogeneous computation where applications use both the CPU and GPU.
Serial portions of applications are run on the CPU, and parallel portions are
offloaded to the GPU. As such, CUDA can be incrementally applied to existing
applications. The CPU and GPU are treated as separate devices that have their own
memory spaces. This configuration also allows simultaneous computation on both
the CPU and GPU without contention for memory resources.
CUDA-enabled GPUs have hundreds of cores that can collectively run thousands of
computing threads. Each core has shared resources, including registers and memory.
The on-chip shared memory allows parallel tasks running on these cores to share data
without sending it over the system memory bus.
This guide will show you how to install and check the correct operation of the CUDA
Development Tools.
NVIDIA CUDA C Getting Started Guide for Mac OS X
DU-05348-001_v02 | 1
Introduction
SYSTEM REQUIREMENTS
To use CUDA on your system, you will need the following installed:
CUDA-enabled GPU
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://www.nvidia.com/cuda)
ABOUT THIS DOCUMENT
This document is intended for readers familiar with the Mac OS X environment and the
compilation of C programs from the command line. You do not need previous
experience with CUDA or experience with parallel computation.
NVIDIA CUDA C Getting Started Guide for Mac OS X
DU-05348-001_v02 | 2
INSTALLING CUDA DEVELOPMENT TOOLS
The installation of CUDA development tools on a system running Mac OS X consists of
three simple steps:
Verify the system has a CUDA-enabled GPU, a supported version of Mac OS X, and
that gcc has been installed via Xcode.
Download the CUDA driver and software.
Install the CUDA driver and software.
Test your installation by compiling and running one of the sample programs in the
CUDA software to validate that the hardware and software are running correctly and
communicating with each other.
VERIFY YOU HAVE A CUDA-ENABLED SYSTEM
Many NVIDIA products today contain CUDA-enabled GPUs. These include:
NVIDIA GeForce® 8, 9, 200, and 400 series GPUs
NVIDIA Tesla™ computing solutions
Many of the NVIDIA Quadro® products
An up-to-date list of CUDA-enabled GPUs can be found on the NVIDIA CUDA Web
site at http://www.nvidia.com/object/cuda_gpus.html.
The Release Notes for the CUDA Toolkit also contain a list of supported products.
To verify which video adapter your Mac OS X system uses, under the Apple menu select
About This Mac, click the More Info … button, and then select Graphics/Displays under
the Hardware list.
NVIDIA CUDA C Getting Started Guide for Mac OS X
DU-05348-001_v02 | 3
Installing CUDA Development Tools
VERIFY THE CORRECT VERSION OF MAC OS X
The CUDA Development Tools require an Intel-based Mac running Mac OS X v. 10.5.6
or later. For 64-bit CUDA applications, Mac OS X v. 10.6.3 or later is required. To check
which version you have, go to the Apple menu on the desktop and select About This
Mac. You should see a dialog box similar to Figure 1.
To use the CUDA
Development Tools,
you need to check for
version 10.5.6 or
later.
Figure 1.
About This Mac Dialog Box
Verify That gcc Is Installed
The gcc compiler and toolchain are installed using the installation of Xcode. The Xcode
development environment is found on the Xcode Developer Tools DVD that ships with
new Mac systems and with Leopard, if you buy the operating-system upgrade. When
installing Xcode, the package that contains gcc and the necessary tools is called Developer
Tools Essentials. You can verify that gcc is installed entering the command
/usr/bin/gcc –-help from a Terminal window.
NVIDIA CUDA C Getting Started Guide for Mac OS X
DU-05348-001_v02 | 4