- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I meet a problem.Thesettings in myIVF complier are asbelow:
(1) Optimization:Speed plus higher level Optimizations(/03).
(2)Global Optimizations:Yes(/Og)
(3) Heap Arrays:30
(4) Process OpenMP Directives: Generate Parallel Code(/Qopenmp)
If I run my code with above settings, I find there is a heap error, pointed to the file dgbheap.c, when I run in the debug mode and code just stops in non-debug mode.
However, I note that when I set off (1) or (4), the code can run well.
I wonder why I cannot run the code with (1) and (4) on?
Thanks you in advance.
(1) Optimization:Speed plus higher level Optimizations(/03).
(2)Global Optimizations:Yes(/Og)
(3) Heap Arrays:30
(4) Process OpenMP Directives: Generate Parallel Code(/Qopenmp)
If I run my code with above settings, I find there is a heap error, pointed to the file dgbheap.c, when I run in the debug mode and code just stops in non-debug mode.
However, I note that when I set off (1) or (4), the code can run well.
I wonder why I cannot run the code with (1) and (4) on?
Thanks you in advance.
Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please provide a test case we can build and run here. We'll be glad to investigate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Steve. But I am afraid I can not provide thecode.
I find the problem occurs in thebelow subroutine:
subroutine name(m)
integer m
real(8) array(m,m)
end subroutine
I temporally resolve the problem by removing thefixed size array(m,m) in my subroutine and setting the heap arrays as default.
However, in the case I really need such a large array, what should I do? Can I increase the stack size of IVF and how?
Thanks a lot.
I find the problem occurs in thebelow subroutine:
subroutine name(m)
integer m
real(8) array(m,m)
end subroutine
I temporally resolve the problem by removing thefixed size array(m,m) in my subroutine and setting the heap arrays as default.
However, in the case I really need such a large array, what should I do? Can I increase the stack size of IVF and how?
Thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I suggest this instead:
subroutine name(m)
integer m
real(8), allocatable :: array(:)
allocate (array(m))
...
The array will be automatically deallocated when the subroutine exits.
subroutine name(m)
integer m
real(8), allocatable :: array(:)
allocate (array(m))
...
The array will be automatically deallocated when the subroutine exits.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try adding "recursive" to the subroutine declaration:
recursive subroutine name(m)
integer m
real(8) array(m,m)
end subroutine
or
recursive subroutine name(m)
integer m
real(8), allocatable ::array(:,:)
allocate(array(m,m))
end subroutine
Jim Dempsey
recursive subroutine name(m)
integer m
real(8) array(m,m)
end subroutine
or
recursive subroutine name(m)
integer m
real(8), allocatable ::array(:,:)
allocate(array(m,m))
end subroutine
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The issue here is running out of thread stack - adding recursive won't change that - as an "automatic array", ARRAY is already stack-allocated. Using ALLOCATABLE will as the allocation will come from the heap.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much.
But I still want to ask one more question. What should I do if I need to transfer the large array as parameter? For example:
subroutine name(m,arrary)
integer m
real(8) array(m,m)
end subroutine
In this case, it seems that the allocatable/allocate method cannot be applied in above situation.
Thanks.
But I still want to ask one more question. What should I do if I need to transfer the large array as parameter? For example:
subroutine name(m,arrary)
integer m
real(8) array(m,m)
end subroutine
In this case, it seems that the allocatable/allocate method cannot be applied in above situation.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In that case you don't need ALLOCATABLE - that's only when the array is locat to the procedure. If you pass the array as an argument, it is already allocated by the caller.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page