<?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 Re: Segfault in dgesvx in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195369#M29813</link>
    <description>&lt;P&gt;And now, about ten hours after they disappeared from this forum last night, both of my deleted posts have reappeared, with no comment or explanation.&lt;/P&gt;
&lt;P&gt;Strange forum behavior!&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jul 2020 15:06:58 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2020-07-28T15:06:58Z</dc:date>
    <item>
      <title>Segfault in dgesvx</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195144#M29807</link>
      <description>&lt;P&gt;I'm getting a segfault in the routine dgesvx using MKL. &lt;A href="https://gist.github.com/mtesseracted/00efe9430d30106224407d270ed1d4bd" target="_self"&gt;Here&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is a minimal working example. I can use dgesv, but not dgesvx which is a version that estimates the condition number of the matrix. I'm compiling with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;ifort dgesvx_tester.f90 -L/opt/intel/composer2020/mkl/lib/intel64 -lmkl_core -lmkl_intel_lp64 -lmkl_sequential -lpthread&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and the output of the program segfaults at the dgesvx routine, but dgesv works. Any help would be appreciated. Sample code output:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt; dgesv solution: 
     2.1213203    -0.7071068     3.0000000     4.0000000     5.0000000
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source             
a.out              000000000040594A  Unknown               Unknown  Unknown
libpthread-2.27.s  00007FDB72F2A8A0  Unknown               Unknown  Unknown
libmkl_core.so     00007FDB75B4DD7A  mkl_lapack_dgesvx     Unknown  Unknown
libmkl_intel_lp64  00007FDB74AE369D  DGESVX                Unknown  Unknown
a.out              0000000000404292  Unknown               Unknown  Unknown
a.out              0000000000403002  Unknown               Unknown  Unknown
libc-2.27.so       00007FDB727AAB97  __libc_start_main     Unknown  Unknown
a.out              0000000000402EEA  Unknown               Unknown  Unknown
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 23:55:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195144#M29807</guid>
      <dc:creator>aaron2</dc:creator>
      <dc:date>2020-07-27T23:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: Segfault in dgesvx</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195155#M29808</link>
      <description>&lt;P&gt;For reference, compiling with debug options (-O0 -debug all -debug-parameters all -debug pubnames -debug variable-locations -debug extended -fvar-tracking -CB -check stack -check uninit -traceback) shows the offending line in my program is the call to dgesvx:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt; dgesv solution: 
     2.1213203    -0.7071068     3.0000000     4.0000000     5.0000000
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source             
a.out              000000000040DB7A  Unknown               Unknown  Unknown
libpthread-2.27.s  00007FF9DDDAD8A0  Unknown               Unknown  Unknown
libmkl_core.so     00007FF9E09D0D7A  mkl_lapack_dgesvx     Unknown  Unknown
libmkl_intel_lp64  00007FF9DF96669D  DGESVX                Unknown  Unknown
a.out              0000000000406656  MAIN__                     83  main.f90
a.out              0000000000403002  Unknown               Unknown  Unknown
libc-2.27.so       00007FF9DD429B97  __libc_start_main     Unknown  Unknown
a.out              0000000000402EEA  Unknown               Unknown  Unknown&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 00:39:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195155#M29808</guid>
      <dc:creator>aaron2</dc:creator>
      <dc:date>2020-07-28T00:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: Segfault in dgesvx</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195182#M29809</link>
      <description>&lt;P&gt;You have chosen the hard way to start using Lapack and BLAS through MKL -- using implicit interfaces by declaring the Lapack routines as EXTERNAL, and attempting to pass the large number of secondary arguments (place holders for optional arguments, work arrays, etc.) that these interfaces require. It often requires quite a bit of time to check that all the input arguments have correct values set, that work arrays are large enough, to test the output codes for values that signify errors and failures, and take appropriate action.&lt;/P&gt;
