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

Loss of accuray in ZGEMM and segmentation fault during ZGESVD

kkarco2
Beginner
303 Views
Hi,
I'm using a small program to test out MKL's ZGEMM and ZGESVD routines. First, with ZGEMM I find that there is only 8 digits of accuracy in some entries in the resulting matrix when I compare it against the result from MATLAB. I have definitely made sure that the matrices that are being multiplied have the same representation in MATLAB as they do in my program (upto 14 digits). However, the result of the multiplication varies too much. I am not quite sure if I am making a mistake in choosing compiler options. Second, I cannot get the ZGESVD to work at all. I get a segmentation fault inside the SVD routine. Again I am not quite sure if it because I am missing some compiler option. I see these two problems in all four types of linking to MKL ( static linking to sequential MKL, dynamic linking to sequential MKL, static linking to threaded MKL and dynamic linking to threaded MKL).

I've attached my makefile, main file and the matrix that I am using.
makefile

main.f90

tmp.bin

I am testing the code on Intel 64 architecture with SUSE Linux Enterprise Server 9. The compiler I'm using is Intel Fortran (11.1.072) and the MKL version is 10.2.5.035.

The main program that I have attached loads the matrix (A) and computes the product A times A transpose (A*A'). And also performs (I should say doesn't perform) SVD on A.

Any help is greatly appreciated.

EDIT: Please disregard this post. I found out the problem. It was programming error in the case of ZGESVD. However, I'm still not sure why there is a discrepancy in ZGEMM.
0 Kudos
1 Reply
mecej4
Honored Contributor III
303 Views
There is no discrepancy in the results from ZGEMM. It is incorrect to compare two numbers such as (2D-7, 3D-15) and (2D-7, 3.00001D-15) and conclude that there are only five digits of accuracy.

A better test, if we call these numbers z1 and z2, is to look at |z1-z2|/|z1|. I found only one matrix element (out of 1404 X 198) in your product matrix CZGEMM where this indicator was larger than 10^{-13}, with z1 the result from calling MKL ZGEMM and z2 was from computing sum_k [A_i,k X A_j,k] with a DO loop.

And, just to record the correction that you already discovered:

The call to ZGESVD is missing U after S in the argument list.
0 Kudos
Reply