0

Is there a straightforward way to generate random numbers inside an OpenACC parallel loop? I want the seed within each loop/thread to be different. The reference code that demonstrates the required task to be done is as follows:

PROGRAM genRandNums

    implicit none

    integer :: i
    double precision :: a(100)
    
   !$acc parallel loop
    DO i = 1,100
        call random_seed()
        call random_number(a(i))
    ENDDO

END PROGRAM

This code works on the gnu's 'gfortran' but throws an error with the 'nvfortran' compiler as the intersic functions random_seed() and random_number() are not supported. How can I modify this code to work with the nvfortran compiler?

0 Answers0