- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your problem, whatever it is, is not related to compilation order. What is wrong with TYPES?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
When I compile or debug with Microsoft Visual Studio, the program runs fine.
-Bob
When I compile or debug with Microsoft Visual Studio, the program runs fine.
-Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
-Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should verify that the options used are the same between VS and command line - they won't be by default.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page