<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Linking with MKL produces Segmentation Fault in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784581#M1710</link>
    <description>Hello everybody!&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I'm quite new to using MKL-routines. I thought the easiest way of linking might be using the -mkl option on the ifort compiler as described here (http://software.intel.com/sites/products/documentation/studio/composer/en-us/2009/compiler_c/copts/common_options/option_mkl.htm). I tried the following minimal example:&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;[bash]module test_mod
	use mkl95_PRECISION
     use mkl95_LAPACK
    
        contains 
    	    subroutine routine
			double precision :: D(4),E(3)
	
			D=(/1,2,3,4/)
			E=(/1,2,3/)
	
			call stedc(D,E)
			write (*,*) D
		end subroutine
end module

program main
	use test_mod
	
	call routine
end program[/bash] &lt;/DIV&gt;&lt;DIV&gt;Compiling with ifort -mkl compiles, but running the binary produces segmentations faults due to the error "MKL ERROR: Parameter 1 was incorrect on entry to DSTEDC". Changing the data type to real or complex does not solve the problem. On the other hand, if i compile the same code using "call dstedc_mkl95(D,E)" instead of "call stedc(D,E)" with the following makefile&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;[bash]#-------------------------------------------------------------------------------

IFACE_LIB=$(MKLPATH)/libmkl_intel_lp64.a
THREADING_LIB=$(MKLPATH)/libmkl_intel_thread.a
OMP_LIB = -L/opt/intel/lib -liomp5
CORE_LIB=$(MKLPATH)/libmkl_core.a
LAPACK_LIB=$(MKLPATH)/libmkl_lapack95_lp64.a
I64_INCLUDE=$(MKLINCLUDE)/intel64/lp64
MKL_LIBS=$(LAPACK_LIB) $(IFACE_LIB) $(THREADING_LIB) $(CORE_LIB) $(THREADING_LIB) $(CORE_LIB) $(THREADING_LIB) $(CORE_LIB) $(OMP_LIB)

#-------------------------------------------------------------------------------

test.out: test.f90
	ifort -I $(I64_INCLUDE) -w $&amp;lt; $(MKL_LIBS) -lpthread -o test.out
#-------------------------------------------------------------------------------[/bash] &lt;DIV&gt;&lt;/DIV&gt;everything works great. But this way i can't compile complex routines, only real and double precision. What am I doing wrong? I thought -mkl was all i needed to get the whole MKL working...&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thank you in advance!&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;BTW: I am using ifort 12.0.0 with composer XE 2011.0.085 on Mac OS X 10.7.3 Lion&lt;/DIV&gt;</description>
    <pubDate>Mon, 26 Mar 2012 09:07:34 GMT</pubDate>
    <dc:creator>peterwriesnik</dc:creator>
    <dc:date>2012-03-26T09:07:34Z</dc:date>
    <item>
      <title>Linking with MKL produces Segmentation Fault</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784581#M1710</link>
      <description>Hello everybody!&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I'm quite new to using MKL-routines. I thought the easiest way of linking might be using the -mkl option on the ifort compiler as described here (http://software.intel.com/sites/products/documentation/studio/composer/en-us/2009/compiler_c/copts/common_options/option_mkl.htm). I tried the following minimal example:&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;[bash]module test_mod
	use mkl95_PRECISION
     use mkl95_LAPACK
    
        contains 
    	    subroutine routine
			double precision :: D(4),E(3)
	
			D=(/1,2,3,4/)
			E=(/1,2,3/)
	
			call stedc(D,E)
			write (*,*) D
		end subroutine
end module

program main
	use test_mod
	
	call routine
end program[/bash] &lt;/DIV&gt;&lt;DIV&gt;Compiling with ifort -mkl compiles, but running the binary produces segmentations faults due to the error "MKL ERROR: Parameter 1 was incorrect on entry to DSTEDC". Changing the data type to real or complex does not solve the problem. On the other hand, if i compile the same code using "call dstedc_mkl95(D,E)" instead of "call stedc(D,E)" with the following makefile&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;[bash]#-------------------------------------------------------------------------------

IFACE_LIB=$(MKLPATH)/libmkl_intel_lp64.a
THREADING_LIB=$(MKLPATH)/libmkl_intel_thread.a
OMP_LIB = -L/opt/intel/lib -liomp5
CORE_LIB=$(MKLPATH)/libmkl_core.a
LAPACK_LIB=$(MKLPATH)/libmkl_lapack95_lp64.a
I64_INCLUDE=$(MKLINCLUDE)/intel64/lp64
MKL_LIBS=$(LAPACK_LIB) $(IFACE_LIB) $(THREADING_LIB) $(CORE_LIB) $(THREADING_LIB) $(CORE_LIB) $(THREADING_LIB) $(CORE_LIB) $(OMP_LIB)

#-------------------------------------------------------------------------------

test.out: test.f90
	ifort -I $(I64_INCLUDE) -w $&amp;lt; $(MKL_LIBS) -lpthread -o test.out
