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

error #lnk2038 while running any function defined in mkl_spblas.h vs2017+intelmkl2020.4

ruihuasun
Beginner
1,714 Views

Problem is: 

lnk2038 happens when I call the functions defined in mkl_spblas.h in Debugx86 and Debug x64 module.

error LNK2038: mismatch detected for '_ITERATO R_DEBUG_LEVEL': value '0' doesn't match value '2'
error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in application.obj 
in file:\mkl_core.lib(_avx512_jit_destroy.obj)
mkl_core.lib(_avx2_jit_destroy.obj)
mkl_core.lib(_avx_jit_destroy.obj)

run module: Debugx86 and Debug x64

environment: vs2017 IDE + vs2017(v141) compiler + intelmkl2020.4

link libraries list in x86 is: mkl_intel_c.lib; mkl_sequential.lib; mkl_core.lib

link libraries list in x64 is: mkl_intel_lp64.lib; mkl_sequential.lib; mkl_core.lib

code generation set in C/C++ of configuration: MTd/ MDd..(I have tried all mt/mtd/md/mdd, it doesn't work)

preprocesser definition: _DEBUG; _CONSOLE (I also try by adding _ITERATOR_DEBUG_LEVEL=0;  it doesn't work)

 

However, all the other mkl functions such as "cblas_daxpy" defined in mkl_blas.h work well.

 

code sample is here (I copy this sample from mklroot/example, ps. same error exists when directly debug the file in mklroot/example):

#include <iostream>
#include <complex>
#include <vector>
#include <complex>
#include <cmath>

#include "mkl_spblas.h"

using namespace std;

int main()
{
#define M 5
#define NRHS 2
#define NNZ 13

	double csrVal[NNZ] = { 1.0, -1.0,     -3.0,
							 -2.0,  5.0,
										 4.0, 6.0, 4.0,
							 -4.0,       2.0, 7.0,
									8.0,          -5.0 };
	MKL_INT    csrColInd[NNZ] = { 0,      1,        3,
							  0,      1,
										   2,   3,   4,
							  0,           2,   3,
									  1,             4 };
	MKL_INT    csrRowPtr[M + 1] = { 0, 3, 5, 8, 11, 13 };

	sparse_matrix_t       csrA;

	mkl_sparse_d_create_csr(&csrA, SPARSE_INDEX_BASE_ZERO,
		M,  // number of rows
		M,  // number of cols
		csrRowPtr,
		csrRowPtr + 1,
		csrColInd,
		csrVal);

}

 

Labels (3)
0 Kudos
4 Replies
mecej4
Honored Contributor III
1,667 Views

I compiled your example in a 64-bit OneAPI command window (Version 2021.1.2 Build 20201208_000000) using

 

icl /MD /traceback /Qmkl rui.cpp

 

The program was built with no error messages,  and the resulting EXE ran to completion.

I repeated, using icx instead of icl, and the results were the same.

Conclusion: check your Visual Studio preferences and project settings.

You wrote: "I have tried all mt/mtd/md/mdd, it doesn't work". Please do not waste time trying arbitrary options.

On this page the specific error that you reported is documented. I do not recognize the modules that you named "Debugx86 and Debug x64 module". Where did they come from?

0 Kudos
RahulV_intel
Moderator
1,626 Views

Hi @ruihuasun,

 

I tried to build/run your code sample using the latest oneAPI release on VS-19. The build was successful. Also, the executable ran without any issues.

 

It looks like you have Parallel studio update-4 in your environment. Could you please try to compile/run your code sample on the command line (by sourcing the PSXE environment) and let us know if it works?

 

Thanks,

Rahul

0 Kudos
RahulV_intel
Moderator
1,581 Views

Hi,


Just a quick reminder to try out your code sample on the command line and let us know if you notice any issues.


Thanks,

Rahul


0 Kudos
RahulV_intel
Moderator
1,561 Views

Hi,


I have not heard back from you, so I will go ahead and close this thread from my end. Feel free to post a new query if you require further assistance from Intel.


Thanks,

Rahul


0 Kudos
Reply