- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Could you tell me why the piece of code below give a "segmentation error". There is a limit for the size of an array, in this case what is this limit and how can I avoid it ?
Thanks !
I know that for a value of i = 1577536, everything works well, I didn't try to know for which value of i exactly, the code failed
PROGRAM TEST
TYPE ALEX
real,allocatable :: toto(:)
real,allocatable :: titi(:)
END TYPE
type(alex) :: t_alex
integer :: i
i=11577536
ALLOCATE(t_alex%toto(i+1))
ALLOCATE(t_alex%titi(i+1))
t_alex%toto(1:i) = t_alex%titi(1:i)
END PROGRAM
Link Copied
9 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does a:
limit stacksize unlimited
or
ulimit
command make a difference? While I don't think it should, the compiler may be creating a stack temporary for the assignment.
limit stacksize unlimited
or
ulimit
command make a difference? While I don't think it should, the compiler may be creating a stack temporary for the assignment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ulimit is set to "unlimited", I 'm not sure it comes from that ... there is a limitation of the stack size with ifort ? if yes, how I can avoid this limitation
Thanks
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ifort does not establish a stacksize limit, the OS does. You set the limit using shell commands, as I noted.
Does the segv happen on the assignment or before? I note that these are components of a derived type - I know we don't do as good a job on these as we could, and I have filed a request to improve it. I'd recommend that you send a test case to Intel Premier Support.
Does the segv happen on the assignment or before? I note that these are components of a derived type - I know we don't do as good a job on these as we could, and I have filed a request to improve it. I'd recommend that you send a test case to Intel Premier Support.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
the sigv happen just after :
t_alex%toto(1:i) = t_alex%titi(1:i)
I have tried with several values of i, this morning for i=2096726, I have the sigv, I restarted my computer and I recompile the code and the value of i to have a sigv was not the same (i<2096726).
I also try with toto and titi as pointer and not allocatable type, I have the same error.
It runs on a debian sarge with ifort 9.0 20050430, my kernel is a 2.6.11.
If you need other informations
Thanks for your help
t_alex%toto(1:i) = t_alex%titi(1:i)
I have tried with several values of i, this morning for i=2096726, I have the sigv, I restarted my computer and I recompile the code and the value of i to have a sigv was not the same (i<2096726).
I also try with toto and titi as pointer and not allocatable type, I have the same error.
It runs on a debian sarge with ifort 9.0 20050430, my kernel is a 2.6.11.
If you need other informations
Thanks for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You definitely are running out of stack, then.
As an experiment, try this:
t_alex%toto = t_alex%titi
What happens?
As an experiment, try this:
t_alex%toto = t_alex%titi
What happens?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
With t_alex%toto = t_alex%titi, I have a sigv... I have also tried with titi, and toto as pointers and not as allocatable and with
ALLOCATE(t_alex%toto(i)) and ALLOCATE(t_alex%titi(i)) instead of i+1, nothing changes, I have always a sigv.
I have tried to fill up a request with Intel Premier support but I can't access to https://premier.intel.com (error 403)
Thanks
ALLOCATE(t_alex%toto(i)) and ALLOCATE(t_alex%titi(i)) instead of i+1, nothing changes, I have always a sigv.
I have tried to fill up a request with Intel Premier support but I can't access to https://premier.intel.com (error 403)
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try https://registrationcenter.intel.com/support if you're having trouble with Intel Premier Support.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Suggestion 1: modify you allocate statements from
Suggestion 2: check to see if you can use allocatable arrays as components of user-defined types.
ALLOCATE(t_alex%toto(i+1))
to
ALLOCATE(t_alex%toto(i+1),STAT = err_num)
and test to see what the value of err_num is upon return.
Suggestion 2: check to see if you can use allocatable arrays as components of user-defined types.
Message Edited by emc-nyc on 12-27-2005 11:27 PM
Message Edited by emc-nyc on 12-27-2005 11:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My suggestion would be to change the allocation commands from
allocate(t_alex%toto(i+1))
to
allocate(t_alex%toto(i+1)),STAT = err_num)
This will permit you to catch the error and see what it is.
allocate(t_alex%toto(i+1))
to
allocate(t_alex%toto(i+1)),STAT = err_num)
This will permit you to catch the error and see what it is.
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