Operating System - OpenVMS
1752478 Members
5689 Online
108788 Solutions
New Discussion

Re: Architecture specific code in Fortran

 
SOLVED
Go to solution
Tom Wade_1
Occasional Advisor

Architecture specific code in Fortran

Hello,

 

I've been experimenting with Fortran code that needs to run slightly differently on Alpha, VAX and IA64.  I've looked at compiler directives such as IF DEFINED.  The following works on Alpha (thanks for responses on comp.os.vms):

 

CDEC$ If Defined (Alpha)

     code compiled only on Alpha

CDEC$EndIf

 

The manual shows how to define and test variables like Alpha above, but curiously doesn't list the variables that are predefined (such as Alpha).  On a VAX and IA64 the above code segment is not compiled.  I am told  (VAX) should also work (if the compiler is recent enough) for that machine but I can't test it as my VAX has decided not to boot any more. :-(

 

My real question is what variable should I use for the Itanium.  I've tried IA64, I64, IA_64, ITANIUM & INTEGRITY but they are ignored.  Anyone know what the correct compiler variable is for that architecture ?

 

Many thanks

Tom Wade

 

 

3 REPLIES 3
John Gillings
Honored Contributor

Re: Architecture specific code in Fortran

Tom,

 

   The Fortran documentation available on the web seems to be WAY out of date. There's nothing in the "HP Fortran for OpenVMS User Manual" about the /DEFINEcompiler qualifier (where I'd expect the defaults to be documented), or about the CDEC$ IF directives.

 

  The release notes for HP Fortran Version 8.2 have this hint:

 

3 New and Changed Features in Previous Releases
  3.1 New and Changed Features in V8.1 ECO 01....... 31
  3.2 New and Changed Features in V8.1.............. 33
  3.2.1 IA64 and _IA64_ Predefines Implemented...... 33

which might mean the strings you seek are "IA64" or "_IA64_" - there's no extra information in the body of the document. As far as I can tell this is the only use of the term "Predefines" anywhere, so I'm just guessing that it refers to predefined compiler symbols.

 

Please lob a few cases at Customer Support, requesting they pull their fingers out and update the documentation (for that matter ALL OpenVMS documentation!)

A crucible of informative mistakes
Craig A Berry
Honored Contributor

Re: Architecture specific code in Fortran

John's inference seems to be right based on the experiment I posted in c.o.v in response to the same question there:

 

https://groups.google.com/forum/#!topic/comp.os.vms/b31qB6Mvrcs

Fekko Stubbe
Valued Contributor
Solution

Re: Architecture specific code in Fortran

The tag is IA64. Below is a program that demonstrates this. Be aware that on VAX you only have the F77 compiler, so the CDEC$ DEFINED does not work there. I have done a lot of work on a "make" tool that is architecture aware (for example to create the freeware tool DIX).

program t

cdec$ if defined (ALPHA)

write(*,*) "on alpha'

cdec$ endif

cdec$ if define (IA64)

write(*,*) 'On IA64'

cdec$ end

On alpha (version f95 8.2) this results in 'On alpha' , on integrity (version 8.2), this prints 'on ia64'

Fekko