I have an issue with OMP which I am recently using so as to incorporate parallel processing in my in house algorithm.
As the title implies I am using Visual Studio 2013 with the latest XE14 Fortran compiler. The language that the software is written in, is Fortran 90.
Given that the number of executable lines is large and also due to the fact that I am new with OMP, I decided to take it step by step and compile the algorithm frequently so as to make sure that the applied changes do not affect the results that derive from the sequential execution of the software, thus solve a benchmark model every time and notice any changes in the results.
Now here is the funy thing about what I experienced so far: I activated the choice within the Project's properties for OMP to generate parallel code (Generate Parallel Code (/Qopenmp)-->Generate Parallel Code) and then added a simple command in order to initialize the threads (which works properly given that I get 4 threads).
!$OMP PARALLEL SHARED (threads)
threads = OMP_GET_NUM_THREADS()
!$OMP END PARALLEL
After compiling the code and running for the bench, the results were not the same while the algorithm was diverging (and when running with Disabled OMP, converting the OMP command to a comment, everything is fine again). I tried to debugging line by line so as to allocate the problem but got nothing. One of the observations that I made was that the initialization values of the newlly allocated varaibles were different from those of the sequntial compilation, but given that I use an initialization procedure (setting all newlly varaibles to zero) this should not be an issue. I was wondering if there is a chance that the OMP option tries to apply parallelization by default to loops or other command blocks (even without the presence of the!$OMP command) and some procedures get messed up.
Before doing anything I experimented a lot with simple loop commands by creating small programs that use !$OMP PARALLEL DO and !$OMP PARALLEL sections commands, whereas all went well. I managed to get all 4 cores working 100% at the same time so I verified that the commands were given in the proper manner. Regarding the above issue though I am running out of ideas.
Any suggestions would be highly appreciated.