#-------------------------------------------------------------------------------[/bash] &lt;DIV&gt;&lt;/DIV&gt;everything works great. But this way i can't compile complex routines, only real and double precision. What am I doing wrong? I thought -mkl was all i needed to get the whole MKL working...&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thank you in advance!&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;BTW: I am using ifort 12.0.0 with composer XE 2011.0.085 on Mac OS X 10.7.3 Lion&lt;/DIV&gt;</description>
      <pubDate>Mon, 26 Mar 2012 09:07:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784581#M1710</guid>
      <dc:creator>peterwriesnik</dc:creator>
      <dc:date>2012-03-26T09:07:34Z</dc:date>
    </item>
    <item>
      <title>Linking with MKL produces Segmentation Fault</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784582#M1711</link>
      <description>&lt;I&gt;&amp;gt; I thought -mkl was all i needed to get the whole MKL working.&lt;BR /&gt;&lt;BR /&gt;&lt;/I&gt;Only for the simplest instances of using MKL. In particular, that will not work if you make Lapack95 calls, as you did in your example. Consult the &lt;A href="http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/"&gt;MKL Link Line Advisor&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;Your example (21 source lines) compiles and runs when compiled on Windows 7 x64:&lt;BR /&gt;&lt;BR /&gt; ifort /Qmkl xsted.f90 mkl_lapack95_lp64.lib&lt;BR /&gt;&lt;BR /&gt;and produces the output&lt;BR /&gt;&lt;BR /&gt;-0.742393758888324 0.852282288303725 2.96827628913336&lt;BR /&gt; 6.92183518145124&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Mar 2012 17:55:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784582#M1711</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2012-03-26T17:55:10Z</dc:date>
    </item>
    <item>
      <title>Linking with MKL produces Segmentation Fault</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784583#M1712</link>
      <description>I have also checked the result with the latest 10.3.update 9 but on linux64 bit - the same result as mecej4 reported.&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 26 Mar 2012 18:59:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784583#M1712</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2012-03-26T18:59:32Z</dc:date>
    </item>
    <item>
      <title>Linking with MKL produces Segmentation Fault</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784584#M1713</link>
      <description>how where your compiler settings?</description>
      <pubDate>Mon, 26 Mar 2012 22:39:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784584#M1713</guid>
      <dc:creator>peterwriesnik</dc:creator>
      <dc:date>2012-03-26T22:39:33Z</dc:date>
    </item>
    <item>
      <title>Linking with MKL produces Segmentation Fault</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784585#M1714</link>
      <description>using the settings&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;ifort -mkl test.f90 /opt/intel/mkl/lib/libmkl_lapack95_lp64.a&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;for compiling on Mac OS produces segmentation faults as well.&lt;/DIV&gt;</description>
      <pubDate>Mon, 26 Mar 2012 22:44:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784585#M1714</guid>
      <dc:creator>peterwriesnik</dc:creator>
      <dc:date>2012-03-26T22:44:24Z</dc:date>
    </item>
    <item>
      <title>Linking with MKL produces Segmentation Fault</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784586#M1715</link>
      <description>&lt;P&gt;On my (10.2.0 Darwin Kernel Version 10.2.0) machine the test works OK&lt;BR /&gt;&lt;BR /&gt;% ifort -V&lt;BR /&gt;Intel Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.1 Build 20120321&lt;BR /&gt;Copyright (C) 1985-2012 Intel Corporation. All rights reserved.&lt;BR /&gt;&lt;BR /&gt;% ifort test.f90 -mkl -I$MKLROOT/include/intel64/lp64 $MKLROOT/lib/libmkl_lapack95_lp64.a&lt;BR /&gt;% ./a.out&lt;BR /&gt;-0.742393758888324 0.852282288303725 2.96827628913336&lt;BR /&gt; 6.92183518145124&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2012 06:34:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784586#M1715</guid>
      <dc:creator>barragan_villanueva_</dc:creator>
      <dc:date>2012-03-27T06:34:43Z</dc:date>
    </item>
    <item>
      <title>Linking with MKL produces Segmentation Fault</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784587#M1716</link>
      <description>Thank you for all the great answers! They really helped a lot. Using the Link Line Advisor solved the problem, I got it working. Now i tried splitting the whole program into modules since that would appear in most of my use-cases. The main file "test.f90" looks like&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;[bash]program main
	use test_mod
	
	call routine
end program[/bash] &lt;/DIV&gt;&lt;DIV&gt;The module "test_mod" is defined in the file "test_mod.f90" which looks like&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;[bash]module test_mod
	use mkl95_PRECISION
    use mkl95_LAPACK
    
    contains 
    	subroutine routine
			complex :: D(4),E(3)
	
			D=(/1,2,3,4/)
			E=(/1,2,3/)
	
			call stedc(D,E)
			write (*,*) D
		end subroutine
	
end module[/bash] &lt;/DIV&gt;&lt;DIV&gt;I am compiling and linking the whole thing with the following makefile&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;[bash]LINKFLAGS=-L$(MKLROOT)/lib  $(MKLROOT)/lib/libmkl_blas95_ilp64.a  $(MKLROOT)/lib/libmkl_lapack95_ilp64.a -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread -lm
CFLAGS=-i8 -I$(MKLROOT)/include/intel64/ilp64  -I$(MKLROOT)/include -xSSSE3 -axSSSE3

