Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
21 Views

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

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
Highlighted
21 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