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

[spBLAS] problem on defining MPI_INT as long int

liang__xin
Beginner
542 Views

Hello,

I am new to Intel and I face a strange problem on defining MPI_INT as long int.

Problem: I add

#define MKL_INT long int

at the very beginning of the provided example <mklroot>/examples/examples_core_c.tgz/spblasc/source/sparse_trsv.c, and the output data for mkl_sparse_d_trsv is [1.0, 5.0, 3.0, 4.0, -13.0], which is incorrect, while no issue is raised when compling.

If I don't add that #define sentence, everything is fine and the output data is the correct answer [1.0, 7.0, 1.0, 6.0, -55.0].

The working environment:

  • Ubuntu 18.04.1 with x86_64 GNU/Linux kenel 4.18.0-25-generic
  • Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications with Processor optimization: Intel(R) AVX2 enabled processors
  • gcc-4.9.3 (Ubuntu 4.9.3-13ubuntu2)
  • compiling command: gcc    sparse_trsv.c    -lmkl_rt     -I<mklroot>/include     -L<mklroot>/lib/intel64     -Wall
  • CPU if helpful:  Intel® Core™ i7-8700

Any advice or solution is welcome.

0 Kudos
1 Solution
Kirill_V_Intel
Employee
542 Views

Hello Liangxi,

MKL has different interface libraries: lp64 and ilp64 version, which use different definition of MKL_INT (see mkl_types.h). You cannot redefine MKL_INT in your code to a binary incompatible type.

Please, refer to https://software.intel.com/en-us/articles/a-new-linking-model-single-dynamic-library-mkl_rt-since-intel-mkl-103if you want use long integers and the single dynamic library (mkl_rt). There you can read how to set the interface library which will be used (either through an environment variable MKL_INTERFACE_LAYER or via mkl_set_interface_layer(MKL_INTERFACE_ILP64).

Best,
Kirill

 

View solution in original post

0 Kudos
3 Replies
Ruqiu_C_Intel
Moderator
542 Views
Hello Liangxi, Have you refer to our linking guide below for your application? For example try use libmkl_intel_ilp64 instead of libmkl_intel_lp64. https://software.intel.com/en-us/mkl-linux-developer-guide-linking-on-intel-64-architecture-systems BRs, Ruqiu
0 Kudos
Kirill_V_Intel
Employee
543 Views

Hello Liangxi,

MKL has different interface libraries: lp64 and ilp64 version, which use different definition of MKL_INT (see mkl_types.h). You cannot redefine MKL_INT in your code to a binary incompatible type.

Please, refer to https://software.intel.com/en-us/articles/a-new-linking-model-single-dynamic-library-mkl_rt-since-intel-mkl-103if you want use long integers and the single dynamic library (mkl_rt). There you can read how to set the interface library which will be used (either through an environment variable MKL_INTERFACE_LAYER or via mkl_set_interface_layer(MKL_INTERFACE_ILP64).

Best,
Kirill

 

0 Kudos
liang__xin
Beginner
542 Views

Hello Kirill,

thank you for your answer. At this time everything goes well.

 

Best,

Xin

Voronin, Kirill (Intel) wrote:

Hello Liangxi,

MKL has different interface libraries: lp64 and ilp64 version, which use different definition of MKL_INT (see mkl_types.h). You cannot redefine MKL_INT in your code to a binary incompatible type.

Please, refer to https://software.intel.com/en-us/articles/a-new-linking-model-single-dyn... you want use long integers and the single dynamic library (mkl_rt). There you can read how to set the interface library which will be used (either through an environment variable MKL_INTERFACE_LAYER or via mkl_set_interface_layer(MKL_INTERFACE_ILP64).

Best,
Kirill

 

0 Kudos
Reply