- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have written the Test code
program test
integer n,i
parameter (n=10000)
REAL a(n,n),b(n),c(n)
a(1:n,1:n) = 0.0
read(*,*)i
call partarray(i,a(1:i,1:i))
end
subroutine partarray(I,a)
integer i
real a(i,i)
write(*,*)"i",i
write(*,*)"Reached the end of part array subroutine"
return
end
which works completely fine in gfortran. But ifort compiler throws segmentation error for i value in the range 1445 to 9999.
Any help in this regard will be greatly appreciated
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your program would allocate storage for the array section, and might work better with -heap-arrays or with an increase in stack limit. gfortran probably uses heap automatically, seeing that the array is large.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your relpy TimP.
The same program works for the particular value i=10000 but not say 9999(1444< i <1000). what can u comment about this. will the usage of any compiler flag help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The way your program is coded, partarray requires a to be a contiguous block of memory of shape a(i,i). The generated code therefor must produce a temporary from the outer scoped array a(n,n). You have 3 ways to fix your code
a) increase stack (should you have large temps allocate from stack)
b) use heap arrays
c) declare an interface to partarray and in partarray use "real a(:,:)" (with interface reflecting this change)
Jim Dempsey
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page