cancel
Showing results for 
Search instead for 
Did you mean: 

Drivers & Software

XiaOaiX
Journeyman III

Segment fault for large array constructor with Flang

 

program arraymult

implicit none
integer, parameter:: N=2000
integer :: i,j
real(16), allocatable, dimension(:,:):: a, b, c0, c1
character (len=20):: date,time
real :: tt0,tt1
allocate(a(N,N))
allocate(b(N,N))
allocate(c0(N,N))
allocate(c1(N,N))

call date_and_time(date,time)
print *, "date=", date, "; time=", time
call cpu_time(tt0)
a=reshape([(50._16-(N**2-1._16)/2.+i,i=1,N**2)],[N,N])
b=reshape([(100._16-(N**2-1._16)/2.+i,i=1,N**2)],[N,N])
call cpu_time(tt1)
print *, "date=", date, "; time=", time
print *, "reshape spend=", tt1-tt0
call date_and_time(date,time)
print *, "date=", date, "; time=", time
call cpu_time(tt0)
c0=matmul(a,b)
call date_and_time(date,time)
call cpu_time(tt1)
print *, "date=", date, "; time=", time
print *, "multi spend=", tt1-tt0
end program

 

 

Using aocc 3.2 flang, build successfully, but segment fault at runtime.  It seems that the problem is that N is too large.  If N=200, it is built and run successfully. Is this a bug?

0 Likes
0 Replies