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

DSS linking problem

xpisani
Beginner
1,298 Views
Im trying to compile and link a program that uses the direct sparse solver.
The compiler switches Im using are:
icc -O3 -fno-alias -tpp2 -mcpu=itanium2 -IPF_fma -openmp -D_USE_MKL_ -D_USE_SPARSE_ -LI/opt/intel/mkl/8.0.1/include /opt/intel/mkl/8.0.1/lib/64 -lmkl -lmkl_solver -lmkl_lapack -lguide -lpthread pruebadss.cpp
It compiles,but when linking these errors come:
/tmp/iccAnGUr6.o(.text+0x13d2): In function `main':
: undefined reference to `dss_create_'
/tmp/iccAnGUr6.o(.text+0x1822): In function `main':
: undefined reference to `dss_define_structure_'
/tmp/iccAnGUr6.o(.text+0x1852): In function `main':
: undefined reference to `dss_reorder_'
I've tried using the full path to the libraries (just in case), but it didn't work either.
Can anyone help me ?
Thank`s in advance.
Ximena.
0 Kudos
9 Replies
TimP
Honored Contributor III
1,298 Views
Wouldn't you normally designate the include file path by -I ?
As you are using icc -openmp, -lguide and -lpthread should be taken care of, and it is preferable to do as you mentioned, simply give the full path names of the MKL libraries you want linked. That will avoid guesswork about whether libguide comes from MKL or icc. The newer of the two is generally preferable.
But here is your most likely problem:
Using linux, you must put the files in the order in which search is required. Your command searches the MKL libraries before the dependenencies from your .cpp are seen, and you search the dynamic libmkl before you have set any dependencies from your application or the other (static) mkl libraries. It should be OK to mix static and dynamic MKL libraries, if that's what you want, and you do it in order.
0 Kudos
xpisani
Beginner
1,298 Views
Thank you Tim.
I tried ordering the libraries in almost every possible way, but icc still can't find the routines I listed. I also tried using all static libraries, except libmkl_solver, for wich I don't have a shared library (I'm using MKL 8.0.1, is this ok? could this be the problem?).
What else can I try? Any ideas?
0 Kudos
p4top
Beginner
1,298 Views
Yes, you should try to link with mkl_solver.lib.I find them in mkl_solver.lib.
If you use C codes, these functions should be upper case.
For examples:
DSS_CREATE
DSS_DEFINE_STRUCTURE
DSS_FACTOR_COMPLEX
DSS_SOLVE_REAL
...................

dss_creat_ is wrong.
0 Kudos
p4top
Beginner
1,298 Views
In mkl_solver.lib, they are maped into _DSS_CREATE, _DSS_DEFINE_STRUCTURE, _DSS_REORDER.

You should define them as C call.

extern "C" DSS_CREATE ....

Then compiler will generate _DSS_CREATE.

If you use fortran, please review the manual of fortran and define the name of funtion correctly.
0 Kudos
p4top
Beginner
1,298 Views
Sorry, I don't notice that you are under linux, not win32. It maybe differ.
I only know that they exist in mkl_solver.
0 Kudos
p4top
Beginner
1,298 Views
int void *




You can try the below C call definition for dss_create, dss_define_structure and dss_reorder functions, and link with mkl_sovler.

#undef DSS_CREATE
#undef DSS_DEFINE_STRUCTURE
#undef DSS_REORDER
extern "C" int DSS_CREATE(void *handle, int const *);
extern "C" int DSS_DEFINE_STRUCTURE(void *handle, int *opt, int *rowIndex, int *nRows, int *rCols, int *columns, int *nNonZeros);
extern "C" int DSS_REORDER(void *handle, int const *, int const *);
d
If compiler reports errors, you can delete #include "mkl_dss.h" firstly and try again with following codes.

typedef void * _MKL_DSS_HANDLE_t;
typedef char _CHARACTER_t;
typedef char _CHARACTER_STR_t;
typedef int _INTEGER_t;
#if !defined( _WIN64 )
typedef long _LONG_t;
#else
typedef long long _LONG_t;
#endif
typedef float _REAL_t;
typedef double _DOUBLE_PRECISION_t;
#define _DoubleComplexType struct { double r, i; }
typedef _DoubleComplexType _DOUBLE_COMPLEX_t;

/*
** MKL_DSS_DEFAULTS
*/

#define MKL_DSS_DEFAULTS 0

/*
** Message level option definitions
*/

#define MKL_DSS_MSG_LVL_SUCCESS -2147483647
#define MKL_DSS_MSG_LVL_DEBUG -2147483646
#define MKL_DSS_MSG_LVL_INFO -2147483645
#define MKL_DSS_MSG_LVL_WARNING -2147483644
#define MKL_DSS_MSG_LVL_ERROR -2147483643
#define MKL_DSS_MSG_LVL_FATAL -2147483642

/*
** Termination level option definitions
*/

#define MKL_DSS_TERM_LVL_SUCCESS 1073741832
#define MKL_DSS_TERM_LVL_DEBUG 1073741840
#define MKL_DSS_TERM_LVL_INFO 1073741848
#define MKL_DSS_TERM_LVL_WARNING 1073741856
#define MKL_DSS_TERM_LVL_ERROR 1073741864
#define MKL_DSS_TERM_LVL_FATAL 1073741872

/*
** Structure option definitions
*/

#define MKL_DSS_SYMMETRIC 536870976
#define MKL_DSS_SYMMETRIC_STRUCTURE 536871040
#define MKL_DSS_NON_SYMMETRIC 536871104

/*
** Reordering option definitions
*/

#define MKL_DSS_AUTO_ORDER 268435520
#define MKL_DSS_MY_ORDER 268435584
#define MKL_DSS_OPTION1_ORDER 268435648

/*
** Factorization option definitions
*/

#define MKL_DSS_POSITIVE_DEFINITE 134217792
#define MKL_DSS_INDEFINITE 134217856
#define MKL_DSS_HERMITIAN_POSITIVE_DEFINITE 134217920
#define MKL_DSS_HERMITIAN_INDEFINITE 134217984

/*
** Return status values
*/

#define MKL_DSS_SUCCESS 0
#define MKL_DSS_ZERO_PIVOT -1
#define MKL_DSS_OUT_OF_MEMORY -2
#define MKL_DSS_FAILURE -3
#define MKL_DSS_ROW_ERR -4
#define MKL_DSS_COL_ERR -5
#define MKL_DSS_TOO_FEW_VALUES -6
#define MKL_DSS_TOO_MANY_VALUES -7
#define MKL_DSS_NOT_SQUARE -8
#define MKL_DSS_STATE_ERR -9
#define MKL_DSS_INVALID_OPTION -10
#define MKL_DSS_OPTION_CONFLICT -11
#define MKL_DSS_MSG_LVL_ERR -12
#define MKL_DSS_TERM_LVL_ERR -13
#define MKL_DSS_STRUCTURE_ERR -14
#define MKL_DSS_REORDER_ERR -15
#define MKL_DSS_VALUES_ERR -16
#define MKL_DSS_STATISTICS_INVALID_MATRIX -17
#define MKL_DSS_STATISTICS_INVALID_STATE -18
#define MKL_DSS_STATISTICS_INVALID_STRING -19
0 Kudos
xpisani
Beginner
1,298 Views
@p4top:
Yes I'm under Linux, but I also tried under Windows. The funny thing is I'm not
having any kind of trouble linking in Windows. Even though I use dss_create() instead of what you said. The header takes care of that. Thanks for your help
anyway.
0 Kudos
p4top
Beginner
1,298 Views
I know that gnu cc maybe map dss_create_ into _dss_create_.
Maybe libmkl_solver use _dss_create_ instead of dss_create_?
Why do you not open libmkl_solver and find it? Let's see what is the final symbol?
0 Kudos
davidj
Beginner
1,298 Views
Hi there,

Unfortunately, I don't have an answer to this problem...however, as it's been a while since you posted this, I thought I'd ask if you found the solution yet, as I find myself in the exact same place as you!

Any help you could provide would be appreciated.
0 Kudos
Reply