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

linking problems using cgetrf

asim_masud
Beginner
409 Views

Hi

I am trying to use "

cgetrf" for LU factorization of a complex matrix in MS VC++2005. However i am encountring a linking problem.I have oadded mkl_c.lib and mkl_lapack.lib in my linker path. Kindly help me .

My sample code is as described

/*=======================================================================================================================*/

#include

#include

#include

extern

"C" {void cgetrf_( MKL_INT *m, MKL_INT *n, MKL_Complex8 *a, MKL_INT *lda, MKL_INT *ipiv, MKL_INT *info );}

int

main(void)

{

int m=3,n=3,lda=3;

int ipiv[3],info;

MKL_Complex8 *a;

cgetrf_( &m, &n, a, &lda, ipiv, &info );

_getch();

return 0;

}

/*=======================================================================================================================*/

The errors are:

1>------ Build started: Project: mkl_proj, Configuration: Debug Win32 ------

1>Compiling...

1>dec_1.cpp

1>c:\documents and settings\asim masud\my documents\visual studio 2005\projects\mkl_proj\mkl_proj\dec_1.cpp(14) : warning C4700: uninitialized local variable 'a' used

1>Linking...

1>C:\Program Files\Intel\MKL\10.1.0.018\ia32\lib\mkl_c.lib : warning LNK4042: object specified more than once; extras ignored

1>mkl_intel_thread.lib(cgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_global_thread_num referenced in function _mkl_lapack_cgetrf

1>mkl_intel_thread.lib(cgetrf_ib_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_global_thread_num

1>mkl_intel_thread.lib(ctrsm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_global_thread_num

1>mkl_intel_thread.lib(cgemm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_global_thread_num

1>mkl_intel_thread.lib(cgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_dispatch_init_4 referenced in function L__mkl_lapack_cgetrf_340__par_loop1

1>mkl_intel_thread.lib(cgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_dispatch_next_4 referenced in function L__mkl_lapack_cgetrf_340__par_loop1

1>mkl_intel_thread.lib(cgetrf_omp.obj) : error LNK2019: unresolved external symbol _omp_get_thread_num referenced in function L__mkl_lapack_cgetrf_243__par_region0

1>mkl_intel_thread.lib(cgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_barrier referenced in function L__mkl_lapack_cgetrf_243__par_region0

1>mkl_intel_thread.lib(cgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_critical referenced in function L__mkl_lapack_cgetrf_243__par_region0

1>mkl_intel_thread.lib(cgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_end_critical referenced in function L__mkl_lapack_cgetrf_243__par_region0

1>mkl_intel_thread.lib(cgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_ok_to_fork referenced in function L__mkl_lapack_cgetrf_243__par_region0

1>mkl_intel_thread.lib(cgetrf_ib_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_ok_to_fork

1>mkl_intel_thread.lib(ctrsm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_ok_to_fork

1>mkl_intel_thread.lib(cgemm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_ok_to_fork

1>mkl_intel_thread.lib(cgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_push_num_threads referenced in function L__mkl_lapack_cgetrf_243__par_region0

1>mkl_intel_thread.lib(ctrsm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_push_num_threads

1>mkl_intel_thread.lib(cgemm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_push_num_threads

1>mkl_intel_thread.lib(cgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_fork_call referenced in function L__mkl_lapack_cgetrf_243__par_region0

1>mkl_intel_thread.lib(cgetrf_ib_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_fork_call

1>mkl_intel_thread.lib(ctrsm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_fork_call

1>mkl_intel_thread.lib(cgemm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_fork_call

1>mkl_intel_thread.lib(cgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_serialized_parallel referenced in function L__mkl_lapack_cgetrf_243__par_region0

1>mkl_intel_thread.lib(cgetrf_ib_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_serialized_parallel

1>mkl_intel_thread.lib(ctrsm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_serialized_parallel

1>mkl_intel_thread.lib(cgemm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_serialized_parallel

1>mkl_intel_thread.lib(cgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_end_serialized_parallel referenced in function L__mkl_lapack_cgetrf_243__par_region0

1>mkl_intel_thread.lib(cgetrf_ib_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_end_serialized_parallel

1>mkl_intel_thread.lib(ctrsm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_end_serialized_parallel

1>mkl_intel_thread.lib(cgemm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_end_serialized_parallel

1>mkl_intel_thread.lib(cgetrf_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_dispatch_fini_4

1>mkl_intel_thread.lib(mkl_threading.obj) : error LNK2019: unresolved external symbol _omp_in_parallel referenced in function _MKL_Get_Max_Threads

1>mkl_intel_thread.lib(mkl_threading.obj) : error LNK2019: unresolved external symbol _omp_get_max_threads referenced in function _MKL_Get_Max_Threads

1>mkl_intel_thread.lib(cgetrf_ib_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_for_static_init_4 referenced in function L__CGETRF_IB_OMP_343__par_loop1

1>mkl_intel_thread.lib(ctrsm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_for_static_init_4

1>mkl_intel_thread.lib(cgemm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_for_static_init_4

1>mkl_intel_thread.lib(cgetrf_ib_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_for_static_fini referenced in function L__CGETRF_IB_OMP_343__par_loop1

1>mkl_intel_thread.lib(ctrsm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_for_static_fini

1>mkl_intel_thread.lib(cgemm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_for_static_fini

1>C:\Documents and Settings\asim masud\My Documents\Visual Studio 2005\Projects\mkl_proj\Debug\mkl_proj.exe : fatal error LNK1120: 17 unresolved externals

1>Build log was saved at "file://c:\Documents and Settings\asim masud\My Documents\Visual Studio 2005\Projects\mkl_proj\mkl_proj\Debug\BuildLog.htm"

1>mkl_proj - 39 error(s), 2 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

0 Kudos
4 Replies
TimP
Black Belt
409 Views

Please consider using the pencil tool for displaying code, reading the instructions for your version of MKL, and telling us which version it is and what your intended options are. The libraries (or scripts) you chose from MKL (depending on the version) imply threaded MKL, for which you must link the OpenMP library. If you use an Intel compiler, the link option -Qopenmp will take care of this. Sequential or serial options are available also, the naming depending on your version.

0 Kudos
Gennady_F_Intel
Moderator
409 Views

I can see that you use MKL 10.1 version,

So Please use the following libraries for linking this test:

Additional dependencies: mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib

More info about Linking Your Application with MKL 10.1, ypu can find into $MKLROOT/doc/userguide.pdf

--Gennady

0 Kudos
asim_masud
Beginner
409 Views

I can see that you use MKL 10.1 version,

So Please use the following libraries for linking this test:

Additional dependencies: mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib

More info about Linking Your Application with MKL 10.1, ypu can find into $MKLROOT/doc/userguide.pdf

--Gennady

Hi

Thanks for help Gennady. My problem is solved bylinking withlibguide.lib. I have successfully inverted complex matrix of size 52x52. I inverted complex matrix for many iterations and observed that at first iteration, it takes much more executiontime and then execution time is reduced(as compared to first iteration)although matrix is different at each iteration.Is this behavior expected?

Best Regards

ASIM

0 Kudos
Gennady_F_Intel
Moderator
409 Views

Hi Asim,

Yes, this is expected behaviour.

The first call of any function (as well as first iteration) has some fixed overhead as MKL needs to initialize the internal structures, threads, check some Environment Variables and etc.

It also connected with warming up the cache.

This overhead is more visible when the kernel of the function is small.

While running the second and further iterations there are no such overhead.

--Gennady

0 Kudos
Reply