&lt;P&gt;I suggest that, instead, you use the Lapack95 interfaces, at least for your first attempts. Once the code is working, and you wish to use non-default values or gain more control over what the Lapack routines do, you may switch over to the F77 Lapack calls, but even then you can benefit from interface checking (by add adding INCLUDE 'mkl.fi' or the equivalent USE statements).&lt;/P&gt;
&lt;P&gt;Here is simplified code for your test problem using LAPACK95:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;program xgesvx
  use lapack95
  implicit none
  integer,  parameter   :: dp = selected_real_kind(15,300)

  real(dp), allocatable :: m1(:,:)
  real(dp), allocatable :: v1(:), v2(:)
  real(dp) :: r1, rcond
  integer  :: sz, ii, info

  sz = 5

  ! matrix and vector vars    
  allocate( v1(sz) )
  allocate( v2(sz) )
  allocate( m1(sz,sz) )

  ! set the matrix and the inhomogeneous vector
  m1 = 0.0_dp
  do ii = 1, sz
      v1(ii) = real(ii,dp)
      m1(ii,ii) = 1.0_dp
  end do

  ! set upper 2x2 to Hadamard
  r1 = 1.0_dp / sqrt(2.0_dp)
  m1(1,1) = r1
  m1(1,2) = r1
  m1(2,1) = r1
  m1(2,2) = -r1
  ! calculate v2 = m1.v1
  v2=matmul(m1,v1)
  ! solve
  call gesvx(m1,v2,v1,info=info,rcond=rcond)
  print *,'info from gesvx = ',info, ' and rcond = ',rcond
  print '(1x,A,5F10.5)','v1 = ',v1

  deallocate( v1 )
  deallocate( v2 )
  deallocate( m1 )

  stop
end program xgesvx
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On Windows, I obtained the output&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="none"&gt;Q:\lang\mkl&amp;gt;xgesvx
 info from gesvx =            0  and rcond =   0.500000000000000
 v1 =    1.00000   2.00000   3.00000   4.00000   5.00000&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 03:18:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195182#M29809</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2020-07-28T03:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Segfault in dgesvx</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195185#M29810</link>
      <description>&lt;P&gt;Here is code in which I use the much-easier-to-use Lapack95 interface:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;program xgesvx
  use lapack95
  implicit none
  integer,  parameter   :: dp = selected_real_kind(15,300)

  real(dp), allocatable :: m1(:,:)
  real(dp), allocatable :: v1(:), v2(:)
  real(dp) :: r1, rcond
  integer  :: sz, ii, info

  sz = 5

  ! matrix and vector vars    
  allocate( v1(sz) )
  allocate( v2(sz) )
  allocate( m1(sz,sz) )

  ! set the matrix and the inhomogeneous vector
  m1 = 0.0_dp
  do ii = 1, sz
      v1(ii) = real(ii,dp)
      m1(ii,ii) = 1.0_dp
  end do

  ! set upper 2x2 to Hadamard
  r1 = 1.0_dp / sqrt(2.0_dp)
  m1(1,1) = r1
  m1(1,2) = r1
  m1(2,1) = r1
  m1(2,2) = -r1
  ! calculate v2 = m1.v1
  v2=matmul(m1,v1)
  ! solve
  call gesvx(m1,v2,v1,info=info,rcond=rcond)
  print *,'info from gesvx = ',info, ' and rcond = ',rcond
  print '(1x,A,5F10.5)','v1 = ',v1

  deallocate( v1 )
  deallocate( v2 )
  deallocate( m1 )

  stop
end program xgesvx&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The output, obtained on WIndows using the current MKL version (LP64):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="none"&gt; info from gesvx =            0  and rcond =   0.500000000000000
 v1 =    1.00000   2.00000   3.00000   4.00000   5.00000&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: A few minutes ago, I had posted a more detailed reply with the same code but with more explanations and recommendations. &lt;STRONG&gt;The new Intel forums software, in its wisdom, decided to delete my post when I attempted to edit my reply&lt;/STRONG&gt; in order to improve a couple of sentences.&lt;/P&gt;
&lt;P&gt;No reason was given for why my post was deleted, and no obvious way exists to appeal the high-handed decision to delete. This is a disincentive to post to these forums in the future.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 03:29:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195185#M29810</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2020-07-28T03:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: Segfault in dgesvx</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195197#M29811</link>
      <description>&lt;P&gt;before checking the case -- into this example you shared, i see you linked against mkl2018 but into the description above, you mentioned mkl2020. Did you really try the v.2020?&lt;/P&gt;
