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

Command Lines

teclis77
ビギナー
4,120件の閲覧回数
I found some differences from an executable file generated by Visual Fortran and by Compiler Fortran with the same sources files, dll and static libraries.
In the command prompt I simply use

ifort *.f /libs:dll my_dynamic_libraries.lib /link my_static_libraries.lib

but I found some substantial differences...

How can I know which is the complete command lines used by Visual Studio?

Best Regards

Teclis
0 件の賞賛
22 返答(返信)
Les_Neilson
高評価コントリビューター II
3,555件の閲覧回数

If you are usingVS 6 you could look at the .plg file generated by a build.

In theVS 7 IDE you can look at Project -> Properties and under the Fortran option and the Linker option there are Command Line entries. Also you can look at the buildlog.htm file(s) for similar info to the plg files

Les

Steven_L_Intel1
従業員
3,555件の閲覧回数
The project log shows the compile command used. You can also look at the Fortran project properties, Command Line page, and it will show you all the compiler options used.
teclis77
ビギナー
3,555件の閲覧回数
Even if I use the same command lines (copied from the log file, i.e. BuildLog.htm), one to generate obj files and the other to link the obj files, with the same sources files, I found the same differences in my results...

How is it possible?

Teclis
Steven_L_Intel1
従業員
3,555件の閲覧回数
Perhaps you have uninitialized variables? Perhaps you're using a different compiler in the IDE than on the command line?

Add /watch to the command line (you can do this on the command line property page in VS) and compare the path of the compiler being invoked.
Intel_C_Intel
従業員
3,555件の閲覧回数
Hello,
With unitialized variable a given executable can give different numerical results depending on how/when it is being executed. For example execution from DOS-prompt, TextPad or Visual Studio, may give entirely different results, simply because such a program is dependent on arbitrary values in memory that may be different in different execution environments. Or, execution at a later instant may give different results.
Regards,
Lars Petter Endresen
teclis77
ビギナー
3,555件の閲覧回数
Hello,
I verified that from DOS-prompt and Visual Studio the calculation results are different, even if the executable file is the same.
Considering the fact that I am calling some DLL and some Static Libraries, do you think that I have to check the initialization of local variables starting only from the DLL ones? or I have to check all the local variables?

Teclis
Les_Neilson
高評価コントリビューター II
3,555件の閲覧回数

Youwould be wise torecompile and link everything with as many warnings on as possible. Particularly run the programfrom VS indebug mode so that if there are any uninitialised variables (it sounds very much as if that is the problem here) then you can catch and fix them easily and quickly.

You didn't say which version of VS you are using but :

In VS 6 look at Project->Settings->Fortran->Compilation Diagnostics there is a tick box for Uninitialised variables, and some other useful options too.

Also Fortran->Run Time for Array and string bounds plus under/overflows

In VS2003 look at Project->Settings->Fortran->Diagnostics (and Run Time) for the same sort of switches.
Les
teclis77
ビギナー
3,555件の閲覧回数
Hello,
(I have an Intel Fortran 9.0 and Visual Studio .Net 2003)
I found a more specific problem...
If I run the exectuable file in the Visual Fortran Enviroment or in the Command Prompt Enviroment (only cmd.exe) I found the right results; but if I run the executable file in the Fortran compiler - DOS/prompt (/K ""..IntelCompilerFortran9.0IA32BinIFortVars.bat"") I found wrong solutions.

I tried to eliminate each SET line in IFortVars.bat, till I left it blank, but I found always wrong results.

So I delete the "/K" option, and I found right results, but I don't know the meaning of that option and I cannot compile my source files.

Teclis
Steven_L_Intel1
従業員
3,555件の閲覧回数
/K means keep the environment changes when the batch file ends.

My guess is that there's perhaps a PATH issue, with perhaps different DLLs being loaded in the different environments.
teclis77
ビギナー
3,555件の閲覧回数
I check all the ifortvars.bat lines, and I found that my executable program works well when I hide (with a rem) the follow call

@call ".Microsoft Visual Studio .NET 2003Vc7BinVcvars32.bat"

How is it possible? In the Visual Studio enviroment my executable works well, while when I use the same bat-file (Vcvars32.bat) it doesn't work...

Moreover that file has only one command, able to point to another file bat, vsvars32.bat, where there are many sets.

Teclis
Steven_L_Intel1
従業員
3,555件の閲覧回数
It's adding something to PATH so that it is finding a DLL from the command line that it isn't finding in the IDE (or is finding a different one.)

Download Dependency Walker and run it on your program both with and without the call to vcvars32.bat. Note any DLLs that have a different path.
teclis77
ビギナー
3,555件の閲覧回数
Sorry, but I don't understand how Dependency Walker works, i.e. how I can open the exe file in the two different enviroment. I want to say, I open the exe file in Dependency Walker, but I simply open , without any enviroment.

Teclis
Steven_L_Intel1
従業員
3,555件の閲覧回数
From the command line, type:

depends.exe /f:1 path-to-your-exe

In the Module pane, right click and choose Select all. Then right click and Copy File Paths. Paste this to a text file. Repeat the process from a command session that called vcvars32.bat. Compare the files.
teclis77
ビギナー
3,555件の閲覧回数
We don't find any differences using depends.exe (in both enviroments).

But, analyzing the structure of the vsvars32.bat we find that commenting out one (or both) of the two first file rows the program works in the correct way. The two lines are reported in the following:

@SET VSINSTALLDIR=D:ProgrammiMicrosoft Visual Studio .NET 2003Common7IDE
@SET VCINSTALLDIR=D:ProgrammiMicrosoft Visual Studio .NET 2003

Teclis
Steven_L_Intel1
従業員
3,555件の閲覧回数
Are those variables defined if you comment those out?
teclis77
ビギナー
3,555件の閲覧回数
No, both the variables are not set if commented out.

Teclis
Steven_L_Intel1
従業員
3,555件の閲覧回数
I'm left to conclude that there's an uninitialized variable somewhere in your program.
teclis77
ビギナー
3,555件の閲覧回数
How can I check if I have some uninitialized variables?

Teclis
Steven_L_Intel1
従業員
3,555件の閲覧回数
Either debug it or add code that dumps out intermediate values to see where the results start to diverge. That will give you a clue as to where the problem is.
teclis77
ビギナー
3,436件の閲覧回数
If you are sure that I have to initialize all the variables, do you think that this problem come from local variables of the main (or from other *.f files) or from local variables of my dynamical libraries?

Teclis
返信