Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

another unable to start

Bruce_Weaver
Beginner
2,965 Views

Hi,

We've been having persistent 'unable to start' or can't find errors, even though the executable has been made and is correctly located.  The executable will not run stand alone; I suppose for wrong libraries??  Sometimes things are ok and then they switch back.  When not ok, debug version may run (incorrectly) but not release.  The forum seems to indicate this may be a PATH problem.  I'm using VS 15 & the latest Fortran 2019 update 1.  The software runs correctly on a laptop w/ very little on it.  I cannot seem to install Fortran on community VS 2017.  Don't really care.

Q1: Is there a tool in VS2015 to tell it where to look (like the one in Amplifier?)

Q2:  Here is my PATH; as far as I can tell, it seems benign and current.

Path=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\MSBuild\14.0\bin;C:\Program Files (x86)\MSBuild\14.0\bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\VCPackages;C:\Program Files (x86)\HTML Help Workshop;C:\Program Files (x86)\HTML Help Workshop;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools;C:\Program Files (x86)\Windows Kits\10\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\;C:\Program Files (x86)\Intel\..\..\intel64\libfabric\bin\utils;C:\Program Files (x86)\Intel\..\..\intel64\libfabric\bin;C:\Program Files (x86)\Intel\..\..\intel64\bin\release;C:\Program Files (x86)\Intel\..\..\intel64\bin;C:\Program Files (x86)\IntelSWTools\Advisor 2019\bin32;C:\Program Files (x86)\IntelSWTools\VTune Amplifier 2019\bin32;C:\Program Files (x86)\IntelSWTools\Inspector 2019\bin32;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.1.144\windows\mpi\intel64\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.2.185\windows\mpi\intel64\bin;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.0.124\windows\mpi\intel64\bin;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.4.210\windows\mpi\intel64\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.0.065\windows\mpi\intel64\bin;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.2.187\windows\mpi\intel64\bin;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.109\windows\mpi\intel64\bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64_win\mpirt;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32_win\mpirt;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64_win\compiler;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32_win\compiler;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\SciTools\bin\pc-win64;d:\Program Files (x86)\IDM Computer Solutions\UEStudio;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;D:\Program Files\PuTTY\;C:\Program Files\dotnet\
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

 

The main use of this computer is to compile & run my software in Fortran so I don't mind dumping anything that is causing a problem.

I just spent a week fooling with my code only to discover it is not the problem.  Most appreciative of any help in this regard.  thanks.

0 Kudos
90 Replies
Steve_Lionel
Honored Contributor III
432 Views

That a previously built executable "works" again suggests a coding error revealed by a new compiler with new or different optimizations. Just rearranging the layout of things in memory is enough to reveal or hide such issues.

0 Kudos
Steve_Lionel
Honored Contributor III
432 Views

I agree with gib that you should first see if you can reproduce a problem with a single thread. Intel Inspector XE (30 day free trial available, included in Professional or Cluster editions) has run-time correctness checkers that can point you to possible problems (though with Fortran code I found it also produces a lot of "noise".)

0 Kudos
Bruce_Weaver
Beginner
432 Views

Hi Steve.  I'm not being clear about the base problem.  a two-year old version of the code that has does not have the last two years of advances.  A current version that does have these enhancements.  Only one compiler (2019v1) and VS2015.  Run new version & it gives wrong answer.  close new version.  Open old version that is in its own directory, recompile (no changes) and run. Gives correct answers.  Close old version.  Open new version in its own directory & it gives the correct answer.  Run more and it soon reverts to bad results.  Repeat.

 

0 Kudos
Steve_Lionel
Honored Contributor III
432 Views

Stack and heap randomization. You have out of bounds variable references or other memory errors. Difficult to debug, but the way I would approach it is to selectively disable optimization on some sources until you (one hopes) find the source which, when the settings are changed, triggers the behavior. You may have to run multiple times. Alternatively, instrument the code with writes of intermediate data to a file, but this will perturb the behavior.

0 Kudos
Bruce_Weaver
Beginner
433 Views

