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

Difference in results obtained using command line and MS Visual Studio 2017 methods of building an IVF project

avinashs
New Contributor I
299 Views

I have a Fortran project that uses an iterative method for solving a nonlinear set of model equations. At each step, the algorithmic steps work towards driving the difference between successive iterates towards zero. Convergence is declared when the relative difference is small enough ex. 1.0E-05.

When running this project with MSVS2017 and IVF 19.0.2.190 [IA-32], the iterative process begins to stagnate after a few iterations and the relative difference does not go below 0.01. However, when running the same project from the IA-32 command line, the successive iterations converge rapidly to a relative error that is below 1.0E-05 to 1.0E-06. Are there any suggestions for what may be causing this discrepancy? I do not want to make algorithmic refinements unless I have to.

The command line compile options (same as those in the MSVS2017 project) are:

/nologo /debug:full /Od /warn:interfaces /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /Qm32 /c 

0 Kudos
5 Replies
Steve_Lionel
Honored Contributor III
299 Views

First, are you certain that you are using the exact same compiler? Take off /nologo and change the option in Visual Studio to show the compiler version. Second, how certain are you that the command options are the same? You can go to the Command line property page in VS and see what the options there are.

A third possibility is that a bug in your program is sensitive to the order in which objects are linked, for example a reference to uninitialized memory. Compiler checks won't always find these.

My usual advice in these situations, once the above issues have been ruled out, is to instrument the program so that it writes intermediate state to a file. Run the program both ways and compare the outputs to see where things start to diverge. This will let you zoom in on the key calculation (hopefully there is just one!) that is responsible for the difference, and that will likely give you a clue as to how to resolve it.

0 Kudos
avinashs
New Contributor I
299 Views

I investigated options1,2,3 and did not find any differences between the settings for the command line vs the IDE. There is only one compiler installed on my computer and only one main program linking to a library. The command line compile option was taken from the IDE. Could the floating point options ex. /fp:precise, /fp:source etc. be an issue although none of these have been explictly changed from the default in the IDE or command line?

0 Kudos
jimdempseyatthecove
Honored Contributor III
299 Views

Check to see if the DLL's used are the same for each environment.

Consider using "Process Explorer".

See: https://support.microsoft.com/en-us/help/970920/using-process-explorer-to-list-dlls-running-under-the-outlook-exe-proc

for an example of using Process Explorer to locate the DLLs as used by the process Outlook.exe.

(you change the instructions to explor YourProgram.exe as it is run in each environment).

Jim Dempsey

0 Kudos
andrew_4619
Honored Contributor II
299 Views

Are the exe files produced the same or different if you do a file compare?

0 Kudos
jimdempseyatthecove
Honored Contributor III
299 Views

Note, the Process Explorer will show the DLLs as used, not as referenced/called.

as used == what actually was loaded via path search
as referenced == name of, but not path to

Jim Dempsey

 

0 Kudos
Reply