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

ZHBEVD returns a wrong space size on query

mboisson
Beginner
356 Views
Hi,
I have a code that uses ZHBEVD. I try linking it with either a generic version of LAPACK or with MKL. The exact same code, linked with either library does not give the same workspace sizes.

With the generic version of LAPACK, I get :
lwork: 162
lrwork: 208
liwork: 48

With MKL, I get :
lwork: 162
lrwork: 208
liwork: 210453397552

This last liwork size obviously produces a bad_alloc error and terminates the program.

Not sure if this is the right place to submit this, but here it is.
0 Kudos
4 Replies
Gennady_F_Intel
Moderator
356 Views
Could you attach the example of the code you use?
see this link how to attach file to forum post.
--Gennady
0 Kudos
mboisson
Beginner
356 Views
Hi,
Yes, here is a sample code. The included headers are not the ones provided with MKL, but rather the clapack ones. It should however not matter other than calling the types by different names.

Here is the output of the program :
[mboisson@ip12 demo]$ ./demo_exe_test_zhbevd.out
Content of the matrix:
(0,0)
(0,0)
(-0.1,0)
(0,0)
(-0.141421,0)
(0,0)
Before workspace query
jobz:V
uplo:U
n:3
kd: 1
ldab: 2
lwork: -1
lrwork: -1
liwork: -1
info: 0
After workspace query
jobz:V
uplo:U
n:3
kd: 1
ldab: 2
lwork: 18
lrwork: 34
liwork: 210453397522
info: 0
terminate called after throwing an instance of 'std::bad_alloc'
what(): St9bad_alloc
Aborted

0 Kudos
mboisson
Beginner
356 Views
Oh, and the MKL version that is used is mkl64/10.1.3.027
0 Kudos
Tamara_K_Intel
Employee
356 Views
Hello,

If you use libmkl_intel_lp64.a for linking you should change the line typedef long int integer; to typedef int integer; in file f2c.h.

Or you should use libmkl_intel_ilp64.a for correct result because sizeof (long int) = 8 byte for Linux and 64-bit x86-64.

Below my output result with libmkl_intel_ilp64.a:

Content of the matrix:

(0,0)

(0,0)

(-0.1,0)

(0,0)

(-0.141421,0)

(0,0)

Before workspace query

jobz:V

uplo:U

n:3

kd: 1

ldab: 2

lwork: -1

lrwork: -1

liwork: -1

info: 0

After workspace query

jobz:V

uplo:U

n:3

kd: 1

ldab: 2

lwork: 18

lrwork: 34

liwork: 18

info: 0

0 Kudos
Reply