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

MKL IA32 loses precision when compared with Cygwin Atlas Fortran Lapack

Terry
Beginner
324 Views
Environment - VS 2003 32bit - code written in C++ calling fortran interface to LAPACK

I have some heavy numerical software based on using dgelsd_ or DGELSD to do singular value decomposion many many times with small 12x12 matrices. I have been linking my executables to a library built using the ifor build of LAPACK built in cygwin and using mingw libraries to provide the (very few) system calls these lapack libraries require that are not provided by the Windows environment.

It works well! But it is slow - so I purchased a copy of the intel compilers and MKL. I installed the later and set my builds up to link with MKL. The results are shocking!!

The code runs twice as fast!

The code loses 4 decimal digits in accuracy!! The following computation illustrated the point!

0.238421708325485 Intel MKL
0.238421708234800 CygwinAtlas
0.238421708134877 TRUE VALUE

The errors tend to be random. Both projects are built with the same intel C++ compiler and configuration - the only difference is a macro that switches the names of the modules

#ifdef MKL
#define daxpy_ DAXPY
#define ddot_ DDOT
#define dgelsd_ DGELSD
#define dgelss_ DGELSS
#define dnrm2_ DNRM2
#define dgesv_ DGESV
#define dcopy_ DCOPY
#define dgemm_ DGEMM
#endif

which determines which library routines get linked into the exe file.

Please help me or make suggestions as this loss of accuracy is huge and critical to my requirements.
0 Kudos
3 Replies
Gennady_F_Intel
Moderator
324 Views
Well,
I don't quite understand your issue:
When you built your application under cygwin + mingw, then MKL produced the right results but it was very slow?

But after upgrading by the new Fortran compiler and new MKL losses the precision?

if so, let me ask you some more questions:

1. What mkl version you are using? ( let me the Package ID. You can find it into .docmklsupport.txt )
2. Which libraries you are using for linking? What's your linking line?
3. Can you check if this problem persists if you dont used cyqwin and mingw?
3.1 For example Can you reproduce the problem on one of OS from the list I provided below?

Following is the list of supported operating systems:
Red Hat* EL3 (IA-32 / Intel 64 / IA-64)
Red Hat* EL4 (IA-32 / Intel 64 / IA-64)
Red Hat* EL5 (IA-32 / Intel 64 / IA-64)
SUSE Linux Enterprise Server* 9 (IA-32 / Intel 64 / IA-64)
SUSE Linux Enterprise Server* 10 (IA-32 / Intel 64 / IA-64)
SGI ProPack* for Linux 4 (IA-64)
SGI ProPack* for Linux 5 (IA-64)
Red Hat* Fedora* 9 (IA-32 / Intel 64)
Debian* GNU/Linux 4.0 (IA-32 / Intel 64 / IA-64)
Ubuntu* 8 (IA-32 / Intel 64)
Asianux* Server 3 (IA-32 / Intel 64 / IA-64)
Turbolinux* 11 (IA-32 / Intel 64 / IA-64)
4. what is the CPU type you are working on?
5. Performance: you wrote it is slow
First of all I have to remind you that these task size ( 12x12 ) is very small for MKL. MKL is highly optimized library for big and middle input task sizes and you can find a lot of threads already discussed into this forum.

--Gennady
0 Kudos
Terry
Beginner
324 Views
>Well,
>I don't quite understand your issue:
>When you built your application under cygwin + mingw,


NO, when I built my LAPACK libraries using Cygwin and its fortran compiler, and then linked them into my Visual Studio Project I got accurate answers.

When I linked instead the INTEL MKL libraries into my Visual Studio Project to access the LAPACK functionality, I get substantially less accurate answers to my computations.

At all times the executables are built with the Windows Intel C++ compiler IA32inidentical configuration running on XP and managed in the VS environment.

To use the Cygwin and MinGW libraries I add the following dependentlibraries to my C++ project

liblapack.a libf77blas.a libcblas.a libatlas.a libg2c.a libgcc.a

To use MKL libraries

mkl_c.lib mkl_lapack.lib mkl_core.lib mkl_intel_thread.lib libguide.lib

In both cases there are also dependencies to GMP

"$(SolutionDir)apps$(configurationName)gmp.lib" "$(SolutionDir)apps$(configurationName)mpfr.lib"

>1. What mkl version you are using? ( let me the Package ID. You can find it into .docmklsupport.txt )

the file you mention is not where you say; but there is a csupport.txt and fsupport.txt

Package ID: w_cproc_p_11.0.074

Package ID: w_fproc_p_11.0.074

Hope this can be resolved.

Terry

0 Kudos
Gennady_F_Intel
Moderator
324 Views

the linking line you are using is not correct.
Please try to change the linking command line accordingly the rules we recommend into userguide or you can try to use the Linking Adviser(follow the link: http://software.intel.com/en-us/forums/showthread.php?t=65510)
--gif

0 Kudos
Reply