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

Fortran

Intel_C_Intel
Employee
1,737 Views
Hi Steve:
I was wondering if you cvould give a pointer to where I find a sample of running complex compiles in Fortran using the command line compiler. I keep getting error messages about missing files.
So if a file called a.for and b.for are in a directory called ab below the visual studio project directory and a is the main program how do I compile them in one go?
It may seem simple but it is not at the moment.
John Nichols
0 Kudos
24 Replies
kostastse
Beginner
1,334 Views
Hi John,

I am not sure if that's what you asked, but the simplest you can do is:

ifort a.for b.for

Obviously Fortran's directory must be in the path and you execute the above command while you are in the ab directory.

Kostas
0 Kudos
Steven_L_Intel1
Employee
1,334 Views
John,

I suggest you read the chapter on using command line tools in the Intel Fortran Building Applications manual, part of the on-disk documentation. You can also get a feel for things by viewing the build log when you build a Visual Studio project. Keep in mind that it adds things you might not want, such as putting objects and module files in a subdirectory, but if you cross-reference the displayed command with the descriptions in the compiler options reference, you'll get the idea.
0 Kudos
Intel_C_Intel
Employee
1,334 Views
Steve:
This is starting to come back like a bad dream. I first did this sort of stuff in 1986 using a COMPAQ Portable (the real Compaq Portable with the 100 mm green screen) and Microsoft Fortran 3.03.
Is there any way I can run the command line from inside the IDE?
Since I started to play with IFORT, in the beginning it worked ok. Now I get the error message
link.exe unalbe to locate component
mspdb80.dll
I reinstalled the lot and still get the error - even on the int_sin.f90 program.
Thanks
John
0 Kudos
Steven_L_Intel1
Employee
1,334 Views
John,

Are you trying to use Intel Fortran with Visual Studio 2005? What is the exact version of Intel Fortran you have? (From the command line, type "ifort -V" and look for a "Package ID" of the form w_fc_x.x.xxx)

If you are using a supported combination of Intel Fortran and Visual Studio, you need to make sure that the command environment is set up properly. The best way to do that is to use Start..Programs..Intel Software Development Tools..Intel Fortran Compiler 9.0..Build Environment for IA-32 Applications.
0 Kudos
Intel_C_Intel
Employee
1,334 Views
Steve:
I am using the W_FC_C_9.0.030 package and the latest MS VS 2005. I tried running the batch files and that did not help. I went inside the batch files, took out the path listings and corrected the path commands manually. This stepgot the IFORT to run. It started the Incremental Linker 8.00.50727.42 to compile the INT_SIN program.
But can I not run the IFORT from within the MS VS - I can not see how to do it, and I have been through the manual - last night. Whatever I tried just dinna work.
Also can I call a FORTRAN DLL from a C# program? Where would I find instructions on how to do this call?
John Nichols
0 Kudos
Intel_C_Intel
Employee
1,334 Views

Steve:

I also meant to say thank you for the help, you must get sick of answering the same questions week after week.

Do you ever go home and sleep?

John

0 Kudos
Steven_L_Intel1
Employee
1,334 Views
No, you cannot run Intel Fortran 9.0 from within the VS2005 IDE - that combination is not yet supported. Support will come in our new version due out in May. You will have to build from the command line and use the Intel Debugger (idb) if you want to debug.

The build environment should have worked. What is the contents of ifortvars.bat and show me the output of an attempt to link.
0 Kudos
Intel_C_Intel
Employee
1,334 Views
@echo off
Rem Intel Visual Fortran Compiler Build Environment for 32-bit applications
echo.
echo Intel Visual Fortran Compiler 9.0.030 Build Environment for 32-bit applications
echo Copyright (C) 1985-2006 Intel Corporation. All rights reserved.
echo.
@call "C:Program FilesMicrosoft Visual Studio 8VCBinVcvars32.bat"
title Intel Visual Fortran Compiler 9.0.030 Build Environment for 32-bit applications
echo.
SET IFORT_COMPILER90=C:Program FilesIntelCompilerFortran9.0
SET INTEL_SHARED=C:Program FilesCommon FilesIntelShared Files
SET INTEL_LICENSE_FILE=C:Program FilesCommon FilesIntelLicenses
SET PATH=%IFORT_COMPILER90%Ia32Bin;%INTEL_SHARED%Ia32Bin;%PATH%
SET LIB=%IFORT_COMPILER90%Ia32Lib;%LIB%
SET INCLUDE=%IFORT_COMPILER90%Ia32Include;%INCLUDE%
if exist "C:Program FilesIntelCompilerFortran9.0ia32Binimsl.bat" call "C:Program FilesIntelCompilerFortran9.0ia32Binimsl.bat"
John Nichols
0 Kudos
Intel_C_Intel
Employee
1,334 Views
C:Program FilesSQLXML 4.0in;%IFORT_COMPILER90%IA32Lib;C:Program FilesMicrosoft Visual Studio 8VCATLMFCLIB;C:Program FilesMicrosoft Visual Studio 8VCLIB;C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlib;C:Program FilesMicrosoft Visual Studio 8SDKv2.0lib;
This is the contents of the library variable - I added everything after the first line and a bit
John Nichols
0 Kudos
Intel_C_Intel
Employee
1,334 Views
%SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;c:Program FilesMicrosoft SQL Server90Toolsinn;C:Program FilesMicrosoft SQL Server80ToolsBinn;C:Program FilesMicrosoft SQL Server90DTSBinn;C:Program FilesCommon FilesAutodesk Shared;C:Program FilesATI TechnologiesATI Control Panel;%IFORT_COMPILER90%IA32Bin;%IDB_PATH%IDB9.0IA32Script;C:Program FilesMicrosoft Visual Studio 8Common7IDE;C:Program FilesMicrosoft Visual Studio 8VCBIN;C:Program FilesMicrosoft Visual Studio 8Common7Tools;C:Program FilesMicrosoft Visual Studio 8Common7Toolsin;C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKin;C:Program FilesMicrosoft Visual Studio 8SDKv2.0in;C:WINDOWSMicrosoft.NETFrameworkv2.0.50727;C:Program FilesMicrosoft Visual Studio 8VCVCPackages;
path command - I added everything after SCRIPT
0 Kudos
Intel_C_Intel
Employee
1,334 Views
link.exe unalbe to locate component
mspdb80.dll
I fixed the pather command and it found the dll
0 Kudos
Intel_C_Intel
Employee
1,334 Views

