06.08.2012 Views

Getting Started with CUDA

Getting Started with CUDA

Getting Started with CUDA

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Host Synchronization Example<br />

// copy data from host to device<br />

cudaMemcpy(a_d, a_h, numBytes, cudaMemcpyHostToDevice);<br />

// execute the kernel<br />

inc_gpu(a_d, N);<br />

// run independent CPU code<br />

run_cpu_stuff();<br />

// copy data from device back to host<br />

cudaMemcpy(a_h, a_d, numBytes, cudaMemcpyDeviceToHost);<br />

© 2008 NVIDIA Corporation.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!