<?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 Problems with Lapack LS solver in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Lapack-LS-solver/m-p/793759#M2464</link>
    <description>It does look risky to link as you have done. All MKL libraries dynamic is a reasonable starting point. For a next step, all libraries static should give you a link time error if any references are missing. You would need to specify the f95 wrapper library just once, ahead of the other MKL static libraries, which should preferably be done as the link advisor suggests.</description>
    <pubDate>Thu, 04 Nov 2010 14:27:09 GMT</pubDate>
    <dc:creator>TimP</dc:creator>
    <dc:date>2010-11-04T14:27:09Z</dc:date>
    <item>
      <title>Problems with Lapack LS solver</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Lapack-LS-solver/m-p/793758#M2463</link>
      <description>Hello,&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I am running into a SIGSEGV segmentation fault when I try to use the *&lt;SPAN style="line-height: 16px;"&gt;GELS* routines for Least Squares problems. I have a small reproducer code in F90 (I am using it on Mac OS X):&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="line-height: 16px;"&gt;&lt;PRE&gt;[fortran]program testlapack

    use mkl95_lapack
    use mkl95_precision

    implicit none
    integer,parameter :: left=5,right=2
    complex(8),parameter :: II=(0.0d0,1.0d0)
    real(8),parameter :: Tolerance=1.0d-9
    real(8) :: tempR(left,left),tempI(left,left),vecR(left,right),vecI(left,right)
    complex(8) :: matrixdata(left,left),vectordata(left,right)
    integer :: error

    print *,'Prepare data'
    call random_number(tempR)
    call random_number(tempI)
    matrixdata=tempR+II*tempI
    call random_number(vecR)
    call random_number(vecI)
    vectordata=vecR+II*vecI

    print *,'Call MKL Lapack solver'
    call ZGELSD( matrixdata, vectordata, Tolerance )

    print *,'Solution obtained:'
    print *,vectordata

end program testlapack
[/fortran]&lt;/PRE&gt; which I compile using&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="line-height: 16px;"&gt;&lt;PRE&gt;[bash]ifort -L$MKLPATH -I$MKLINCLUDE -I$MKLINCLUDE/em64t/lp64 -lmkl_blas95_lp64 $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a -liomp5 -lpthread testlapack.f90 -g -traceback[/bash]&lt;/PRE&gt; It compiles ok but gives a seg fault when calling ZGELSD.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="line-height: 16px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="line-height: 16px;"&gt;Am I using the F95 interface correctly? Am I using the right combination for MKL (threaded or not, static or dynamic, etc)? I know there are some routines that need to be linked static but *GELS are not mentioned, so I assumed they could be linked dynamically.&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 04 Nov 2010 14:13:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Lapack-LS-solver/m-p/793758#M2463</guid>
      <dc:creator>fercook</dc:creator>
      <dc:date>2010-11-04T14:13:30Z</dc:date>
    </item>
    <item>
      <title>Problems with Lapack LS solver</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Lapack-LS-solver/m-p/793759#M2464</link>
      <description>It does look risky to link as you have done. All MKL libraries dynamic is a reasonable starting point. For a next step, all libraries static should give you a link time error if any references are missing. You would need to specify the f95 wrapper library just once, ahead of the other MKL static libraries, which should preferably be done as the link advisor suggests.</description>
      <pubDate>Thu, 04 Nov 2010 14:27:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Lapack-LS-solver/m-p/793759#M2464</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2010-11-04T14:27:09Z</dc:date>
    </item>
    <item>
      <title>Problems with Lapack LS solver</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Lapack-LS-solver/m-p/793760#M2465</link>
      <description>OK, I am going to lift the suggested linker sequences from the MKL User's Guide:&lt;DIV&gt;1) Static linking and parallel MKL&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;[bash]ifort -L$MKLPATH -I$MKLINCLUDE $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a -liomp5 -lpthread testlapack.f90[/bash]&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;2) All dynamic linking and threaded:&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;[bash]ifort -L$MKLPATH -I$MKLINCLUDE -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread testlapack.f90[/bash]&lt;/PRE&gt;3)Static linking and sequential MKL&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;[bash]ifort -L$MKLPATH -I$MKLINCLUDE $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_sequential.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_sequential.a $MKLPATH/libmkl_core.a -lpthread testlapack.f90[/bash]&lt;/PRE&gt; 4) Dynamic linking and sequential MKL&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;[bash]ifort -L$MKLPATH -I$MKLINCLUDE -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread testlapack.f90[/bash]&lt;/PRE&gt; 5) Static linking and parallel MKL&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;[bash]ifort -L$MKLPATH -I$MKLINCLUDE $MKLPATH/libmkl_intel_ilp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_intel_ilp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a -liomp5 -lpthread testlapack.f90 [/bash]&lt;/PRE&gt; 6) Dynamic linking and parallel MKL with ILP interface&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;[bash]ifort -L$MKLPATH -I$MKLINCLUDE -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread testlapack.f90[/bash]&lt;/PRE&gt; 7) Static linking, F95 Lapack interface, and threaded MKL&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;[bash]ifort -L$MKLPATH -I$MKLINCLUDE -I$MKLINCLUDE/em64t/lp64 -lmkl_lapack95_lp64 $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a -liomp5 -lpthread testlapack.f90[/bash]&lt;/PRE&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;They ALL compile ok and give seg fault.&lt;/DIV&gt;&lt;DIV&gt;I don't know another way to compile it, and at this point I don't think it is a problem of how I am compiling. Perhaps the code is not as it should be?&lt;/DIV&gt;</description>
      <pubDate>Thu, 04 Nov 2010 15:01:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Lapack-LS-solver/m-p/793760#M2465</guid>
      <dc:creator>fercook</dc:creator>
      <dc:date>2010-11-04T15:01:21Z</dc:date>
    </item>
    <item>
      <title>Problems with Lapack LS solver</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Lapack-LS-solver/m-p/793761#M2466</link>
      <description>I like nothing more than answering my own posts.&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I switched to the F77 routines and they work fine. Here is the new version:&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;[fortran]program testlapack

    implicit none
    integer,parameter :: left=5,right=2
    complex(8),parameter :: II=(0.0d0,1.0d0)
    real(8),parameter :: Tolerance=1.0d-8
    real(8) :: tempR(left,left),tempI(left,left),vecR(left,right),vecI(left,right)
    complex(8) :: matrixdata(left,left),vectordata(left,right)
    real(8) :: GELOutputS(left)
    integer :: error, rank,info,tempDim
    complex(8),allocatable :: work(:)
    real(8),allocatable :: rwork(:)
    integer,allocatable :: iwork(:)
    integer :: lwork,lrwork,liwork

    print *,'Prepare data'
    call random_number(tempR)
    call random_number(tempI)
    matrixdata=tempR+II*tempI
    call random_number(vecR)
    call random_number(vecI)
    vectordata=vecR+II*vecI

    print *,'Call MKL Lapack solver'
    print *,'First find out optimum lwork'
    tempDim=1
    allocate (work(tempDim),rwork(tempDim),iwork(tempDim))
    lwork=-1
    call ZGELSD ( left, left, right, matrixdata, left, vectordata, left, GELOutputS, Tolerance, rank,work,lwork,rwork,iwork,info)

    !Reallocate vectors with optimum workspace
    lwork=int(work(1))
    lrwork=int(rwork(1))
    liwork=iwork(1)
    deallocate(work,rwork,iwork)
    allocate(work(lwork),rwork(lrwork),iwork(liwork))

    call ZGELSD ( left, left, right, matrixdata, left, vectordata, left, GELOutputS,Tolerance,rank,work,lwork,rwork,iwork,info)
    print *,'Solution obtained:',info
    print *,vectordata