Of course all I really did was hit it on the head with a hammer and it worked.

Reminds me of the old days with Fortran MS 3.03 and the old Compaq Portable with a 100 mm green screen and 2 360 k floppy drives. Did you know you can run fortran and the programs in 720 k.

One can run the IFORT inside the MS IDE - but only as a tool or macro - cludgy but it works.

JMN

0 Kudos
Steven_L_Intel1
Employee
1,334 Views
Ok, what is the build output showing the error?
0 Kudos
Steven_L_Intel1
Employee
1,334 Views
Ok, glad to hear it. I'm puzzled that it did not work by default for you.
0 Kudos
Intel_C_Intel
Employee
1,334 Views

How should it have run?

And how do I call a Fortran subroutine from a C# program? Or is that not in your area?

JMN

0 Kudos
Steven_L_Intel1
Employee
1,334 Views
link.exe references mspdb80.dll which should be found in C:Program FilesMicrosoft Visual Studio 8Common7IDE This is included with VS2005 Express Edition. That folder is on the PATH you showed, and it should have been defined when you opened the "Build Environment" command window.

To call Fortran from C# requires that you create a DLL and add code to call an "unmanaged" DLL. I've attached an example that does it.
0 Kudos
Intel_C_Intel
Employee
1,334 Views

Steve:

Excellent service. Thanks a lot.

If I knew who your boss was I would send the boss a note and say you were worth more money. Perhaps you could pass this along.

And now I am away to my daughter's baptism. She is one and cute. Not into Fortran yet but her life is young.

John Nichols

0 Kudos
Steven_L_Intel1
Employee
1,334 Views
Thanks for the kind words.

I expect your daughter will be into Fortran before the next Fortran standard gets approved...
0 Kudos
Intel_C_Intel
Employee
1,334 Views

Steve:

She will be dead and buried by then.

I just remembered by Brother in Law works for Intel.

How did Microsoft - Digital - Compaq Fortran end up at Intel?

How do I create a library file?
JMN
0 Kudos
Steven_L_Intel1
Employee
1,238 Views
You can create a Static Library project or, from the command line, use the "lib" tool as described in the Building Applications manual.

Here's my version of our history which I posted to the CVF migration forum (now closed), with some added words.

In 1997, Digital Equipment Corporation (DEC) released Digital Visual Fortran 5.0, popularly known as DVF. DVF was created by the DEC Fortran engineering team, based on their existing DEC Fortran 90 compiler for OpenVMS* and DEC OSF/1 (later Tru64 UNIX) Alpha processor-based systems. DEC had licensed the Developer Studio IDE from Microsoft, and Microsoft cooperated with DEC to ensure that DVF was compatible with Microsoft Fortran PowerStation. Microsoft, which felt it could no longer do justice to the Fortran market, withdrew their product and was happy to have DEC welcome current PowerStation users.

DVF rapidly grew to be the best-selling Fortran compiler on the Windows platform. In 1999, Compaq purchased DEC, and the product was renamed Compaq Visual Fortran (CVF).

Meanwhile, Intel had developed a Fortran compiler of their own, known as Intel Fortran Compiler (IFC), which had met with some success. IFC was also available on Linux and supported the Intel Itanium processor as well as the latest IA-32 processors.

In August 2001, Compaq and Intel forged a deal which resulted in the Compaq Fortran engineering team (and many other compiler engineers) being hired by Intel. Intel acquired the rights to the CVF compiler sources and the right to use the Visual Fortran name. The plan was to merge the best of the Compaq and Intel technologies to produce an industry-leading set of compilers, to be called Intel Visual Fortran on Windows, and Intel Fortran Compiler on Linux. The last release of Compaq Visual Fortran was 6.6 in October 2001, with bug-fix updates ending in January 2004.

The initial release of Intel Visual Fortran, version 8.0, came out in September 2003, followed by version 8.1 in September 2004. Intel Visual Fortran combines the part of CVF that understands the Fortran language, with Intel code generation and optimization technology. The product contains other cross-pollinated features such as the Intel Debugger (a command line and GUI debugger derived from Compaq debugging technology), Intel automatic parallelization and vectorization technology, Intel OpenMP technology, and much more.

In the years since, the Intel Fortran team has continued to refine and expand the product, adding features, improving performance and fixing bugs. Intel Fortran will soon expand onto the Intel-based Apple Mac systems, raising to seven the number of platforms served by the Intel Fortran compiler family.

(A bit of humor - if you look in the Intel Fortran Language Reference chapter on directives, it will say that "DEC" in !DEC$ stands for "Directive Enhanced Compilation". But we know what it really means...)
0 Kudos
Reply