Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Nirmal_A_
Beginner
58 Views

cblas_dgemm in x64 returning bad values

I'm getting bad values when using cblas_dgemm in x64. However, it works fine in x86. Is there some configuration i'm missing to use that function in x64? My code and the outputs for x86 and x64 can be found in the link to the stack overflow page below.

 

http://stackoverflow.com/questions/40556267/mkl-cblas-dgemm-giving-me-garbage-results-when-debugging...

0 Kudos
8 Replies
mecej4
Black Belt
58 Views

With the current Intel X64 C compiler

Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.1.143 Build 20161005
Copyright (C) 1985-2016 Intel Corporation.  All rights reserved.

I get the correct result when I compile with icl /Qmkl and run. I also get the correct result if I compile using the MS C++ V18 compiler and link with mkl_rt.lib.

Which compiler did you use, and how did you build the EXE?

Nirmal_A_
Beginner
58 Views

how do you compile with icl / Qmkl? I originally did not have mkl_rt.lib included. I tried adding that but i'm still getting the wrong values. Also, I've only found MSVC++ compilers that go up to 14.

This is the command line for my compilation:

/OUT:"C:\Users\nirma\OneDrive\Documents\Visual Studio 2015\Projects\mkltest\x64\Debug\mkltest.exe" /MANIFEST /NXCOMPAT /PDB:"C:\Users\nirma\OneDrive\Documents\Visual Studio 2015\Projects\mkltest\x64\Debug\mkltest.pdb" /DYNAMICBASE "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" "mkl_rt.lib" /MACHINE:X64 /INCREMENTAL /PGD:"C:\Users\nirma\OneDrive\Documents\Visual Studio 2015\Projects\mkltest\x64\Debug\mkltest.pgd" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Debug\mkltest.exe.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /TLBID:1 

Nirmal_A_
Beginner
58 Views

I tried it on another computer in x64. The code worked fine. I'm guessing it's an issue with this machine. Also the other machine had an older version of mkl. I'll update that one to 11.3 and see if i get the same issue

mecej4
Black Belt
58 Views

What you showed is only part of the command line.  Are you compiling in an Intel-C command window (as I did in #2), or an MS-C command window, or in Visual Studio? Which C compiler are you using?

Older versions of MKL did not provide mkl_rt.lib. With such a version, use the MKL Link Line Advisor at https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor or see the MKL documentation for instructions.

Note that /Qmkl (note no space between '/' and 'Q') is an Intel C compiler option. MS C does not recognize that option.

Nirmal_A_
Beginner
58 Views

I'm compiling in visual studio

Nirmal_A_
Beginner
58 Views

Is there a way for me to step into cblas_dgemm function while debugging?

mecej4
Black Belt
58 Views

Nirmal A. wrote:

Is there a way for me to step into cblas_dgemm function while debugging?

Only in the disassembly window, and I am not sure that you would find it useful to do so. Furthermore, be aware that CBLAS routines may actually be wrappers around Fortran BLAS routines in which the actual work is done. Why do you want to go there?

 

Nirmal_A_
Beginner
58 Views

I fixed the problem! I had to go to  

Properties » Configuration properties » C/C++ » Code Generation » Runtime Library

and change it from 

-Multi-threaded Debug DLL (/MDd): linking with dynamic Intel MKL libraries

to

-Multi-threaded (/MT): linking with static Intel MKL libraries

The issue was that I was doing dynamic linking instead of static. I found this webpage very useful in helping me overcome the issue

https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-compiling-and-linking-...

 

Reply