fpl
fpl

Reputation: 1

Parallelizing DO loop with nvfortran on gpu

I am tring to parallelize a do loop in Fortran. Using OMP parallel do (and converted to standard do loop) it works nicely (using both gfortran and nvfortran), but when compiling it with nvfortran -stdpar=gpu it compiles, but running it, it crashes with:

0 Current file: xxx/pi.f90 function: pi line: 15 This file was compiled: -acc=gpu -gpu=cc35 -gpu=cc50 -gpu=cc60 -gpu=cc60 -gpu=cc70 -gpu=cc75 -gpu=cc80 -

Here is the code:

program pi
  implicit none
  integer :: count, n, i
  real :: r
  real, dimension(10000) :: x,y
  logical , dimension(10000) :: c
  c = .false.
  n=size(x,1)
  print*,count(c)
  call RANDOM_SEED
  call random_number(x)
  call random_number(y)

  do concurrent (i = 1: n)
    if (x(i)**2 + y(i)**2 <1.0) c(i)=.true.
  end do

  r = 4 * real(count(c))/n
  print *, r
end program pi

Upvotes: 0

Views: 214

Answers (0)

Related Questions