Tutorial: Introduction to CUDA Fortran | GTC 2013
Tutorial: Introduction to CUDA Fortran | GTC 2013
Tutorial: Introduction to CUDA Fortran | GTC 2013
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Computing π with <strong>CUDA</strong> <strong>Fortran</strong> Kernels<br />
attributes(global) subroutine final_sum(partial,nthreads,<strong>to</strong>tal)<br />
integer, intent(in) :: partial(nthreads)<br />
integer, intent(out) :: <strong>to</strong>tal<br />
integer, shared :: psum(*)<br />
integer :: index, inext<br />
index=threadIdx%x<br />
! load partial sums in shared memory<br />
psum(index)=partial(index)<br />
call syncthreads()<br />
inext=blockDim%x/2<br />
do while ( inext >=1 )<br />
if (index