The outputs of a Fortran program(no openmp pragmas in it) compiled with and without "-openmp" option are not identical to each other. How this is possible? The two executables differ only with the shared objects linked. The executable compiled with "-openmp" is linked additionally "libiomp5.so" file.
SOME DETAILS: The Fortran program uses the REAL value arrays. I was trying to convert this to openmp parallel. But found that, the outputs of both programs (original and the converted one) are not same(100 values out of lacs values were differing). Started debugging, removes the pragmas one by one. Everytime the issue remained same. Finally decided to compile original program with and without -openmp option and found that both outputs are not identical. How this is possible? Can you please tell what could be the issue.
1) if you have a bug in your program which causes incorrect results when local arrays are shifted from default SAVE to dynamic, you must fix that. This would be a suspect if single thread runs don't give the same results. Various other bugs also may be exposed when you change your compile options.
2) data alignments will change with openmp. Setting -fp-model source disables optimizations which are expected to make results change with alignment.
3) if your results change more than expected with varying number of threads, you must look for race conditions such as problems with private/firstprivate/lastprivate declarations.
Your points (1) & (3) are not applicable to my question. I've mentioned precisely that am compiling a fortran non-openmp program with and without -openmp option. There is no openmp pragma, no include of omp.h in it.
The (2) point helped me to fix the problem. The outputs of both executable are identical only when both are compiled with "-fp-model source" option.
The big difference is that -openmp implies -auto, with stack-based allocation for all local variables, not just scalars. If you have uninitialized variables, this can change results.