- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
hi everyone,
I wrote the following code:
[bash]REAL ,DIMENSION(nDOF,nVar,nElem) :: QHAT REAL ,DIMENSION(nDOF,nVar,nElem) :: FHAT,FHATSTAR [/bash]when nElem is greater than 10000 I get aSegmentation fault and the program stops
In the program now there are no more code so I think that is a memory program.
I am using the intel fortran compiler, are there any possibilities to check this? Can I extend the memory that I can use.
Thank you
- Marcas:
- Intel® Fortran Compiler
Link copiado
9 Respostas
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
If these arrays are local variables, you may be running out of stack. Increase the stack limit, or compile with the -heap-arrays option, or modify your program to allocate the arrays.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
hi,
how can I do it?
I mean the first option is:
[bash]REAL ,ALLOCATABLE,DIMENSION(:,:,:) :: QHAT,FHAT ALLOCATE(QHAT(nDOF,nVar,nElem)) ALLOCATE(FHAT(nDOF,nVar,nElem))[/bash]
How Can I apply the other two options?
thank you
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
For the -heap-arrays option, read the Intel Fortran documentation.
The method of setting the stack limit is OS-specific. Usually, the shell command
ulimit -s unlimited
is enough. See How to raise my stack limit to solve Segmentation fault .
The method of setting the stack limit is OS-specific. Usually, the shell command
ulimit -s unlimited
is enough. See How to raise my stack limit to solve Segmentation fault .
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
hi,
thank you I'll check.
with allocate I have a strange problem
consider:
[bash]nElem = 40000[/bash]when I allocate with:
[bash]ALLOCATE(QHAT (nDOF,nVar,nElem))
QHAT = 0.D0[/bash] then I write to screen as:
[bash]WRITE(*,*) "QHAT" ,QHAT(1,2,40001)[/bash]I have no segmentation fault
why?
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
You cannot depend on seg-faults being forced whenever you overrun an array. Often, one variable follows another, as in
COMMON /ABC/A(10),B(10)
It can happen that a reference to A(11) uses B(1). From the Fortran point of view, this is an error, but the OS will not see this as an illegal memory reference.
COMMON /ABC/A(10),B(10)
It can happen that a reference to A(11) uses B(1). From the Fortran point of view, this is an error, but the OS will not see this as an illegal memory reference.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
hi,
so what Can I do?
I have to be more carefull in programming?
or to not use allocatable and increase the cache?
thank you very much
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
No short recommendations can be given beyond what mecej4 said already. The heap-arrays option is reliable when you don't use threaded parallel, although it may hurt performance when unexpected temporary arrays are created.
When writing parallel code, you may need to be careful, as you say, to minimize the unintended use of private arrays and make those you do use work with stack settings.
When writing parallel code, you may need to be careful, as you say, to minimize the unintended use of private arrays and make those you do use work with stack settings.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
hi,
so the best way seems to change the stack limits.
I am sorry but I am not very able with bash things.
It is correct if I open the bash file:
[bash]/etc/bash.bashrc[/bash]and then a copy and paste:
[bash]ulimit -s unlimited[/bash]
Thank you
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
that should work, test it with
ulimit -a
next time you login
ulimit -a
next time you login
Responder
Opções do tópico
- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora