Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28446 Discussions

Threaded C++ (std::thread) w/ Fortran .so -reentrancy threaded

jimdempseyatthecove
Honored Contributor III
274 Views

This is an FYI

I have a C++ application that is threaded with std::threads. It calls an IVF .so library generated with -reentrancy threaded.

This is V16.0.3 on KNL host

Silly me, I assumed that the -reentrancy threaded option on IVF would instruct the compiler to link in the threaded CRTL heap manager... it does not.

My solution was to specify to generate OpenMP parallel code -openmp.

Jim Dempsey

0 Kudos
1 Reply
Steven_L_Intel1
Employee
274 Views

The options you want are -threads (to specify linking to a library that is thread-safe AND -reentrancy threaded. This is what -openmp gives you implicitly. -reentrancy controls a setting at program startup as to whether the RTL should protect its own data structures against multithread operations. The defaults vary and are changing for 17 (to be thread-safe by default).

0 Kudos
Reply