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.

Misaligned Data Access<br />

• Use array increment kernel with variable misalignment<br />

attributes(global) subroutine offset(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 offset<br />

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

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

Saved successfully!

Ooh no, something went wrong!