19.11.2014 Views

Tutorial: Introduction to CUDA Fortran | GTC 2013

Tutorial: Introduction to CUDA Fortran | GTC 2013

Tutorial: Introduction to CUDA Fortran | GTC 2013

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Multi-GPU Memory Allocation<br />

• Allocation at time of declaration is on default device (0)<br />

real, device :: a_d(N)<br />

• Allocatable arrays used for data on other devices<br />

real, device, allocatable :: a_d(:), b_d(:)<br />

istat = cudaSetDevice(0)<br />

allocate(a_d(N))<br />

istat = cudaSetDevice(1)<br />

allocate(b_d(N))

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

Saved successfully!

Ooh no, something went wrong!