yeah, there are writes cropping up like mushrooms (or uncommented as they are being reactivated).  I'm afraid I'll have to learn the VS debugger.  The debug version has optimizations turned off.

0 Kudos
mecej4
Honored Contributor III
433 Views

Bruce Weaver wrote:
... It's about 4000 lines of complicated, mostly OpenMP code, so it is very resistant to being stripped down to a 'reproducible example'.  I've tried to cut it apart but most of the code has tight interdependencies. ...  I understand that w/o a small example program, y'all are very limited in response

A program of that size is big enough to cause trouble, but not too big to discourage debugging. Are you willing to share the source code (complete with include/header files, data files, if any, and directions to reproduce the problem)? Just as parallelization of a calculation can speed up the runs, one can "parallelize" the debugging effort, if your "bug description" enlists many helpers.

Bruce Weaver wrote:
Open new version in its own directory & it gives the correct answer.  Run more and it soon reverts to bad results.  Repeat.

A bug of that nature is very difficult to catch with just a symbolic debugger, for the following reasons:

  • We do not know how many calls to subroutines and how many iterations of loops have to be executed before the bad results begin to happen.
  • Bad results tend to be noticed only when they are bad enough to be noticed. The bug that led to the bad results may have come to life much earlier, in a different subprogram, and may depend on random input (contents of uninitialized memory).
  • It is only after one develops familiarity with the subject matter and only after one acquires expertise on the behavior of the program that one is able to tell "bad" results from "good" results.
0 Kudos
jimdempseyatthecove
Honored Contributor III
433 Views

>> The debug version has optimizations turned off.

That is the default. You should be aware that in the Debug configuration you can specify the optimization level. Remember to disable IPO as this is incompatible with the Debugger (at least through V17.0).

Also, keep in mind that the optimization level can be set on a Project level and/or as well as on a file-by-file basis (Open Solution Explorer and Right-Click on a file of interest, then you can change optimizations for that file only).

When debugging multi-threaded code and a break point is reached (e.g. on an assert you insert into your code), you can (in MS VS) use the Threads window to freeze and unfreeze any/all other threads to aid single stepping (as well as for selecting context).

Jim Dempsey

 

0 Kudos
Bruce_Weaver
Beginner
433 Views

I spent the day trying to work with VS debugger.  Very inconsistent results so I have now reverted to rebuilding the software from the last version that seems to always work -- about two years old.  Adding back in the new code, piece at a time, is pretty slow as I'm documenting & testing each change.  The system still remembers previous issues: I lowered the stack size & the OpenMP dropped to single thread.  I put it back as it was but it still stayed as a single thread.  Going back to earlier versions & then returning reset the OpenMP functionality.  I'm now using RamMap to empty the memory when I need to recover from changes; so far, it seems to be working.  If this solves the persistence problem, I suppose it means that either MS or Intel has some sorta problem with remembering somethings they should not. Yes, I clean the solution before rebuilding but that does not seem to help.

mecej4: I greatly appreciate the offer.  There is nothing secret about the code but there seem to be several problems running around in it & I'm trying to reduce the issues to a few, repeatable problems.  Trying to fix one seems to uncover more gremlins. It is the lack of repeatability that is driving me nuts. I hope to rebuild the code to narrow down the specific issues (other than repeatability).

0 Kudos
mecej4
Honored Contributor III
433 Views

Bruce Weaver wrote:
 ... I'm now using RamMap to empty the memory when I need to recover from changes; so far, it seems to be working.  If this solves the persistence problem, I suppose it means that either MS or Intel has some sorta problem with remembering somethings they should not.

I cannot agree with that tentative conclusion. It is the job of RAM to remember everything until something else is written into it or power is turned off! It is the user program's responsibility to write to any memory before reading that memory (directly in initializations or by assignment, or through a call to a user or a library routine, or by READ).

0 Kudos
gib
New Contributor II
433 Views

