Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Compiling from the command line

Bob_Fratantonio
Beginner
1,205 Views
Hello,
I am trying to compile at the command line. I am using multiple files that contain modules. I followed the instructions in the documentation and it compiles without error. But the program doesn't run correctly. Is there something I am missing? I have six files, CONSTANTS.F90, TYPES.F90, READOWI.F90, FPART.F90, MINIM.F90, JFIT.F90, and FWAVES.F90. FWAVES is the main program that calls the others.

CONSTANTS.F90 is a module that declares global data and is used in all of the other modules.
TYPES.F90 is a module that declares a data structure for use in READOWI
READOWI.F90 is a module that uses CONSTANTS and TYPES and is called by FWAVES
FPART is a module that uses CONSTANTS and is called by FWAVES
MINIM is a module that uses CONSTANTS and is called by JFIT
JFIT is a module that uses CONSTANTS and MINIM and is called by FWAVES
FWAVES is the main program uses all of the modules.

So these are the commands I use to compile.
ifort /c CONSTANTS.F90
ifort /c TYPES.F90
ifort /c READOWI.F90
ifort /c FPART.F90
ifort /c MINIM.F90
ifort /c JFIT.F90
ifort /c FWAVES.F90
ifort /exe:FWAVES_2 FWAVES.obj CONSTANTS.obj TYPES.obj READOWI.obj FPART.obj MINIM.obj JFIT.obj

This compiles an executable named FWAVES_2.exe. When I run it, all of the data out of READOWI is fine except for the data in the structure defined in TYPES.

Any thoughts? I tried rearranging the order the statements above with no success.

-Bob



0 Kudos
7 Replies
Steven_L_Intel1
Employee
1,205 Views
Your problem, whatever it is, is not related to compilation order. What is wrong with TYPES?
0 Kudos
Bob_Fratantonio
Beginner
1,205 Views
Steve,
When I compile or debug with Microsoft Visual Studio, the program runs fine.

-Bob
0 Kudos
Steven_L_Intel1
Employee
1,205 Views
You have not described what goes wrong. Does it work from Visual Studio in a Release configuration? That's closer to what you have on the command line.
0 Kudos
Bob_Fratantonio
Beginner
1,205 Views
I am not sure what the difference is between the Release and Debug Configurations, but when I run in the release configuration it acts the same way as with the command line compile. Im not exactly sure what is going wrong. The program gets to a do loop and never ends, but it doesn't produce an error and doesn't make any iterations. The first line in the do loop assigns a variable to one of the components of the data structure from TYPES. The output should be a real number but it is NAN.

-Bob


0 Kudos
Steven_L_Intel1
Employee
1,205 Views
Optimizations are enabled in a Release configuration. This sometimes has the effect of revealing coding errors that did not show in a Debug configuration. What does the DO loop look like?

One thing you can try is, in the Debug configuration, set the optimization level higher (try level 1 first, then 2) and see if the problem reproduces. Then try dropping the optimization level on individual files back to 0 - you do that by right clicking on the file and selecting Properties to change the properties for that file only. This may identify the one source where the behavior depends on optimization level.

With luck, you'll be able to run the program through the debugger and perhaps see where the problem lies.
0 Kudos
Bob_Fratantonio
Beginner
1,205 Views
So now the program runs in the release configuration, even with optimizations set to Maximum Speed plus Higher Level Optimizations. Not sure if this is helpful, but the execuable when compiled with microsoft visual studio is 1.2 MB while the executable from the command line is only 680 KB.
0 Kudos
Steven_L_Intel1
Employee
1,205 Views
You should verify that the options used are the same between VS and command line - they won't be by default.
0 Kudos
Reply