Visual Studio 2019 C++ with OpenMP produces total different results on both debug and release versions

hyperandey 21 Reputation points
2023-04-24T20:09:27.76+00:00

Hello, I got very strange problem with my Visual Studio 2019. We purchased VS 2019 a few year ago. Right now I use it to do a OpenMP programming to improve our legacy finite element analysis VC++ codes. I modified the codes with OpenMP clauses and constructs. I integrated VS with Intel C++ 2023 compiler because I want to use latest OpenMP version from this compiler. I compiled, built and released the exe file. I ran my release version of the program. The results are totally different every time I ran. Also the release version is totally different from debug version. I also built the debug version. The debug version produced the very close results to my original program. But release versions didn't produce accurate results. That is very strange. What happened to the Visual Studio 2019? Attachments are some pictures showing different results from release versions. ReleaseResult1_1

ReleaseResult1_2

ReleaseResult2_1

ReleaseResult2_2

I understood that using OpenMP may cause some shared memory issues during the calculations and computations of matrix and equation, which might cause the different results during different runs. But why my debug version always obtained very stable results but release versions DO NOT. I checked the project setting for both debug and release version. Both settings are the same. Sorry I can not provide detail of the source codes as it may involve some copyright issues. I wonder if you can tell me what approximate reasons can cause this uncertain results from release versions. how to fix or resolve this? Thank you very much.

Developer technologies C++
Developer technologies Visual Studio Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.