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.

Computing π <strong>with</strong> <strong>CUDA</strong> <strong>Fortran</strong> Kernels<br />

attributes(global) subroutine final_sum(partial,nthreads,total)<br />

integer, intent(in) :: partial(nthreads)<br />

integer, intent(out) :: total<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

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

Saved successfully!

Ooh no, something went wrong!