What is a backward dependency in CUDA?

I am new to CUDA programming. I have a CUDA routine that hopefully models a diffusion equation with a simple source:

attributes(global) subroutine diff_time_stepper(v,diffconst)


real*8 :: v(:,:)
real*8 :: diffconst

real*8 :: vintermed
integer :: i,j,m
integer :: nx, ny

nx=256
ny=256

i=(blockIdx%x-1)*blockDim%x+threadIdx%x
j=(blockIdx%y-1)*blockDim%y+threadIdx%y

if (i<nx .and. j<ny .and. i>1 .and. j>1) then
  vintermed=v(i,j)+diffconst*(v(i-1,j)-2.*v(i,j)+v(i+1,j)+v(i,j-1)-2.*v(i,j)+v(i,j+1))
  v(i,j)=vintermed
! add a source for the heck of it
  if (i==64 .and. j==64) v(i,j)=v(i,j)+1
endif


end subroutine

: , , , ( , ). " "? , vinterm v, v vtinerm. v (64,64) . ? , , CUDA, , . - ? .

+3
1

, . v, , ( , ..) ( ) OpenMP .

, - , , , , ; , , v (64, 64) , .

, , :

...
real*8 :: left, right, up, down, centre

nx=256
ny=256

i=(blockIdx%x-1)*blockDim%x+threadIdx%x
j=(blockIdx%y-1)*blockDim%y+threadIdx%y

if (i<nx .and. j<ny .and. i>1 .and. j>1) then
  left  = v(i-1,j)
  right = v(i+1,j)
  up    = v(i,  j+1)
  down  = v(i,  j-1)
  centre= v(i,j)
endif
call syncthreads()

if (i<nx .and. j<ny .and. i>1 .and. j>1) then
  v(i,j) = centre + diffconst*(left+right+up+down-4.*centre)
  if (i==64 .and. j==64) v(i,j)=v(i,j)+1
endif

, ; , / v. - .

, parallelism. - , , vnew; , . , timestep vnew, timestep .

+2

All Articles