Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
280 Views

Problem Assigning Values to Array / Related to OpenMP

Hi Everyone,

I am using Intel Fortran for Windows.

The array dist_x_hist is declared as

integer, parameter :: DOUBLE = SELECTED_REAL_KIND(p=8)
real(KIND=DOUBLE) dist_x_hist(10000,1)

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?

Many thanks,
Rafael

 

0 Kudos
13 Replies
Highlighted
273 Views

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?

Jim Dempsey

0 Kudos
Highlighted
270 Views

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.

0 Kudos
Highlighted
New Contributor II
260 Views

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

0 Kudos
Highlighted
256 Views

Sure, how do I do that?

0 Kudos
Highlighted
253 Views

>>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.

Jim Dempsey

0 Kudos
Highlighted
251 Views

it's a large program, with many modules.

0 Kudos
Highlighted
248 Views

sorry, I read too quickly. I will upload a zip file later today. Thanks!

0 Kudos
Highlighted
240 Views

Hi again,

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.

Many thanks,
Rafael

0 Kudos
Highlighted
New Contributor II
236 Views

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)

0 Kudos
Highlighted
231 Views

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?

Many thanks!

0 Kudos
Highlighted
New Contributor II
213 Views

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.

0 Kudos
Highlighted
New Contributor II
210 Views

I was able to replicate your issue when compiled for 32 bit:

Andrew_Smith_0-1594150172343.png

When compiled for 64 bit i get another and probably related debugger error:

Andrew_Smith_1-1594150436425.png

 

0 Kudos
Highlighted
147 Views

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.

Jim Dempsey

0 Kudos