end program testlapack
[/fortran]&lt;/PRE&gt; Interestingly, it DID NOT work with the threaded MKL and ILP, only with LP64 interface.&lt;/DIV&gt;&lt;DIV&gt;Best,&lt;/DIV&gt;&lt;DIV&gt;Fer&lt;/DIV&gt;</description>
      <pubDate>Thu, 04 Nov 2010 15:23:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Lapack-LS-solver/m-p/793761#M2466</guid>
      <dc:creator>fercook</dc:creator>
      <dc:date>2010-11-04T15:23:44Z</dc:date>
    </item>
    <item>
      <title>Problems with Lapack LS solver</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Lapack-LS-solver/m-p/793762#M2467</link>
      <description>The reason that your F9x version crashed is that you called the F77 subroutine name with improper arguments. The modules that you listed under USE do not contain the F77 interfaces, as a consequence of which no argument checks were made on the ZGELSD call. Here is a corrected version of your program. In this version, I call the F95 interface name GELS, for which the interface is included in mkl95_lapack.mod.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[fortran]program testlapack&lt;BR /&gt;&lt;BR /&gt;    use mkl95_lapack&lt;BR /&gt;&lt;BR /&gt;    implicit none&lt;BR /&gt;    integer,parameter :: left=5,right=2&lt;BR /&gt;    complex(8),parameter :: II=(0.0d0,1.0d0)&lt;BR /&gt;    real(8),parameter :: Tolerance=1.0d-9&lt;BR /&gt;    real(8) :: tempR(left,left),tempI(left,left),vecR(left,right),vecI(left,right)&lt;BR /&gt;    complex(8) :: matrixdata(left,left),vectordata(left,right)&lt;BR /&gt;    integer :: error&lt;BR /&gt;&lt;BR /&gt;    print *,'Prepare data'&lt;BR /&gt;    call random_number(tempR)&lt;BR /&gt;    call random_number(tempI)&lt;BR /&gt;    matrixdata=tempR+II*tempI&lt;BR /&gt;    call random_number(vecR)&lt;BR /&gt;    call random_number(vecI)&lt;BR /&gt;    vectordata=vecR+II*vecI&lt;BR /&gt;&lt;BR /&gt;    print *,'Call MKL Lapack solver'&lt;BR /&gt;    call GELS( matrixdata, vectordata )&lt;BR /&gt;&lt;BR /&gt;    print *,'Solution obtained:'&lt;BR /&gt;    print *,vectordata&lt;BR /&gt;&lt;BR /&gt;end program testlapack&lt;BR /&gt;[/fortran]&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Nov 2010 01:47:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Lapack-LS-solver/m-p/793762#M2467</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2010-11-05T01:47:35Z</dc:date>
    </item>
  </channel>
</rss>

