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

Merry Christmas E1 -- Help me find dgesv

french__john
Beginner
1,098 Views

I am trying to run this example:

Main Link >>

https://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mkl_lapack_examples/

Example Path >>

Linear Equations > ?gesv > dgesv Example > Example Program in C

Windows 10 & VS 2017 C++. Just updated the Community version. Chose "parallel" option in Properties >> "Intel Performance Library"

The Compilation Error >>

1>MKL Test 3 - Main.obj : error LNK2019: unresolved external symbol "void __cdecl dgesv(int *,int *,double *,int *,int *,double *,int *,int *)" (?dgesv@@YAXPAH0PAN00100@Z) referenced in function _main

I have searched the IntelSWTools to no avail. The closest I got was dgesv.f90 in this directory >

C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.1.156\windows\mkl\interfaces\lapack95\source

In another library (ALGLIB) using splines ... inclusion of 13 .cpp files into the project from that library worked. But within the MKL I find no such .cpp files; although MKL might be calling Fortran versions? However it is done ... I am striking out. Have spent many hours over several days trying all kinds of suggested linking techniques. I dare not dream of using the high end optimization aspects of the MKL until I can at least get a basic example working. I also need the polynomial form (with coefficients) for data curve fitting. (The ALGLIB Barrymetric format is too awkward. I need to calculate derivatives along the fitted curve and polynomials are what I understand.)

Thanks for your help!

** Merry Christmas **

 

0 Kudos
1 Solution
Ying_H_Intel
Employee
1,098 Views

Hi John, 

Hope you had Merry Chrismas.

Sorry for hear this. The compiler error seems related to the C code and C++ code.(*.cpp). you may change 

the cpp file to c file, and rebuild

 or add mkl.h head files. 

#include <stdlib.h>
#include <stdio.h>
#include <mkl.h>
/* SGESV prototype */
//extern void sgesv(int* n, int* nrhs, float* a, int* lda, int* ipiv,
// float* b, int* ldb, int* info);
 
I upload one solution. with manual setting :  for example , link mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib  and library path , include file path manually. You will see them in project configuration.
 
Best Regards,
Ying 

View solution in original post

0 Kudos
4 Replies
Gennady_F_Intel
Moderator
1,098 Views

one of the reason of this problem may be integration to MVSC 2017.

You may try manually link your application with mkl follow by this KB article recipe, i hope this help.

thanks, Gennady

0 Kudos
french__john
Beginner
1,098 Views

Thank you Gennady.

I followed the KB article the best I could.

Errors from first compilation of exact example >>

1>MKL Test 5.cpp
1>g:\jtfre\visual studio 2017\mkl test 5\mkl test 5\mkl test 5.cpp(142): error C2664: 'void print_matrix(char *,int,int,double *,int)': cannot convert argument 1 from 'const char [9]' to 'char *'
1>g:\jtfre\visual studio 2017\mkl test 5\mkl test 5\mkl test 5.cpp(142): note: Conversion from string literal loses const qualifier (see /Zc:strictStrings)
1>g:\jtfre\visual studio 2017\mkl test 5\mkl test 5\mkl test 5.cpp(144): error C2664: 'void print_matrix(char *,int,int,double *,int)': cannot convert argument 1 from 'const char [28]' to 'char *'
1>g:\jtfre\visual studio 2017\mkl test 5\mkl test 5\mkl test 5.cpp(144): note: Conversion from string literal loses const qualifier (see /Zc:strictStrings)
1>g:\jtfre\visual studio 2017\mkl test 5\mkl test 5\mkl test 5.cpp(146): error C2664: 'void print_int_vector(char *,int,int *)': cannot convert argument 1 from 'const char [14]' to 'char *'
1>g:\jtfre\visual studio 2017\mkl test 5\mkl test 5\mkl test 5.cpp(146): note: Conversion from string literal loses const qualifier (see /Zc:strictStrings)
1>Done building project "MKL Test 5.vcxproj" -- FAILED.
 
I modified the function prototypes by adding "const" as follows and the above errors appear resolved; however, the previous error has returned (see below.)
 
//*original*/   extern void print_matrix( char* desc, int m, int n, double* a, int lda );
//*original*/   extern void print_int_vector( char* desc, int n, int* a );
 
/*fixed*/   extern void print_matrix( const char* desc, int m, int n, double* a, int lda );
/*fixed*/   extern void print_int_vector( const char* desc, int n, int* a );
 
After above modification ... Same missing dgesv error >>
 
1>MKL Test 5.cpp
1>MKL Test 5.obj : error LNK2019: unresolved external symbol "void __cdecl dgesv(int *,int *,double *,int *,int *,double *,int *,int *)" (?dgesv@@YAXPAH0PAN00100@Z) referenced in function _main
1>G:\jtfre\Visual Studio 2017\MKL Test 5\Debug\MKL Test 5.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "MKL Test 5.vcxproj" -- FAILED.
 
When I view the directories in project settings ... the "evaluated value" reflects the recommended paths even when the manual input field is blank.
 
The Link Advisor for guessed at values give this compiler setting >>  -I"%MKLROOT%"\include
 
Where within the Configuration Properties does one find "compiler setting" so that I can add the above setting?
 
To avoid the novice "guessing" ... would be wonderful if the basic examples provided the values to input into the link advisor with some explanation.
 
Seems providing a working solution to the examples would be beneficial?
 
One tutorial suggested up and running in 20 minutes ... I have been struggling with this for days!
 
All help appreciated !!
 
 
 
 
0 Kudos
Ying_H_Intel
Employee
1,099 Views

Hi John, 

Hope you had Merry Chrismas.

Sorry for hear this. The compiler error seems related to the C code and C++ code.(*.cpp). you may change 

the cpp file to c file, and rebuild

 or add mkl.h head files. 

#include <stdlib.h>
#include <stdio.h>
#include <mkl.h>
/* SGESV prototype */
//extern void sgesv(int* n, int* nrhs, float* a, int* lda, int* ipiv,
// float* b, int* ldb, int* info);
 
I upload one solution. with manual setting :  for example , link mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib  and library path , include file path manually. You will see them in project configuration.
 
Best Regards,
Ying 
0 Kudos
french__john
Beginner
1,098 Views

Ying, H --

*Thank You*

Some events kept me away a few days ... so my apologies for the slow reply.

The solution you provided works perfectly!

I will study the "manual" linking you used and I can now progress to learn more about the MKL. :)

A picture is worth a thousand words ... a "fully" working solution eliminates a thousand paths a novice might take when reading through documentation written by experts and who aim to cover every possible variation.

Again, my thanks!

 

0 Kudos
Reply