From my personal experience, Bruce, every time I thought there was a problem with the compiler it turned out to be my error.  Your problem will almost certainly turn out to be a subtle coding error.  The hardest to track down are Heisenbugs, which change their behaviour when you try to look at them.  These are always a manifestation of memory being accessed by mistake, and usually the cause is remote from the place where the error surfaces.

0 Kudos
Bruce_Weaver
Beginner
433 Views

I like the Heisenbugs name.  It has been decades since I had such a bug but it seems to be just that kind.  The VS debugger was of no use as it bounced me all over the code.  I am currently considering using a NAG compiler, which has a better performance in error checking, to find the problem(s).  The idea is to use two compilers: one for code checking and another for making efficient code (a very big issue for code that takes days to run with 20+ threads).  I worry about how easy it will be to move code between the two compilers. Does anyone have experience with this approach?  or the NAG compiler?

0 Kudos
mecej4
Honored Contributor III
433 Views

Bruce Weaver wrote:
I worry about how easy it will be to move code between the two compilers. Does anyone have experience with this approach?  or the NAG compiler?

That depends on how the code is written. If it is standard Fortran, all that you have to do is to construct two makefiles, no porting of source code necessary. Furthermore, seemingly innocuous changes to the source code can cause the bugs to hide or disappear, particularly so if the bug in question is in the compiler itself.

0 Kudos
gib
New Contributor II
433 Views

I have no experience with the NAG compiler.  You might also consider gfortran, which works well with the Code::Blocks IDE (also free).

0 Kudos
Bruce_Weaver
Beginner
433 Views

Actually gfortran & g95 are not as good as catching errors as Intel Fortran but all about 50%. NAG & Silverfrost ftn95 come in at over 90% in this regard.  See https://www.fortran.uk/fortran-compiler-comparisons/win32-fortran-compiler-comparisons-diagnostic-capabilities/

Intel is particularly bad at detecting uninitialized errors, which this forum thread has already exposed with the test program provided by mecej4: klobber.  Perhaps the Intel developers should address this issue.  I need to use Intel because of the speed, see :

https://www.fortran.uk/fortran-compiler-comparisons/polyhedron-benchmarks-win64-on-intel/

but I sure wish they would make the debug mode much better at error detection.  I've used almost all the the compilers on the Polyhedron site at one time or another & I'm fond of the Intel one (&especially Amplifier) but this error detection issue is a problem.

 

0 Kudos
John_Campbell
New Contributor II
433 Views

If I could summarise what I have read from all these 56 posts:
There are a number of possibilities for the problems (plural) being reported in this thread.
Problems plural appears to be a key theme.

Two main problems being reported appear to be:
1) the program won't start
2) the program gives inconsistent results or crashes (it must have started?)

