Re: compiling with cmake and xlf



In article <1k92jbg.1bib5ld169fgaoN%nospam@xxxxxxxxxxxxx>,
nospam@xxxxxxxxxxxxx (Richard Maine) wrote:

<ken.fairfield@xxxxxxxxx> wrote:

Being unfamiliar with the xlf compiler, I'd
think you could look up the flag needed to
indicate fixed-form source and add that flag
to the others you already have, for that
source file only.

As has been said here over and over again,
F77 is (almost) a proper subset of F90 and
successors, it's only the treatment of the
source form that the compiler needs to know.
The question is whether xlf invokes a separate
executable for that case or not. It would
seem inefficient to me, but what do I know?

My (somewhat weak) understanding of xlf is that it does the opposite.
Although it might look to the user as though there are separate f77 and
f90 compiler executables because they are separate names, it turns out
that they are just links to the same executable, which sets some default
options differently depending what name it was invoked as.

Xlf handles the determination of fixed vs free source form differently
from many other compilers, but it certainly can be done. My memory of
the details is hazy enough that I couldn't give sufficiently accurate
directions for someone to get by without consulting the manual (or
another user) anyway.

I used xlf on MacOSX for several years, but it has been a while so
this info may be out of date.

Also, I don't know anything about CMake, but I did use standard make
and I used these options for fixed and free source:

FIXEDFORMAT_FLAG=-qfixed -qsuffix=f=f:cpp=F
FREEFORMAT_FLAG=-qsuffix=f=f90:cpp=F90

This more or less made xlf work the same way as everyone else's
fortran compilers regarding source file names. I also used the
following flags for both source formats:

FFLAGS=-O -qextname -qmaxmem=-1

I forger what maxmem did, but I think it was something specific to
addressing modes for the PPC hardware.

I do remember wrestling with extname in various ways. The problem
was that for some unfathomable reason, IBM chose *NOT* to add a
trailing underscore to external names by fortran, even though they
used underscores in the fortran libraries. This means that fortran
libraries are continually in conflict with various other C and POSIX
libraries (e.g. call exit(1) did not work correctly without this
option). So the programmer had to either change the source (e.g.
call exit_(1)) or use this option to avoid the problem. I chose the
latter approach. The extname option forces the trailing underscore.
Most of the fortran libraries had both external names, but not all
of them. For example, their math library, which includes BLAS and
LAPACK, did not have every symbol both ways. So the programmer also
needed a long list of rename options in the loader to get things to
match up. Over time, most of these got fixed, but it took several
years. Then about the time IBM got this right, they decided to stop
supporting their PPC hardware on the Mac, and after a couple of
MacOSX updates, their old software quit working. At the time, the
whole thing seemed like a comedy of errors, they just couldn't get
out of their own way and write nice clean software.

All of this was five or six years ago, so things might have changed
since then. Hopefully for the better.

$.02 -Ron Shepard
.



Relevant Pages

  • Re: xlf90 link problem on OS X
    ... > with a mix of FORTRAN and C modules. ... I can't find these symbols listed anywhere in the xlf ... That includes any libraries that your code might ... If you have code compiled with multiple Fortran compilers, ...
    (comp.lang.fortran)
  • Re: How do I make a library file with XLF?
    ... I am new to making library files and have only done it with lahey ... recently purchased and so am using IBM's XLF. ... code and libraries I have developed using Lahey Fortran but have not ...
    (comp.lang.fortran)
  • Re: [patch] mmap() MAP_TEXT implementation (to use for shared libraries)
    ... The libraries are mapped by mmapin dynamic ... In Solaris, MAP_TEXT flag ... The rtld patch looks easy, ... Setting +x on shared libraries can be done. ...
    (freebsd-current)
  • Re: C vs. Fortran (half OT questions)
    ... I still need the power of C in system programming though. ... An example of this is the ATLAS BLAS ... fortran is probably the more natural language for things ... This was not always the case for numerical libraries, ...
    (comp.lang.fortran)
  • Re: [patch] mmap() MAP_TEXT implementation (to use for shared libraries)
    ... The libraries are mapped by mmapin dynamic ... In Solaris, MAP_TEXT flag ... and in case that underlying object is a vnode, ... The rtld patch looks easy, ...
    (freebsd-current)