I have an application that I recently parallelized using OpenMP, and have it working fine with gfortran (with and without optimization, the works). This code has lots of legacy f77 code with SAVE and COMMON blocks, so I needed to use THREADPRIVATE liberally.
It looks like using ifort instead will result in a much faster runtime, but the code when compiled with ifort doesn't run properly. If I change the compiler to back to gfortran, it runs exactly as it should (reproducing the serial results exactly), but for some reason the OpenMP-enabled ifort version doesn't work correctly (the serial results are fine).
The code is way too complex to post here, but does anyone have any suggestions on how to figure this out? Why would the same code work fine with gfortran? I'm not getting a segfault or stack overflow or anything like that, the results just aren't correct—it looks like the threads are interfering with each other somehow, even though this doesn't happen when using gfortran.