For Problem 1:
The likely explanation is .exe is using more than 2gb, although isn't this a problem of a 32 bit .exe ?
Or, the stack is made too big. Wouldn't this issue explode with OpenMP, which replicates the stack for each thread.
(I'm not sure of the stack size allotted for other threads in ifort?)
A solution approach can be to change large arrays to allocatable and place them in a module. This addresses both large common arrays and large stack demands.
Note also that all OpenMP private arrays will be replicated, which in some cases can have heavy stack demands. 
An alternative could be to make a large private array into a (larger!) shared allocatable array, with the last subscript being the thread id. (need 64-bit .exe for this)

For Problem 2:
The results are not reproduceable. This is to be expected with OpenMP.
Suggestions are variables are not being initialised, which is more difficult with OpenMP if Firstprivate clause is not correctly used.
There has not been a suggestion of race-condition, which could be a clear possibility.
Also, make sure all routines are threadsafe, with no local static variables that need to be private.

As has been recommended, first try to "get a single thread version running". This looks to be a good start.
The attempt to change all large arrays to allocatable could also help.
Audit all static arrays and variables for possible multi-thread use, including in all libraries and utility routines. Making module arrays private adds to the complexity.
Using a different compiler with better (even different) error checking can help.

0 Kudos
Steve_Lionel
Honored Contributor III
433 Views

The 2GB limit on code, stack and static data also applies to 64-bit.

0 Kudos
mecej4
Honored Contributor III
433 Views

Bruce Weaver wrote:
... Intel is particularly bad at detecting uninitialized errors, ....  Perhaps the Intel developers should address this issue.  I need to use Intel because of the speed ... but I sure wish they would make the debug mode much better at error detection.

It is certainly feasible to use one compiler for finding and fixing bugs, and another for speeding up the fixed program. Many people use more than one compiler, using each for the task that it is good at.

0 Kudos
Bruce_Weaver
Beginner
433 Views

The problem of not finding the .exe files seems to be abated by some of the earlier suggestions.  They are still occurring on my co-worker's machine so I will have to try to duplicate whatever the fix(es) is/are.  The .exe files are only about 0.5MB.  All the large arrays are shared and amount to about 400MB in the test case but I've used as much as 16GB of files (on-disk size, about 5 GB of stored numbers) so I'm not sure how they fit in the 2GB limit.  Steve? I guess that the 2GB limit does not apply to allocatable arrays.

It seems to crash as it is trying to write to disk some of the time.  Restarting the program seems to help it many times. As Steve suggested I've lowered the stack size (initially raised to the limit based on previous discussions on the Forum).  The data arrays are allocated in modules ...does this really help the stack/heap size issue?  I have run as many as 24 threads with large data sets.  There are no significant private arrays.  The results are extremely statistical and are quite duplicatable w/ OpenMP.  I have not checked about threadsafe in a while so I should do that. 

There are only two versions of the answer: one that is correct and one which is very similar but is wrong.  I think the uninitialized variable/array suggestion is the most likely at the moment. 

Another symptom cropped up yesterday. One version, which involves a large array causes OpenMP to drop down to one (or, weirdly, two) threads.  The same exact code employs all the requested threads on the co-worker's computer. I have not had a chance to fully explore that but it gave the wrong version of the answer in the only run we tested.  We were busy beating the code for other of these symptoms that I've been reporting here.  My co-worker is using VS and Intel 2013 as opposed to my updated 2019 and VS 2015.

0 Kudos
Bruce_Weaver
Beginner
488 Views

mecej4:

I've started with NAG compiler testing.  It correctly finds the uninitialized variable of your test program during runtime.

0 Kudos
gib
New Contributor II
488 Views

My old version of IVF (11.072) initialises x(:) to 0 in sub3(s), and therefore produces the intended answer.  gfortran does not initialise x(:) to 0, and therefore produces garbage.  It seems that Intel Fortran once did automatic initialisation, what is the current behaviour?

Neither compiler catches the uninitialised variables at runtime.  Tut tut.

0 Kudos
Bruce_Weaver
Beginner
488 Views

AARRGHHH! Now I've lost the ability to create a debug exe again!   Here is the end of the build log:

SASi2.8a - 0 error(s), 0 warning(s)

compiler:

/nologo /debug:full /Od /QxHost /Qparallel /heap-arrays0 /Qopenmp /warn:interfaces /Qopt-report:5 /Qguide:2 /Qguide-file:"x64\Debug\SASi2.8a.gap" /module:"x64\Debug\\" /object:"x64\Debug\\" /Fd"x64\Debug\vc140.pdb" /traceback /check:all /libs:dll /threads /dbglibs /4Yportlib /Qmkl:parallel /c

linker:

/OUT:"x64\Debug\SASi2.8a.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"x64\Debug\SASi2.8a.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"Q:\SASi\SASi.2.8a\SASi2.8a\SASi2.8a\x64\Debug\SASi2.8a.pdb" /SUBSYSTEM:CONSOLE /STACK:100000000 /IMPLIB:"Q:\SASi\SASi.2.8a\SASi2.8a\SASi2.8a\x64\Debug\SASi2.8a.lib"

But no .exe in x64\Debug\ .  Works ok in release.  It is like the linker is never invoked.  After I build, when I go to execute, says it needs to recompile, then it immediately says it can't find the executable (of course, it doesn't exit in the debug directory).  It seems the linker is not invoked.  Again seems to work in older directories. 

 

0 Kudos
Reply