Controlling FPU behavior in an OpenMP program?

Posted by STingRaySC on Stack Overflow See other posts from Stack Overflow or by STingRaySC
Published on 2010-02-08T18:38:13Z Indexed on 2010/03/26 3:43 UTC
Read the original article Hit count: 643

I have a large C++ program that modifies the FPU control word (using _controlfp()). It unmasks some FPU exceptions and installs a SEHTranslator to produce typed C++ exceptions. I am using VC++ 9.0.

I would like to use OpenMP (v.2.0) to parallelize some of our computational loops. I've already successfully applied it to one, but the numerical results are slightly different (though I understand it could also be due to calculations being performed in a different order). I'm assuming this is because the FPU state is thread-specific. Is there some way to have the OpenMP threads inherit that state from the master thread? Or is there some way to specify using OpenMP that new threads execute a particular function that sets up the correct state? What is the idiomatic way to deal with this situation?

© Stack Overflow or respective owner

Related posts about c++

Related posts about openmp