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

Incorrect workspace size returned by query to DGESVD in MKL 11.0.5

mecej4
Honored Contributor III
797 Views

There are discrepancies between the required minimum value of the argument lwork (i) as stated in the documentation, (ii) as returned by a workspace query with lwork=-1 and (iii) the value required to pass the input argument check in routine DGESVD, for the case JOBU='N', JOBVT='N' -- the case where only the singular values are desired. Here is a reproducer, based on the details provided in another thread ("bug in MKL 11.0update5 DGESVG", http://software.intel.com/en-us/forums/topic/402436). The outputs were obtained using IFort 13.1.3.198/32-bit on Win-8-Pro-64.

[fortran]

program dgesvdx
c Program to demonstrate incorrect estimate of lwork in call to ?gesvd
c in MKL 11.0.5
c
c use mkl_lapack
implicit none
character*1 :: jobu, jobvt
integer :: m,n,lda,ldu,ldvt,lwork,info
double precision :: A(1,10)
double precision :: work(13),S(1),U(1),VT(1)
character*200 buf
data A/2d0, 7d0, 5d0, 9d0, 3d0, 6d0, 2d0, 5d0, 4d0, 8d0/
c
call mkl_get_version_string( buf )
write(*,'(A)')buf
m=1
n=10
jobu='N'
jobvt='N'
lda=1
ldu=1
ldvt=1
c
c First call to find lwork needed
c
lwork=-1
call dgesvd(jobu, jobvt, m, n, a, lda, s, u, ldu, vt, ldvt,
+ work, lwork, info)
write(*,*)'info = ',info,' lwork asked for by MKL =',work(1)
lwork=nint(work(1))
c
c starting with size returned, try increasing values until DGESVD
c accepts the value as sufficient
c
info=-1
do while(info .lt. 0)
call dgesvd(jobu, jobvt, m, n, a, lda, s, u, ldu, vt, ldvt,
+ work, lwork, info)
write(*,*)'lwork = ',lwork,' info = ',info
lwork=lwork+1
end do
write(*,*)'s = ',s(1)
end program dgesvdx

[/fortran]

Output with version 11.0.1 of MKL[bash]

Intel(R) Math Kernel Library Version 11.0.1 Product Build 20121016 for 32-bit applications


info = 0 lwork asked for by MKL = 5.00000000000000
lwork = 5 info = 0
s = 17.6918060129541

[/bash]

Output with version 11.0.5 of MKL[bash]

Intel(R) Math Kernel Library Version 11.0.5 Product Build 20130612 for 32-bit applications


info = 0 lwork asked for by MKL = 5.00000000000000

MKL ERROR: Parameter 13 was incorrect on entry to DGESVD.
lwork = 5 info = -13

MKL ERROR: Parameter 13 was incorrect on entry to DGESVD.
lwork = 6 info = -13

MKL ERROR: Parameter 13 was incorrect on entry to DGESVD.
lwork = 7 info = -13

MKL ERROR: Parameter 13 was incorrect on entry to DGESVD.
lwork = 8 info = -13

MKL ERROR: Parameter 13 was incorrect on entry to DGESVD.
lwork = 9 info = -13

MKL ERROR: Parameter 13 was incorrect on entry to DGESVD.
lwork = 10 info = -13

MKL ERROR: Parameter 13 was incorrect on entry to DGESVD.
lwork = 11 info = -13

MKL ERROR: Parameter 13 was incorrect on entry to DGESVD.
lwork = 12 info = -13
lwork = 13 info = 0
s = 17.6918060129541

[/bash]

0 Kudos
5 Replies
mecej4
Honored Contributor III
797 Views

Forum bug: there is no edit button for my own post, so I cannot edit the above post, but I can edit this response! I can also edit the original post if I fiddle with the URL (add "/edit" to the thread URL).

0 Kudos
SergeyKostrov
Valued Contributor II
797 Views
There is a simple workaround of that No Edit button issue for the 1st post: Next time when you create a new Thread do not post everything into the 1st post. I usually provide just generic details about the problem with a comment that details will be provided ( all the rest posts could be edited ).
0 Kudos
Gennady_F_Intel
Moderator
797 Views

yes,there are discrepancies between the required minimum value of the argument lwork as stated in the documentation. Tnanks Mecej. we will check the problem.

0 Kudos
Aleksandr_Z_Intel
797 Views

mecej4,

Thank you for reporting the issue. Workaround is to set lwork ≥ max(3*min(m, n)+max(m, n), 5*min(m,n)) for real flavors and lwork ≥ 2*min(m, n)+max(m, n) for complex flavors for m and n such that (12*m+n) <160 or (12*n+m) <160.

0 Kudos
Gennady_F_Intel
Moderator
797 Views

the issue has been fixed in the 11.1 update 1. 

0 Kudos
Reply