Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Allocatable private array in openmp parallel do directive

$
0
0

Hi,  I have a problem and I did not find a solution : I want to use parallelism in the free code  , but a problem occurred in the allocation of arrays: 

PROGRAM LMTART

USE PARA_CONTROL

    use omp_lib

    INTEGER I,J

    real, allocatable, dimension(:) :: a

    PARA_FIRST=.True.

    !$OMP PARALLEL  DEFAULT(firstprivate) 

    !$OMP DO

    DO I = 1, 10

    if(PARA_FIRST) then

    allocate(a(100))

    DO J = 1, 10

    a(j)=j    

    ENDDO

    endif

    write(*,*) (a(J),J=1,10)

    PARA_FIRST=.False.

    ENDDO

    !$OMP END DO

    !$OMP END PARALLEL

   END

It should be noted that : do not  reserved  the table "a" before entering in the  DO  directive


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>