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

gcc's thread sanitizer reports a race condition in Intel MKL Pardiso

MBDyn-User
Beginner
2,925 Views

Dear Intel MKL developers,

I'm using Intel MKL Pardiso as a parallel direct linear solver for the multibody dynamics software MBDyn (https://public.gitlab.polimi.it/DAER/mbdyn). Pardiso provides significant performance improvements compared to all other solvers currently used with MBDyn. Unfortunately this solver suffers from stability issues which are not observed with Umfpack for example. If MBDyn is compiled with gcc's -fsanitize=thread, several warnings about race conditions in Pardiso are reported. Those warnings do not appear if Pardiso is used in single thread mode (e.g. if only one OpenMP thread is used). Since only a single thread in MBDyn is calling pardiso, I suppose that the race condition is caused by Pardiso itself.

Below you can find further information, how Pardiso is used by MBDyn:

The following links show the code which provides the interface between MBDyn and Pardiso:

https://public.gitlab.polimi.it/DAER/mbdyn/-/blob/develop/libraries/libmbwrap/pardisowrap.h

https://public.gitlab.polimi.it/DAER/mbdyn/-/blob/develop/libraries/libmbwrap/pardisowrap.cc

 

In order to build MBDyn on a Linux system (e.g. Ubuntu 20.04) with support for Pardiso use the following steps:

tar -jxvf mbdyn-pardiso.tar.bz2

./mbdyn-pardiso.sh

 

Then you should get a message like below. If you need further information, please let me know!

==================
WARNING: ThreadSanitizer: data race (pid=257811)
Write of size 8 at 0x7b4000010000 by main thread:
#0 free ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:707 (libtsan.so.0+0x35f25)
#1 mkl_serv_free_buffers <null> (libmkl_core.so+0x200334)

Previous write of size 8 at 0x7b4000010000 by thread T6:
#0 malloc ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:651 (libtsan.so.0+0x30323)
#1 mm_account_ptr_by_tid..0 <null> (libmkl_core.so+0x1fe133)

Thread T6 (tid=257818, running) created by main thread at:
#0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:962 (libtsan.so.0+0x5ea79)
#1 <null> <null> (libgomp.so.1+0x1adea)
#2 PardisoSolutionManager<SpGradientSparseMatrixHandler, int>::Solve() mbdyn/libraries/libmbwrap/pardisowrap.cc:270 (mbdyn+0x11bfd04)
#3 LineSearchFull::Solve(NonlinearProblem const*, Solver*, int, double const&, int&, double&, double const&, double&) mbdyn/mbdyn/base/linesearch.cc:707 (mbdyn+0x76281c)
#4 DerivativeSolver::Advance(Solver*, double, double, StepIntegrator::StepChange, std::deque<MyVectorHandler*, std::allocator<MyVectorHandler*> >&, std::deque<MyVectorHandler*, std::allocator<MyVectorHandler*> >&, MyVectorHandler*, MyVectorHandler*, int&, double&, double&) mbdyn/mbdyn/base/stepsol.cc:310 (mbdyn+0x59786a)
#5 Solver::Prepare() mbdyn/mbdyn/base/solver.cc:839 (mbdyn+0x58a8bd)
#6 Solver::Run() mbdyn/mbdyn/base/solver.cc:1632 (mbdyn+0x56fab0)
#7 RunMBDyn mbdyn/mbdyn/mbdyn.cc:1498 (mbdyn+0x50c137)
#8 mbdyn_program mbdyn/mbdyn/mbdyn.cc:942 (mbdyn+0x50c137)
#9 main mbdyn/mbdyn/mbdyn.cc:1168 (mbdyn+0x4ec45b)

SUMMARY: ThreadSanitizer: data race (/lib/x86_64-linux-gnu/libmkl_core.so+0x200334) in mkl_serv_free_buffers
==================
ThreadSanitizer: reported 1 warnings

0 Kudos
1 Solution
Khang_N_Intel
Employee
1,867 Views

Hi Reinhard,


I am glad that Pardiso is stable and , just like you mentioned, those issues might problably be false positive due to the fact that gcc doesn't like the code compiled by other compilers.


Anyway, I am going to close this thread. Should you discover other issues relating to oneMKL, please do not hesitate to let us know.


This thread will no longer be monitored.


Best regards,

Khang


View solution in original post

0 Kudos
21 Replies
Khang_N_Intel
Employee
1,868 Views

Hi Reinhard,


I am glad that Pardiso is stable and , just like you mentioned, those issues might problably be false positive due to the fact that gcc doesn't like the code compiled by other compilers.


Anyway, I am going to close this thread. Should you discover other issues relating to oneMKL, please do not hesitate to let us know.


This thread will no longer be monitored.


Best regards,

Khang


0 Kudos
Reply