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

How to call DSS from an application written in C?

jirina
New Contributor I
1,950 Views

I am trying to call DSS routines from a C code by doing following (a short example using only dss_create):

#include "mkl_dss.h"
#include "mkl_types.h"
#include "mkl.h"

_MKL_DSS_HANDLE_t handle;
int opt = MKL_DSS_DEFAULTS;
int err;

err = dss_create(handle, opt);

In Project Properties, C/C++ - General - Additional Include Directories, I have specified C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2020.1.216\windows\mkl\include.

Building the project produces the linker error "Error LNK2001 unresolved external symbol _dss_create_".

I assume this might have something to do with calling conventions, but I was not able to find out what I am missing and doing wrong. Can anybody point me in the right direction, please?

I am using Visual Studio 2019 Professional 2019, Intel Parallel Studio XE 2020 Update 1, with corresponding MKL, on Windows 10 Pro 10.0.18363.

0 Kudos
1 Solution
Kirill_V_Intel
Employee
1,950 Views

Hello,

It looks like you didn't specify the MKL libraries to link against and the path to the libraries. Please have a look at the "manual" part at https://software.intel.com/content/www/us/en/develop/articles/intel-math-kernel-library-intel-mkl-compiling-and-linking-with-microsoft-visual-cc.html (not exactly VS 2019 but it should work).

Also, please, consider using PARDISO (see https://software.intel.com/content/www/us/en/develop/documentation/mkl-developer-reference-fortran/top/sparse-solver-routines/intel-mkl-pardiso-parallel-direct-sparse-solver-interface.html) instead of DSS. DSS API is just a wrapper around PARDISO and was meant to provide easier interface for the functionality but actually it doesn't in my opinion and can lead to confusion and sub-optimal options being used.

Best,
Kirill 

View solution in original post

0 Kudos
3 Replies
mecej4
Honored Contributor III
1,950 Views

You probably did not specify the linker options needed to pull in the necessary routines from the MKL libraries. If you compile from the command line, the /Qmkl option may suffice. There are corresponding options in the project properties if you are using Visual Studio.

0 Kudos
Kirill_V_Intel
Employee
1,951 Views

Hello,

It looks like you didn't specify the MKL libraries to link against and the path to the libraries. Please have a look at the "manual" part at https://software.intel.com/content/www/us/en/develop/articles/intel-math-kernel-library-intel-mkl-compiling-and-linking-with-microsoft-visual-cc.html (not exactly VS 2019 but it should work).

Also, please, consider using PARDISO (see https://software.intel.com/content/www/us/en/develop/documentation/mkl-developer-reference-fortran/top/sparse-solver-routines/intel-mkl-pardiso-parallel-direct-sparse-solver-interface.html) instead of DSS. DSS API is just a wrapper around PARDISO and was meant to provide easier interface for the functionality but actually it doesn't in my opinion and can lead to confusion and sub-optimal options being used.

Best,
Kirill 

0 Kudos
jirina
New Contributor I
1,950 Views

Thank you, guys, for your suggestions.

I forgot to say my application is not Intel C, but MS C, and I thus do not have Intel Performance Libraries item in the Project Properties.

However, the first link in Kyrill's post contains instructions how to use Intel MKL in MS Visual Studio manually, and following them made things work as expected. I used the MKL Link Line Advisor mentioned in instructions, which was also very helpful.

Thank you!

0 Kudos
Reply