Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28872 Discussions

Segmentation fault when calling a subroutine

Kate_Johnson
Beginner
450 Views

I am calling the lapack subroutine DLAPMT in the following snippet of my code:

c    Permute matrix c_all according to IPERM1 

    do i=1, n_sources
        do k=1,g_layers
            do l=1,n_layers
            call DLAPMT (.TRUE., nsim, ndim, c_all(:,:,i,k,l), nsim, IPERM1)
            enddo
     
        enddo
    enddo

 

In this case n_sources is 2, g_layers is 1 and n_layers is 1.  Therefore it should call DLAPMT twice.  The first time it works fine.  The second time it reaches DLAPMT, it kills the process due to a segmentation error. I've checked and all the inputs are exactly the same the second time around.  What could be causing this problem?

 

Thanks

0 Kudos
4 Replies
Steven_L_Intel1
Employee
450 Views

Is the LAPACK library you're calling the one from Intel MKL or something else? You say "segmentation fault", which is a Linux term - are you using Windows (this forum) or Linux? What happens if you add /heap-arrays (-heap-arrays) to the compile options?
 

0 Kudos
Kate_Johnson
Beginner
450 Views

I'm using Linux, sorry about that.  It is from the Intel MKL library.  I'll try the heap-arrays option

Thanks

0 Kudos
Kate_Johnson
Beginner
450 Views

That worked, thanks!

0 Kudos
Steven_L_Intel1
Employee
450 Views

Ok - looks as if you're getting a stack overflow and the compiler is creating a stack temp and not removing it, but I don't think it should need a temp here. Can you provide me with a small but complete source that shows the problem?

0 Kudos
Reply