#-------------------------------------------------------------------------------

test.out: test.o
	ifort *.o $(LINKFLAGS) -o test.out
test.o: test_mod.o
	ifort -c $(CFLAGS) test.f90 -o test.o
test_mod.o:
	ifort test_mod.f90 $(CFLAGS) -c -o test_mod.o
	
clean:
	rm -rf *.mod *.o *.out
[/bash] &lt;/DIV&gt;&lt;DIV&gt;The linkline is from the Link Line Advisor. Everything works fine, linking errors and segmentation faults don't appear anymore. But now I stumbled across an new problem: If I change the type of D and E from double precision to complex, the complex routine cstedc() should be called instead of dstedc() (seehttp://software.intel.com/sites/products/documentation/hpc/composerxe/en-us/mklxe/mkl_manual_win_mac/lse/functn_stedc.htm). But it doesn't. I get an error telling that the complex routine does not exist with a message similar to "check the include paths". I tried a few other routines where the F95 interface should determine the routine to be called by checking the type of the variables and it worked. I got complex and double precision routines working by just changing the type of data passed to a generic interface.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Is it possible that there isn't an interface to every lapack-routine implemented in lapack95? Or am I misunderstanding this whole thing?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thank you in advance!&lt;/DIV&gt;</description>
      <pubDate>Tue, 27 Mar 2012 22:13:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784587#M1716</guid>
      <dc:creator>peterwriesnik</dc:creator>
      <dc:date>2012-03-27T22:13:04Z</dc:date>
    </item>
    <item>
      <title>Linking with MKL produces Segmentation Fault</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784588#M1717</link>
      <description>&lt;DIV id="tiny_quote"&gt;&lt;DIV style="margin-left: 2px; margin-right: 2px;"&gt;Quoting &lt;A jquery1332936520079="58" rel="/en-us/services/profile/quick_profile.php?is_paid=&amp;amp;user_id=554391" href="https://community.intel.com/en-us/profile/554391/" class="basic"&gt;peterwriesnik&lt;/A&gt;&lt;/DIV&gt;&lt;DIV style="background-color: #e5e5e5; margin-left: 2px; margin-right: 2px; border: 1px inset; padding: 5px;"&gt;&lt;I&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Is it possible that there isn't an interface to every lapack-routine implemented in lapack95? Or am I misunderstanding this whole thing?&lt;/DIV&gt;&lt;/I&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;For FORTRAN 95 interface for LAPACK please look at $MKLROOT/include/lapack.f90 file&lt;BR /&gt;(it is used by you via compiler option -I$(MKLROOT)/include/intel64/ilp64)&lt;BR /&gt;&lt;BR /&gt;Also, please look at Fortran interface for LAPACK in $MKLROOT/include/mkl_lapack.fi file&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2012 12:13:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784588#M1717</guid>
      <dc:creator>barragan_villanueva_</dc:creator>
      <dc:date>2012-03-28T12:13:24Z</dc:date>
    </item>
    <item>
      <title>Linking with MKL produces Segmentation Fault</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784589#M1718</link>
      <description>When you use the Fortran 95 interfaces, the information in the MKL95 modules is used to disambiguate the generic names into specific routine names. Thus, for the code in your original post, the call to STEDC is resolved by a call to ZSTEDC_MKL95.&lt;BR /&gt;&lt;BR /&gt;However, in #6 you called the generic name with two COMPLEX arguments. As you can see from the MKL documentation for STEDC, the first two arguments must be REAL or DOUBLE PRECISION arrays in all instances, and there is no matching case for arrays of type COMPLEX as the first two arguments. This explains the error message.&lt;BR /&gt;&lt;BR /&gt;It is true that not every Lapack routine has a Fortran 95 counterpart in Lapack95. Lapack has been revised a few times after Lapack95 was published, and no corresponding updates were published for Lapack95. However, this is not a relevant factor for the present thread.&lt;BR /&gt;&lt;BR /&gt;Note that there are actually two generic names for STEDC: RSTEDC and STEDC. In the original post, since you used the latter, the call was directed to ZSTEDC_MKL95.&lt;BR /&gt;&lt;BR /&gt;You may find it helpful to view the table &lt;I&gt;Computational Routines for Solving Symmetric Eigenvalue Problems &lt;/I&gt;and the accompanying diagrams &lt;I&gt;Decision Tree: Real Symmetric Eigenvalue Problems &lt;/I&gt;and &lt;I&gt;Decision Tree: Complex Hermitian Eigenvalue Problems&lt;/I&gt; in the MKL reference manual.&lt;BR /&gt;</description>
      <pubDate>Wed, 28 Mar 2012 12:20:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-with-MKL-produces-Segmentation-Fault/m-p/784589#M1718</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2012-03-28T12:20:29Z</dc:date>
    </item>
  </channel>
</rss>

