I am using Intel Fortran for Windows.
The array dist_x_hist is declared as
integer, parameter :: DOUBLE = SELECTED_REAL_KIND(p=8)
I then have a simple assignment statement:
dist_x_hist = 999
After this simple assignment line, dist_x_hist just displays garbage.
This happens when I compile using Qopenmp.
However, if I compile with Qopenmp_stubs, all works well.
Note that the assignment above occurs before any openmp parallelization.
Any suggestions of what I should be looking into?
Ar you examining the array from outside or inside a parallel region (declared in scope of the array declaration)?
Which version of Intel Visual Fortran?
Which version of Microsoft Visual Studio?
Thank you Jim.
I am using version 15.8.5 of Microsoft Visual Studio Professional 2017 and Intel Parallel Studio XE 2019 Update 5 Composer Edition for Windows.
The array is examined outside of a parallel region.
Can you upload a complete code to replicate it. It might reveal more since what you posted would surely have caused others grief by now if that was all that was involved
>>Sure, how do I do that?
Place the content of your program in the clipboard, then reply to this thread and on the Body Toolbar us the </> button which pops-up an additional edit box for you to Paste you code into. An alternative is below the main Body edit box is a dashed line box labeled Drag and drop here or browse files to attach.
When the file is relatively short, use the </> button as it is easier to comment on code seen as opposed to code unseen.
I am attaching the codes. The Visual Studio and Intel Fortran versions are specified earlier in this thread.
I noticed the problem in file InnerLoop_MOD.f90, in Debug mode.
Line 206: dist_w_hist = 999.0 -- dist_w_hist is not being assigned that value
Line 312: dist_x_hist = 999 -- dist_x_hist is not being assigned that value
This problem only happens if I debug with Qopenmp. With Qopenmp_stubs it works fine.
Here is the Fortran command line:
/nologo /debug:full /Od /heap-arrays0 /Qopenmp /warn:all /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc150.pdb" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /Qmkl:sequential /c
For the linker:
/OUT:"Debug\Project_Transition_Bonds.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"Debug\Project_Transition_Bonds.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\rd699\Dropbox\TradeDeficitsLabor\Fortran\Project_Transition_Bonds\Project_Transition_Bonds\Debug\Project_Transition_Bonds.pdb" /SUBSYSTEM:CONSOLE /STACK:10000000 /IMPLIB:"C:\Users\rd699\Dropbox\TradeDeficitsLabor\Fortran\Project_Transition_Bonds\Project_Transition_Bonds\Debug\Project_Transition_Bonds.lib"
Let me know if you can reproduce the problem.
I was hoping for a cut down piece of code. But if we are to compile the whole thing, we will need the file with module SteadyStateEQ_MOD.
If the debugger shows unexpected values like this, I would always double check its not misleeding us. Print to the console.
print *, dist_w_hist (:4,1)
My apologies, I included one additional fortran file that did not belong to the project. I am uploading the right set of files now -- I double checked it compiles well (please put the csv files and remaining folders in the same folder as the executable) before running the code. The program takes a few seconds to get to the point I mentioned.
Interestingly, I did what you suggested and printed the array to screen. It does print correctly. What should I conclude from this?
Unfortunately, issues with the Intel debugger displaying wrong contents of variables one day and correct the next have been around over many versions. But I have not seen it happen in a simple array like this before, only in arrays declared as derived type components.
It would be good to submist a support requiest for this issue.
One thing that (speculatively) could be a problem is that dist_w_hist(maxiter_w,1), with maxiter_w being a parameter, is that the compiler may have elided (removed) the need for an array descriptor, and therefore the Debugger has no array descriptor to use.
As an experiment, make the arrays dist_w_vec and dist_w_hist allocatable (place with w_tilde(:,:,:), ...) and allocate/deallocate with the other allocatables.