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

Segmentation Fault in poisson solver (d_commit_helmholtz_2d)

zudol0104
Novice
1,023 Views

Hi I am a new user to oneMKL.
I am trying to solve a 2-dimensional Poisson Equation with oneMKL's Fast Poisson Solver. I am using C++ to test the Example (MKLRoot/examples/f/pdepoisson) in the library.

It works fine until d_init_helmholtz_2d(), then I get a Segmentation fault in d_commit_helmholtz_2d(). I've attached the code below, please let me know what the issue is.

 

size_t total_size=(nx+1) * (ny+1);

double* f = new double[total_size];

double* bd_ax = new double[ny+1];

double* bd_bx = new double[ny+1];

double* bd_ay = new double[nx+1];

double* bd_by = new double[nx+1];

DFTI_DESCRIPTOR_HANDLE xhandle;

MKL_INT* ipar = new MKL_INT[128];

double* dpar = new double[5*(nx/2)+7];

MKL_INT stat

d_commit_helmholtz_2d(f, bd_ax, bd_bx, bd_ay, bd_by, &xhandle, ipar, dpar, &stat);

 

 

0 Kudos
1 Solution
mecej4
Honored Contributor III
959 Views

Mixing portions of different version of MKL can lead to problems.

Rather than relying on Cmake to ascertain the version of MKL that is actually being used, you may add a call to mkl_get_version_string in your code, and print out the string that is returned. There is a related routine, mkl_get_version, which allows you to retrieve a collection of integers that make up the version number.

View solution in original post

0 Kudos
5 Replies
mecej4
Honored Contributor III
998 Views

I built the example using the source file d_Helmholtz_2D_c.c in the MKL distribution and ran the resulting EXE (LP64 version) on Windows 11. The program ran normally and produced the expected output; I used the current versions of the Intel C compiler (icl, icx) and MKL in OneAPI 2023.2.0.

I found it confusing to see you saying that you used the example source file in MKLRoot/examples/f/pdepoisson. That would be a Fortran version, whereas the lines of code that you showed are in C++.

Please state whether you changed the source file in question in any way, and state how you built and ran the program.

0 Kudos
zudol0104
Novice
975 Views

Thank you for your quick response.
I tested it with the C code inside the oneMKL Package (sorry for the typo /f -> /c).
The MKL version is either 2022.2.1 or 2023.2.0. I used cmake's find_package and it found 2 versions, I'm not sure which one I used as I don't have much knowledge of cmake, but I saw the following message.

Found MKL: /oneapi/mkl/2022.2.1/lib/intel64/libmkl_intel_ilp64.so
Found MKL: /oneapi/mkl/2022.2.1/lib/intel64/libmkl_core.so
Found MKL: /oneapi/mkl/2022.2.1/lib/intel64/libmkl_intel_thread.so
Found MKL: /oneapi/compiler/2023.2.0/linux/compiler/lib/intel64_lin/libiomp5.so

 

The Build System State is as follows

OS= "Red Hat Enterprise Linux Server", Version="7.6 (Maipo)".

C Compiler = /oneAPI/compiler/2021.2.0/linux/bin/intel64/icc
CXX compiler = C Compiler = /oneAPI/compiler/2021.2.0/linux/bin/intel64/icpc

 

Could this be due to different versions of the compiler and mkl?
I'll try to test it by setting the two versions to be the same.

0 Kudos
mecej4
Honored Contributor III
960 Views

Mixing portions of different version of MKL can lead to problems.

Rather than relying on Cmake to ascertain the version of MKL that is actually being used, you may add a call to mkl_get_version_string in your code, and print out the string that is returned. There is a related routine, mkl_get_version, which allows you to retrieve a collection of integers that make up the version number.

0 Kudos
zudol0104
Novice
939 Views

Mixing MKL versions seems to be the problem.
I added the following syntax to "CMakeLists.txt" to ensure that I use the same version when building d_Helmholtz_2D_c.c.

set(MKL_ROOT /my/dir/oneapi/mkl/latest)
list(APPEND CMAKE_MODULE_PATH "MKL_ROOT/lib/cmake")

VarshaS_Intel
Moderator
910 Views

Hi,


Thanks for posting in Intel Communities.


>>Mixing MKL versions seems to be the problem.

 It’s great to know that the issue has been resolved, in case you run into any other issues please feel free to create a new thread.


Have a Good Day!


Thanks & Regards,

Varsha


0 Kudos
Reply