<?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: HEEVR to calculate eigenvalues only (Fortran95) in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1234811#M30451</link>
    <description>&lt;P&gt;For a second approach, I built a Lapack95+Blas95 library using the sources that come with MKL, in the interfaces/blas95/source and interfaces/lapack95/source directories. I built on Windows 10 x64, using Cygwin64 and Gfortran 10. Rather than wrestle with the makefile, I simply compiled all the sources using -c -O, and created liblapack95.a using &lt;STRONG&gt;ar&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;Using the library now built, I compiled the example that I gave with the command&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;gfortran -I. awm.f90 -L. -llapack95 -llapack -lblas&lt;/LI-CODE&gt;
&lt;P&gt;The resulting EXE ran normally and the output was similar to that in my preceding post.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Dec 2020 17:14:34 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2020-12-07T17:14:34Z</dc:date>
    <item>
      <title>HEEVR to calculate eigenvalues only (Fortran95)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1233607#M30408</link>
      <description>&lt;P&gt;I am trying t use the Fortran95 interface to HEEVR to calculate only the eigenvalues of a matrix (I don't need the eigenvectors). When I use&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;call heevr(A,w)&lt;/LI-CODE&gt;
&lt;P&gt;it segfaults with&lt;/P&gt;
&lt;LI-CODE lang="none"&gt;Program received signal SIGSEGV: Segmentation fault - invalid memory reference.&lt;/LI-CODE&gt;
&lt;P&gt;When I use&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;call heevr(A,w,z=U)&lt;/LI-CODE&gt;
&lt;P&gt;it works just fine. I must be missing something stupid, but I cannot see what is wrong.Can somebody tell me what's wrong?&lt;/P&gt;
&lt;P&gt;The compiler is gfortran 7.5.0, MKL version is 2018. Here is a full minimum (non-)working example:&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;program min_heevr_test

  use f95_precision, only: wp =&amp;gt; dp,sp,dp
  use lapack95, only: heevr

  implicit none
  
  real(wp) :: w(4),A_re(4,4),A_im(4,4)
  complex(wp) :: A(4,4),U(4,4)
  
  ! Generate random Hermitian matrices
  call random_number(A_re)
  call random_number(A_im)
  A = cmplx(A_re,A_im,wp)
  A = 0.5_wp * (A + transpose(conjg(A)))

  ! This line causes a segfault
  call heevr(A,w)
  ! This line works
  !call heevr(A,w,z=U)
  write(*,"(4g12.3)") w
    
end program min_heevr_test
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Arthur&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 18:16:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1233607#M30408</guid>
      <dc:creator>AWMagill</dc:creator>
      <dc:date>2020-12-02T18:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: HEEVR to calculate eigenvalues only (Fortran95)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1234580#M30438</link>
      <description>&lt;P&gt;I compiled, linked and ran your example on Windows using the&amp;nbsp;19.1.3.311 Intel Fortran compiler and the MKL that came with Parallel Studio 2020 . The output was&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;  -0.970      -0.138       0.542        2.48&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide details of compiler options used, the command line used to compile and build, and whether you are generating code for 32-bit or 64-bit OS.&lt;/P&gt;
&lt;P&gt;Did you generate the Lapack95 module file for Gfortran yourself? What happens if you comment out the "&amp;nbsp;use lapack95..." line?&lt;/P&gt;</description>
      <pubDate>Sun, 06 Dec 2020 13:39:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1234580#M30438</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2020-12-06T13:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: HEEVR to calculate eigenvalues only (Fortran95)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1234631#M30440</link>
      <description>&lt;P&gt;Yes, I agree with mecej4. We need to know all details.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We built your example on win10,64bit and here is the result:&amp;nbsp;-0.970 -0.138 0.542 2.48&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 02:56:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1234631#M30440</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2020-12-07T02:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: HEEVR to calculate eigenvalues only (Fortran95)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1234632#M30441</link>
      <description>&lt;P&gt;and&amp;nbsp;here are the mkl verbose outputs:&lt;BR /&gt;MKL_VERBOSE Intel(R) MKL 2020.0 Update 4 Product build 20200917 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 ZHEEVR(N,A,U,4,00007FF772766A00,4,0000005C792FF8D0,0000005C792FF8D8,1,4,0000005C792FF8C8,0,00007FF772766B00,0000005C792FF890,1,0000005C792FF8C0,0000005C792FF8B0,-1,0000005C792FF8E0,-1,0000005C792FF910,-1,0) 1.29ms CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:2&lt;BR /&gt;MKL_VERBOSE ZHEEVR(N,A,U,4,00007FF772766A00,4,0000005C792FF8D0,0000005C792FF8D8,1,4,0000005C792FF8C8,4,00007FF772766B00,0000005C792FF890,1,0000005C792FF8C0,0000023544AD3F80,8,0000023544ADFD00,96,0000023544ADBF60,40,0) 151.83us CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:2&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 03:00:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1234632#M30441</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2020-12-07T03:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: HEEVR to calculate eigenvalues only (Fortran95)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1234704#M30443</link>
      <description>&lt;P&gt;Thanks both for your help. Here are the details I neglected to include before:&lt;/P&gt;
&lt;P&gt;The OS is Ubuntu (buster/sid), &lt;BR /&gt;GNU Fortran (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0&lt;BR /&gt;MKL 2018.2.199&lt;/P&gt;
&lt;P&gt;And yes, I built the Lapack95 module myself.&lt;/P&gt;
&lt;P&gt;My Makefile for the above example looks like this:&lt;/P&gt;
&lt;LI-CODE lang="none"&gt;MKLROOT =/opt/intel/mkl
F95ROOT =/opt/intel/mkl/interfaces/lapack95/gfortran
FC      = gfortran
FCFLAGS = -m64 -O3 -g \
          -I${F95ROOT}/include/intel64/lp64 \
          -I${MKLROOT}/include \
          -Wall -Wno-maybe-uninitialized -Wno-tabs \
          -fcheck=all \
          -fopenmp
LDFLAGS = -L${MKLROOT}/lib/intel64
LDLIBS	= ${F95ROOT}/lib/intel64/libmkl_lapack95_lp64.a \
          -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core \
          -lgomp -lpthread -lm -ldl -lz

min_heevr_test: min_heevr_test.o
	$(FC) $(FCFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)

min_heevr_test.o: min_heevr_test.f90
	$(FC) $(FCFLAGS) -c $^&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;If I compile with call heevr(A,w,z=U), I get&lt;/P&gt;
&lt;LI-CODE lang="none"&gt;$./min_heevr_test 
MKL_VERBOSE Intel(R) MKL 2018.0 Update 2 Product build 20180127 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 2 (Intel(R) AVX2) enabled processors, Lnx 3.70GHz lp64 gnu_thread
MKL_VERBOSE ZHEEVR(V,A,U,4,0x7fff881c1e00,4,0x7fff881c1a48,0x7fff881c1a40,1,4,0x7fff881c1aa0,0,0x7fff881c1c60,0x7fff881c1f00,4,0x5583f4f8f8d0,0x7fff881c1990,-1,0x7fff881c19a0,-1,0x7fff881c19ac,-1,0) 20.56ms CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:6
MKL_VERBOSE ZHEEVR(V,A,U,4,0x7fff881c1e00,4,0x7fff881c1a48,0x7fff881c1a40,1,4,0x7fff881c1aa0,4,0x7fff881c1c60,0x7fff881c1f00,4,0x5583f4f8f8d0,0x5583f4fa0bf0,8,0x5583f4fa1990,96,0x5583f4fa18e0,40,0) 181.72us CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:6
  -0.566       0.203       0.780        2.28    
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I compile with call heevr(A,w), I get&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;$ ./min_heevr_test 
MKL_VERBOSE Intel(R) MKL 2018.0 Update 2 Product build 20180127 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 2 (Intel(R) AVX2) enabled processors, Lnx 1.90GHz lp64 gnu_thread
MKL_VERBOSE ZHEEVR(N,A,U,4,0x7fff92b2dd00,4,0x7fff92b2d998,0x7fff92b2d990,1,4,0x7fff92b2d9f0,0,0x7fff92b2dbb0,0x7fff92b2da10,1,0x7fff92b2da28,0x7fff92b2d8e0,-1,0x7fff92b2d8f0,-1,0x7fff92b2d8fc,-1,0) 20.71ms CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:6
MKL_VERBOSE ZHEEVR( 191.71us CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:6

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7f9d1c7ec2ed in ???
#1  0x7f9d1c7eb503 in ???
#2  0x7f9d1b80803f in ???
#3  0x7f9d1b957b80 in ???
#4  0x55f4ce1f677e in ???
#5  0x55f4ce1f5558 in min_heevr_test
	at &amp;lt;SNIP&amp;gt;/min_heevr_test.f90:20
#6  0x55f4ce1f4a8e in main
	at &amp;lt;SNIP&amp;gt;/min_heevr_test.f90:3
Segmentation fault (core dumped)
&lt;/LI-CODE&gt;
&lt;P&gt;If I comment out the USE lapack95 line, the make fails with&lt;/P&gt;
&lt;LI-CODE lang="none"&gt;min_heevr_test.o: In function `MAIN__':
&amp;lt;SNIP&amp;gt;/min_heevr_test.f90:20: undefined reference to `heevr_'
collect2: error: ld returned 1 exit status
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/41971"&gt;@mecej4&lt;/a&gt; what are you looking for with this test?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I half expected that I was doing something wrong in the way I called HEEVR, so that you have both compiled and run the example already tells me something useful.&lt;/P&gt;
&lt;P&gt;Please let me know if I have missed something, or if I can try something else. Or even better, if you have figured out what is wrong!&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Arthur&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 09:18:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1234704#M30443</guid>
      <dc:creator>AWMagill</dc:creator>
      <dc:date>2020-12-07T09:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: HEEVR to calculate eigenvalues only (Fortran95)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1234754#M30449</link>
      <description>&lt;P&gt;There are a number of issues present that complicate tracking down the error that you encountered. The &lt;A href="http://www.netlib.org/lapack95/" target="_self"&gt;Netlib version of Lapack95&lt;/A&gt;&amp;nbsp;does not contain the optional argument z=, and the Intel MKL version does; the MKL version does not contain JOBZ as an optional argument, but the Netlib version does. We can infer that the particular sources used for building Lapack95 affect the interface; furthermore, the makefile and compiler options and version may also affect the resulting modules and libraries. Furthermore, different compilers use different RNGs for RANDOM_NUMBER.&lt;/P&gt;
&lt;P&gt;Here is a modified version of your example program, which runs without error with the current release of Intel Fortran (19.1.3) and MKL 2020.0.4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;program min_heevr_test

  use f95_precision, only: wp =&amp;gt; dp,sp,dp
  use lapack95, only: heevr

  implicit none

  real(wp)    :: w(4),A_re(4,4),A_im(4,4)
  complex(wp) :: A(4,4),U(4,4)

  ! Generate random Hermitian matrices
  call random_number(A_re)
  call random_number(A_im)
  A = cmplx(A_re,A_im,wp)
  A = 0.5_wp * (A + transpose(conjg(A)))
  U = A ! U is not used in first call, so use it to save A

  call heevr(A,w)
  write(*,"(1x,A17,4g12.3)") '(A,w) : ',w

!restore A
  A = U
  call heevr(A,w,z=U)
  write(*,"(1x,A17,4g12.3)") "(A,w,z=U) : ",w
  write(*,"(1x,A4,/,4(4(2F7.3,2x),/))") 'U = ',transpose(U)

end program min_heevr_test&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Compiling and running:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;S:\LANG\MKL&amp;gt;ifort /Qmkl xheevr.f90 mkl_lapack95_lp64.lib
...
S:\LANG\MKL&amp;gt;xheevr
          (A,w) :   -0.970      -0.138       0.542        2.48
      (A,w,z=U) :   -0.970      -0.138       0.542        2.48
 U =
  0.226 -0.550   -0.541  0.082    0.089 -0.489   -0.317 -0.008
 -0.130  0.327   -0.444  0.244    0.159  0.505   -0.577  0.078
 -0.542 -0.058    0.388 -0.263    0.441 -0.283   -0.453 -0.045
  0.474  0.000    0.474  0.000   -0.445  0.000   -0.594  0.000
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thus, the two calls are fine when the Intel compiler and prebuilt Lapack95 are used (on Windows, at least).&lt;/P&gt;
&lt;P&gt;If you state how you built Lapack95 and identify the version of the sources used, someone may investigate further. Otherwise, there appears to be no error as far as this particular example is concerned.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 13:39:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1234754#M30449</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2020-12-07T13:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: HEEVR to calculate eigenvalues only (Fortran95)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1234811#M30451</link>
      <description>&lt;P&gt;For a second approach, I built a Lapack95+Blas95 library using the sources that come with MKL, in the interfaces/blas95/source and interfaces/lapack95/source directories. I built on Windows 10 x64, using Cygwin64 and Gfortran 10. Rather than wrestle with the makefile, I simply compiled all the sources using -c -O, and created liblapack95.a using &lt;STRONG&gt;ar&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;Using the library now built, I compiled the example that I gave with the command&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;gfortran -I. awm.f90 -L. -llapack95 -llapack -lblas&lt;/LI-CODE&gt;
&lt;P&gt;The resulting EXE ran normally and the output was similar to that in my preceding post.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 17:14:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1234811#M30451</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2020-12-07T17:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: HEEVR to calculate eigenvalues only (Fortran95)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1235547#M30469</link>
      <description>&lt;P&gt;Thank you for your help. I now have the problem fixed.&lt;/P&gt;
&lt;P&gt;As a first step, I tried downloading and installing a newer version of the MKL (OneAPI 2021.1.1). I built the lapack95 interface using the provided makefile, and then my code compiled and ran exactly as I expected it to.&lt;/P&gt;
&lt;P&gt;I then went back and rebuilt the lapack95 interface for the old version (2018.2.199) using the makefile from Intel as:&lt;/P&gt;
&lt;LI-CODE lang="none"&gt;/opt/intel/mkl/interfaces/lapack95$ sudo make libintel64 INSTALL_DIR=./gfortran interface=lp64 FC=gfortran&lt;/LI-CODE&gt;
&lt;P&gt;And now my example compiles and runs just fine there too. It's not a very satisfying answer, but at least it runs! I suspect I may have updated gfortran as part of an apt-update, and not rebuild the interface. The main clue I needed was that you could compile it, so it was an installation problem rather than a programmer-not-understanding-the-interface problem.&lt;/P&gt;
&lt;P&gt;Thanks again,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Arthur&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 09:21:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1235547#M30469</guid>
      <dc:creator>AWMagill</dc:creator>
      <dc:date>2020-12-09T09:21:15Z</dc:date>
    </item>
    <item>
      <title>Re:HEEVR to calculate eigenvalues only (Fortran95)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1235551#M30470</link>
      <description>&lt;P&gt;ok, the issue is closed.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 09 Dec 2020 09:34:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/HEEVR-to-calculate-eigenvalues-only-Fortran95/m-p/1235551#M30470</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2020-12-09T09:34:36Z</dc:date>
    </item>
  </channel>
</rss>

