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

Printing Constant from mkl library

Roger_X_
Beginner
1,232 Views

Hi. 

I am trying to compile the following program (test.c) to find value of a constant in the mkl 10.0.4.023.

#include<stdio.h>
#include "mkl.h"
main()
{
	int a = SPARSE_INDEX_BASE_ZERO;
	printf("%d", a);

}

with the following commands:

source compilervars.sh intel64

icc test.c -DMKL_ILP64 -I${MKLROOT}/include  -L${MKLROOT}/lib/mic -lmkl_intel_ilp64 -lmkl_core -l    mkl_sequential -lpthread -lm -ldl

The message that I get is:

 

-bash: MKLROOT: command not found
-bash: MKLROOT: command not found
find_constant.c(7): error: identifier "SPARSE_INDEX_BASE_ZERO" is undefined
      int a = SPARSE_INDEX_BASE_ZERO;
              ^

compilation aborted for find_constant.c (code 2)

Is the program that I write correct?

If not, how to find out the value of the constants used in mkl?

 

Thank you.

 

0 Kudos
2 Replies
Gennady_F_Intel
Moderator
1,232 Views

These constants are defined into header files. Pls have a look at the mkl_spblas.h as an example. How to check this value? You may find out the example - sparse_spmm.c. 

0 Kudos
Roger_X_
Beginner
1,232 Views

I found out that my mkl version was too old. After installing a newer mkl, that program compiled. Thanks for the help.

0 Kudos
Reply