Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Bug in MKL/Lapack routine DLAMC2

mecej4
Honored Contributor III
604 Views

The routine DLAMC2 is a routine in Lapack (now marked "deprecated", but still present and/or used in many codes that were developed with older versions of Lapack). This routine is present in MKL, and documented. Some of the returned values are wrong with the current version (20230320) of MKL on WIndows 11 64 bit.

Here is a very short reproducer:

 

program tdlamc2
   implicit none
   integer beta, it, imin, imax, irnd
   double precision eps, rmin, rmax
   logical lrnd

   call dlamc2( beta, it, lrnd, eps, imin, rmin, imax, rmax )
   if( lrnd ) then
      irnd = 1
      eps = ( beta**( 1d0-it ) ) / 2
   else
      irnd = 0
      eps = beta**( 1d0-it )
   end if
   print 77, beta,it,irnd,imin,imax
77 format('base,it,irnd,  imin,imax: ',5I8)
   print 78,eps,rmin,rmax
78 format('eps,rmin,rmax: ',3ES20.12)
end program

 

Compile and run:

 

ifort /Qmkl tdlamc2.f90
tdlamc2
base,it,irnd,  imin,imax:        0      53       1   32759    1024
eps,rmin,rmax:             Infinity  2.225073858507-308  1.797693134862+308

 

The results for BASE, IMIN and EPS are wrong. The correct results:

 

base,it,irnd,  imin,imax:        2      53       1   -1021    1024
eps,rmin,rmax:   1.110223024625E-16  2.225073858507-308  1.797693134862+308

 

I tried to work around the problem by using the source code for DLAMC2 ( www.netlib.org/lapack/explore-html/d8/d32/dlamchf77_8f_source.html ), and built using the command

 

ifort /O2 /Qmkl tdlamc2.f90 dlamch.f

 

but the resulting EXE hangs when run. It runs and gives the correct results if the /Od (disable optimization) option is used, but that is not a good option for using in large programs that run long.

0 Kudos
1 Solution
ShanmukhS_Intel
Moderator
377 Views

Hi Nagaraj,

 

Thank you for your patience. The issue raised by you has been fixed in version 2023.2. If the issue persists with the new release, please start a new discussion thread in the community forum and we’d investigate it further. Please check the release notes for other features and bug fixes

 

Below are the results captured at our end for ifort version 2021.10.0.

base,it,irnd, imin,imax:    2   53    1  -1021  1024

eps,rmin,rmax:  1.110223024625E-16 2.225073858507-308 1.797693134862+308

 

Best Regards,

Shanmukh.SS

 

View solution in original post

0 Kudos
3 Replies
ShanmukhS_Intel
Moderator
527 Views

Hi Nagaraj,

 

Thanks for posting in Intel Communities.

 

Thanks for sharing the sample reproducer and other details. We could see the incorrect results being printed when compiling using "ifort /Qmkl tdlamc2.f90" and under other scenarios. Our engineering team is working on your issue internally. We will get back to you soon with an update.

 

Best Regards,

Shanmukh.SS

 

0 Kudos
ShanmukhS_Intel
Moderator
378 Views

Hi Nagaraj,

 

Thank you for your patience. The issue raised by you has been fixed in version 2023.2. If the issue persists with the new release, please start a new discussion thread in the community forum and we’d investigate it further. Please check the release notes for other features and bug fixes

 

Below are the results captured at our end for ifort version 2021.10.0.

base,it,irnd, imin,imax:    2   53    1  -1021  1024

eps,rmin,rmax:  1.110223024625E-16 2.225073858507-308 1.797693134862+308

 

Best Regards,

Shanmukh.SS

 

0 Kudos
ShanmukhS_Intel
Moderator
355 Views

Hi Nagaraj,


It’s great to know that the issue has been resolved, in case you run into any other issues please feel free to create a new thread.


Best Regards,

Shanmukh.SS


0 Kudos
Reply