Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
30 Views

Fortran95 Interface causes segfault

Jump to solution

I am trying to use the zheevd or zheev with their Fortran95 interface:

program main
    use lapack95
    implicit none
    complex(8) :: H(2,2), w(2)

    H = 1d0
    call zheevd(H,w, 'V')
    write (*,*) H
    write (*,*) "######"
    write (*,*) w
end program main

which I compile with:

ifort test.f90 -o bla.x  ${MKLROOT}/lib/intel64/libmkl_blas95_lp64.a ${MKLROOT}/lib/intel64/libmkl_lapack95_lp64.a -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl  -I${MKLROOT}/include/intel64/lp64 -I${MKLROOT}/include

as suggested by the Link Line Adivsor. When I run this simple example I get:

> $ ./bla.x                                                                              
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source             
bla.x              00000000016D7984  Unknown               Unknown  Unknown
libpthread-2.23.s  00007F083A8F6390  Unknown               Unknown  Unknown
bla.x              0000000000404257  Unknown               Unknown  Unknown
bla.x              0000000000403B41  Unknown               Unknown  Unknown
bla.x              00000000004039B2  Unknown               Unknown  Unknown
bla.x              000000000040392E  Unknown               Unknown  Unknown
libc-2.23.so       00007F083A02F830  __libc_start_main     Unknown  Unknown
bla.x              0000000000403829  Unknown               Unknown  Unknow

 

How do I use the Fortran95 Interface correctly? The 77 interface is just to verbose for my liking.

0 Kudos

Accepted Solutions
Highlighted
Black Belt
30 Views

Two errors:

     1. The type of w should be real(8).

     2. You have called the F77 routine with the F95 argument list. Replace Line 7 by

call heevd(H,w, 'V')

 

View solution in original post

0 Kudos
5 Replies
Highlighted
Black Belt
31 Views

Two errors:

     1. The type of w should be real(8).

     2. You have called the F77 routine with the F95 argument list. Replace Line 7 by

call heevd(H,w, 'V')

 

View solution in original post

0 Kudos
Employee
30 Views

Hi Matthias,

You used wrong calling for this function API, please refer to https://software.intel.com/en-us/mkl-developer-reference-fortran-heevd

For more f95 examples, please refer to examples under $MKLROOT/examples/examples_f95/lapack95/source/

 

0 Kudos
Highlighted
Black Belt
30 Views

Fiona Z. (Intel) wrote:

For more f95 examples, please refer to examples under $MKLROOT/examples/examples_f95/lapack95/source/

There are no HEEVD examples in the MKL Lapack95 examples. Perhaps the corrected test code in this post could be used for that purpose!

0 Kudos
Highlighted
Beginner
30 Views

Fiona Z. (Intel) wrote:

Hi Matthias,

You used wrong calling for this function API, please refer to https://software.intel.com/en-us/mkl-developer-reference-fortran-heevd

For more f95 examples, please refer to examples under $MKLROOT/examples/examples_f95/lapack95/source/

 

I read this reference page multiple times, but I wasn't quite clear to me, that I had to drop the type letter and online I could only find examples for the 77 interface. 

0 Kudos
Highlighted
Black Belt
30 Views

Matthias, the format of the MKL documentation can cause confusion in the beginning. For example, if you see https://software.intel.com/en-us/mkl-developer-reference-fortran-heevd , under the Syntax title you see three example calls. The first two are for specific (i.e., F77 style) routines, whereas the third is for the F95 routine. The clue that that third call is for the F95 interface is the absence of type-indicators such as 's', 'd' among the initial characters of the routine name. To confirm what the clue may suggest, you have to scroll to the bottom of the page,  to the section "LAPACK 95 Interface Notes". This format is regularly used in the MKL documentation for Lapack95 routines.

0 Kudos