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

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

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

<strong>CUDA</strong> Libraries from <strong>CUDA</strong> <strong>Fortran</strong><br />

• All the <strong>to</strong>olkit libraries have C interfaces<br />

• Use F90 interfaces and ISO C Binding <strong>to</strong> use from <strong>CUDA</strong> <strong>Fortran</strong><br />

interface curandGenerateUniform<br />

!curandGenerateUniform(curandGenera<strong>to</strong>r_t genera<strong>to</strong>r, float *outputPtr, size_t num);<br />

subroutine curandGenerateUniform(genera<strong>to</strong>r, odata, numele) &<br />

bind(C,name='curandGenerateUniform')<br />

use iso_c_binding<br />

integer(c_size_t),value:: genera<strong>to</strong>r<br />

!pgi$ ignore_tr odata<br />

real(c_float), device:: odata(*)<br />

integer(c_size_t),value:: numele<br />

end subroutine curandGenerateUniform<br />

!curandGenerateUniformDouble(curandGenera<strong>to</strong>r_t genera<strong>to</strong>r, double *outputPtr, size_t num);<br />

subroutine curandGenerateUniformDouble(genera<strong>to</strong>r, odata, numele) &<br />

bind(C,name='curandGenerateUniformDouble')<br />

use iso_c_binding<br />

integer(c_size_t),value:: genera<strong>to</strong>r<br />

!pgi$ ignore_tr odata<br />

real(c_double), device:: odata(*)<br />

integer(c_size_t),value:: numele<br />

end subroutine curandGenerateUniformDouble<br />

end interface curandGenerateUniform

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

Saved successfully!

Ooh no, something went wrong!