Dear all,
A very simple question about do concurrent
. Code is below,
program mainomp
implicit none
integer, parameter :: r8=selected_real_kind(15,9)
real, allocatable :: x(:,:,:),ks(:,:,:),xs(:,:,:)
integer :: i,j,nstep,np,nd,l,k
real(kind=r8), parameter :: as(4,4) = reshape([ &
& 0.0_r8, 0.0_r8, 0.0_r8, 0.0_r8, &
& 2.71644396264860_r8, 0.0_r8, 0.0_r8, 0.0_r8, &
& -6.95653259006152_r8, 0.78313689457981_r8, 0.0_r8, 0.0_r8, &
& 0.0_r8, 0.48257353309214_r8, 0.26171080165848_r8, 0.0_r8 ], [4,4])
np=10**5
nd=2
nstep=10**3
allocate(x(np,nd,0:nstep))
allocate(xs(np,nd,4))
allocate(ks(np,nd,4))
do k = 1, nstep
do j = 1,4
do concurrent (l=1:nd)
xs(:,l,j) = x(:,l,k-1) + matmul(ks(:,l,:j-1),as(:j-1,j))
enddo
enddo
enddo
end program mainomp
According to Intel documentation, when -qopenmp is enabled, it should automatically parallelize the do concurrent
, which is great.
However when I enable -qopenmp
and I also enable heap-arrays0
as below,
it just give me access violation error
forrtl: severe (157): Program Exception - access violation
Image PC Routine Line Source
openMPtest.exe 00007FF6CC756A0A Unknown Unknown Unknown
openMPtest.exe 00007FF6CC7317B2 MAIN__ 20 main_omp.f90
libiomp5md.dll 00007FF80756D853 Unknown Unknown Unknown
libiomp5md.dll 00007FF8074CEC67 Unknown Unknown Unknown
libiomp5md.dll 00007FF8074D0A26 Unknown Unknown Unknown
libiomp5md.dll 00007FF807487751 Unknown Unknown Unknown
openMPtest.exe 00007FF6CC73155C MAIN__ 19 main_omp.f90
openMPtest.exe 00007FF6CC761E5E Unknown Unknown Unknown
openMPtest.exe 00007FF6CC76223C Unknown Unknown Unknown
KERNEL32.DLL 00007FF8A9EC7034 Unknown Unknown Unknown
ntdll.dll 00007FF8AABA2651 Unknown Unknown Unknown
at line
xs(:,l,j) = x(:,l,k-1) + matmul(ks(:,l,:j-1),as(:j-1,j))
However, without heap-arrays
as below, the code with -qopenmp works, no error.
Just wonder, does anyone have similar issues?
Why heap-arrays will cause access violation? How to solve this problem?
Thanks much in advance!
PS.
Intel’s document webpage below,
Visual Studio /qopenmp settings can also be set from below menu,