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

Unresolved external symbol when building for intel 64 system

gregor_seitlinger
985 Views
hi everyone!
i'm trying to build a small programm to evaluate the performance of the BLAS function GEMV on a multi core system, but when i try to build the program i get the following errors:
Error 1 error LNK2019: unresolved external symbol _SGEMV_F95 referenced in function _MAIN__ Parallel_test.obj
Error 1 error LNK2019: unresolved external symbol _SGEMV_F95 referenced in function _MAIN__ Parallel_test.obj
My link line looks like this:
/OUT:"Debug\\Parallel_test.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\\Program Files (x86)\\Intel\\ComposerXE-2011\\mkl\\lib\\intel64" /MANIFEST /MANIFESTFILE:"C:\\Users\\Maria Mair\\Documents\\Visual Studio 2010\\Projects\\Parallel_test\\Parallel_test\\Debug\\Parallel_test.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\\Users\\Maria Mair\\Documents\\Visual Studio 2010\\Projects\\Parallel_test\\Parallel_test\\Debug\\Parallel_test.pdb" /SUBSYSTEM:CONSOLE /STACK:104858000 /IMPLIB:"C:\\Users\\Maria Mair\\Documents\\Visual Studio 2010\\Projects\\Parallel_test\\Parallel_test\\Debug\\Parallel_test.lib" mkl_intel_lp64.lib mkl_intel_thread.lib mkl_blas95_lp64.lib mkl_core.lib
I've included the libraries suggested by the link line advisor and if i change the libraries to the ones needed for a 32-bit system the program builds and runs without a problem but only a single core is used (BLAS level 2 functions are only multi-threaded for intel 64 bit systems?).
Any suggestions what i need to change or add?
0 Kudos
1 Solution
mecej4
Honored Contributor III
985 Views
I see something amiss with the name decoration. With LP64 as the target, the name should be SGEMV_F95 (without a leading underscore). The decoration _SGEMV_F95 is appropriate for IA32 targets. Make sure that the compiler and linker options target the same model (IA32 or LP64).

A similar observation applies to other unsatisfied externals.

View solution in original post

0 Kudos
8 Replies
Gennady_F_Intel
Moderator
985 Views
Ok, could you please clarify, when you addmkl_blas95_lp64.lib, then all linking problems has dissapered, right?
Regarding using only one thread - all?gemv routines are threaded.
what is the size of matrix you are running?

0 Kudos
gregor_seitlinger
985 Views
Unfortunately no. When i try to build with the libraries listed in my link list i get the mentioned errors. Only when i build the identical program for a 32-bit system do I not get any errors.

Regarding the multi-threading of BLAS level 2 functions - the IMKL documentation says:

-Level1 and Level2 BLAS functions:

-Level1 BLAS:*axpy, *copy, *swap, ddot/sdot, drot/srot

-Level2 BLAS:*gemv, *trmv, dsyr/ssyr, dsyr2/ssyr2, dsymv/ssymv

Note that these functions are threaded only for:

-Intel 64 architecture

-Intel Core2 Duo and Intel Core i7 processors

thats why I assumed that GEMV only using one processor when build with the ia32 libraries was normal.

The matrix i'm using is 1000x1000.

0 Kudos
Murat_G_Intel
Employee
985 Views
Hi Gregor,

MKL SGEMV is multithreaded for IA32 architecturs too. For level-2 BLAS, 1000x1000 may not be large enough to see the benefits from parallelism. On my dual-core system, I do not see a speedup for a 1000x1000 matrix neither. However, if I increase my problem size (say 2000x2000), I start seeing the benefits from multi-threading.

Are you using the latest MKL?

Thanks,

Efe
0 Kudos
Murat_G_Intel
Employee
985 Views
As a remark, GEMV is memory bound. You would especially see the benefits of multi-threading on multi-socket systems (again for large problems).
0 Kudos
gregor_seitlinger
985 Views
Thanks for the quick replies.
Right now I'm not as much concerned with the performance increase I can get from the parallelism as with actually getting the program to build.
I think my problem migth have something to do with the libraries and modules needed for the BLAS routines. Last night I tryed to added the function mkl_set_num_threads() to force the use of all four cores of my sytem, which resulted in another error, so now I'm up to this:
Error 1 error LNK2019: unresolved external symbol _SGEMV_F95 referenced in function _MAIN__ Parallel_test.obj
Error 2 error LNK2019: unresolved external symbol _mkl_serv_mkl_set_num_threads referenced in function _MKL_SET_NUM_THREADS mkl_intel_c.lib(_thrd_mkl_set_num_threads_f.obj)
Error 3 fatal error LNK1120: 2 unresolved externals Debug\Parallel_test.exe
My Linker input looks like this:
mkl_blas95_lp64.lib mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib
I'm using Visual Fortran Compiler XE 12.0 Update 4 & Intel Math Kernel Library 10.3 Update 4
0 Kudos
Gennady_F_Intel
Moderator
985 Views
hmm, intersting. I checked on my side - all works fine. Please check would you able to build ..\mkl\examples\blas95 examples for intel64? see the examples of using into makefile.
0 Kudos
mecej4
Honored Contributor III
986 Views
I see something amiss with the name decoration. With LP64 as the target, the name should be SGEMV_F95 (without a leading underscore). The decoration _SGEMV_F95 is appropriate for IA32 targets. Make sure that the compiler and linker options target the same model (IA32 or LP64).

A similar observation applies to other unsatisfied externals.
0 Kudos
gregor_seitlinger
985 Views
Thank you for pointing this out to me! Compiler and linker were targeting different models.
Problem solved, program builds and runs.
Thank you again!!!
0 Kudos
Reply