&lt;P&gt;! Test program for dgesvx&lt;/P&gt;
&lt;P&gt;! compile command used:&lt;/P&gt;
&lt;P&gt;!ifort dgesvx_tester.f90 -L/opt/intel/&lt;STRONG&gt;composer2018&lt;/STRONG&gt;/mkl/lib/intel64 -lmkl_core -lmkl_intel_lp64 -lmkl_sequential -lpthread&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 05:03:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195197#M29811</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2020-07-28T05:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Segfault in dgesvx</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195337#M29812</link>
      <description>&lt;P&gt;The problem was passing a constant to the&amp;nbsp;&lt;SPAN&gt;EQUED&lt;/SPAN&gt; variable, which required a variable for output, as shown &lt;A href="https://www.reddit.com/r/fortran/comments/hz3s0i/segfault_in_dgesvx/fzh8udp/" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 13:33:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195337#M29812</guid>
      <dc:creator>aaron2</dc:creator>
      <dc:date>2020-07-28T13:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Segfault in dgesvx</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195369#M29813</link>
      <description>&lt;P&gt;And now, about ten hours after they disappeared from this forum last night, both of my deleted posts have reappeared, with no comment or explanation.&lt;/P&gt;
&lt;P&gt;Strange forum behavior!&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 15:06:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195369#M29813</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2020-07-28T15:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: Segfault in dgesvx</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195371#M29814</link>
      <description>&lt;P&gt;thanks for the update - it resolves the case:&lt;/P&gt;
&lt;P&gt;&amp;gt;set MKL_VERBOSE=1&lt;/P&gt;
&lt;P&gt;&amp;gt;dgesvx_tester.exe&lt;BR /&gt;MKL_VERBOSE Intel(R) MKL 2020.0 Update 2 Product build 20200624 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 2 (Intel(R) AVX2) enabled processors, Win 2.60GHz cdecl intel_thread&lt;BR /&gt;MKL_VERBOSE DGESV(5,1,000002044145BF20,5,000002044145FFE0,0000020441487FD0,5,0) 194.56us CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:2&lt;BR /&gt;dgesv solution:&lt;BR /&gt;2.1213203 -0.7071068 3.0000000 4.0000000 5.0000000&lt;BR /&gt;MKL_VERBOSE DGESVX(N,N,5,1,000002044145BF20,5,000002044145BE40,5,000002044145FFE0,N,0000020441487F70,0000020441487F40,0000020441487FD0,5,0000020441487FA0,5,00000008CD8FFDA0,0000020441487F10,0000020441487EE0,0000020441453F60,000002044145FFC0,0) 126.49us CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:2&lt;BR /&gt;dgesvx solution: (rcond= 0.7322E-01)&lt;BR /&gt;-1.4142136 3.4142136 3.0000000 4.0000000 5.0000000&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 14:59:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195371#M29814</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2020-07-28T14:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: Segfault in dgesvx</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195375#M29815</link>
      <description>&lt;P&gt;mecej4, we are very sorry. This happens due to migration to the AEM engine and the support team is working on further improve the stability of the forums.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 15:06:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195375#M29815</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2020-07-28T15:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: Segfault in dgesvx</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195378#M29816</link>
      <description>&lt;P&gt;Gennady,&lt;/P&gt;
&lt;P&gt;The compiler could have caught the error (passing a const character string in place of a character variable) if the interfaces in MKL.fi contained INTENT attributes for the arguments and the OP INCLUDEd MKL.fi in his code.&lt;/P&gt;
&lt;P&gt;The following files (in Parallel Studio XE 2020 U2) do have INTENT for some of the routines that they cover:&lt;/P&gt;
&lt;P&gt;mkl_cluster_sparse_solver.fi&lt;BR /&gt;mkl_dss.fi&lt;BR /&gt;mkl_pardiso.fi&lt;BR /&gt;mkl_sparse_handle.fi&lt;BR /&gt;mkl_vsl_subroutine.fi&lt;/P&gt;
&lt;P&gt;There are no INTENT clauses in&lt;/P&gt;
&lt;P&gt;mkl_blas.fi&lt;BR /&gt;mkl_lapack.fi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 15:17:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195378#M29816</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2020-07-28T15:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: Segfault in dgesvx</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195379#M29817</link>
      <description>&lt;P&gt;I have see similar behavior when trying to post questions to these forums, they are heavily moderated. Thanks again for your solution, I will probably end up using the lapack95 variant in my implementation due to its ease of use.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 15:21:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segfault-in-dgesvx/m-p/1195379#M29817</guid>
      <dc:creator>aaron2</dc:creator>
      <dc:date>2020-07-28T15:21:19Z</dc:date>
    </item>
  </channel>
</rss>

