19.11.2014 Views

with CUDA Fortran

with CUDA Fortran

with CUDA Fortran

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Data Transfers<br />

program copyData<br />

use cudafor<br />

implicit none<br />

integer, parameter :: n = 256<br />

real :: a(n), b(n)<br />

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

a = 1.0<br />

a_d = a<br />

b_d = a_d<br />

b = b_d<br />

if (all(a == b)) &<br />

write(*,*) 'Test Passed'<br />

end program copyData<br />

Host<br />

CPU<br />

DRAM<br />

a<br />

b<br />

Device<br />

GPU<br />

DRAM<br />

a_d<br />

b_d

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

Saved successfully!

Ooh no, something went wrong!