- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
the first program:
!start of program
program justtest
real*8,dimension(:,:,:),allocatable :: q,qq
allocate(q(251,31,51),qq(251,31,51))
q=1d0
qq=q
deallocate(q,qq)
end program justtest
!end of program
the second program:
!start of program
program justtest
type type_test
real*8,dimension(:,:,:),allocatable :: q,qq
end type type_test
type(type_test) m
allocate(m%q(251,31,51),m%qq(251,31,51))
m%q=1d0
m%qq=m%q
deallocate(m%q,m%qq)
end program justtest
!end of program
The first program can run under visual fortran 6.6 with normal settings and the second can't. The only difference between these two programs is the position of allocatable variables. So, i'm just wondering whether the allocatable variables in structure could be optimized or not? I hope i could receive help about this problem here.
!start of program
program justtest
real*8,dimension(:,:,:),allocatable :: q,qq
allocate(q(251,31,51),qq(251,31,51))
q=1d0
qq=q
deallocate(q,qq)
end program justtest
!end of program
the second program:
!start of program
program justtest
type type_test
real*8,dimension(:,:,:),allocatable :: q,qq
end type type_test
type(type_test) m
allocate(m%q(251,31,51),m%qq(251,31,51))
m%q=1d0
m%qq=m%q
deallocate(m%q,m%qq)
end program justtest
!end of program
The first program can run under visual fortran 6.6 with normal settings and the second can't. The only difference between these two programs is the position of allocatable variables. So, i'm just wondering whether the allocatable variables in structure could be optimized or not? I hope i could receive help about this problem here.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What do you mean when you say that the second program can't run? Does it compile without errors? Does it compile and link successfully but crash during execution? What error messages are you seeing?
Mike
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your reply!
While, the second program cant run means it crash during execution, the error messages is stack overflow. And I know exactly that this is caused by the lack of stack allocations. So I could solve this problem by increasing the reserve of stack allocations in visual fortran compiler. But this fact shows that there is a big difference between the allocatable global variables and the structure variables in visual fortran compiler. So Im afraid that the using of structure variables in visual fortran program would really reduce the efficiency. If true, I want to know how much the efficiency could be reduced.
While, the second program cant run means it crash during execution, the error messages is stack overflow. And I know exactly that this is caused by the lack of stack allocations. So I could solve this problem by increasing the reserve of stack allocations in visual fortran compiler. But this fact shows that there is a big difference between the allocatable global variables and the structure variables in visual fortran compiler. So Im afraid that the using of structure variables in visual fortran program would really reduce the efficiency. If true, I want to know how much the efficiency could be reduced.
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