Passing nested arguments to subroutine

Passing nested arguments to subroutine

Hi all,

I've just started using Intel's fortran compiler (I used to use IBM's). Among other changes, I noticed that passing an intrinsic function of an array as the argument to a subroutine resulted in a segmentation fault. Basically, if A is an array, then a call to

some_subroutine(A)

is fine, but, for example,

some_subroutine(transpose(A))

causes a segfault. I'm attaching a minimal code that will reproduce this. I compiled it with

ifort -m64 -r8 -O3 -o bad_ifort bad_ifort.F90

The segfault does not happen for small matrices, but my problem size is in fact a few thousand by a few thousand, and I never had a problem with this when I was using xlf. Is this a limitation of Intel's fortran compiler, or is there a compiler switch that I need to use?

Cheers,

Sourish

AdjuntoTamaño
Descargar bad-ifort.f90620 bytes
publicaciones de 5 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.
Imagen de jimdempseyatthecove

When you port, it is a good practice to use the /gen:interfaces /warn:interfaces

as well as to enable all runtime checks.

Jim Dempsey

www.quickthreadprogramming.com
Imagen de mecej4

When you use "transpose(B)" as an actual argument, a temporary array of the requisite size needs to be allocated (on the stack or the heap, depending on which compiler options have been used). Use the "stack" shell command of your system (ulimit -s for the bash shell) to raise the stack size from the default size, which can be quite small on some Linux/Unix distributions.

Thanks for the feedback, guys. Unfortunately, the warn:interfaces and gen:interfaces (-warn interfaces and -gen-interfaces on a unix system) did not solve my problem. Also, on the cluster I'm working on there is no "stack" command, but when I try ulimit, I get

$ ulimit
unlimited

Does this mean that the stack size is not small?

@mecej4, thanks for the suggestion. I just discovered the 'ulimit -s', and setting that to 'unlimited' solved my problem. Alternatively, adding

-heap-arrays `ulimit -s`

also works!

Inicie sesión para dejar un comentario.