19.11.2014 Views

with CUDA Fortran

with CUDA Fortran

with CUDA Fortran

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Strided Data Access<br />

• Use array increment kernel <strong>with</strong> variable stride<br />

attributes(global) subroutine stride(a, s)<br />

real :: a(*)<br />

integer,! value :: s<br />

integer :: i<br />

i = (blockDim%x*(blockIdx%x-1)+threadIdx%x) * s<br />

a(i) = a(i)+1 !<br />

end subroutine stride<br />

Array a() allocated <strong>with</strong> padding to avoid out-of-bounds accesses

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

Saved successfully!

Ooh no, something went wrong!