This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fine tuning gcc build to machine specific properties


Hi Ted,

Ted Byers wrote:
> In short, the GNUmake file provided by AMD for their
> acml assumes lg2c, and make dies part way through
> complaining it couldn't find it when I'm using gcc
> 4.2.1 (where before it worked fine with gcc 3.4.4 on
> Cygwin), and removing ;lg2c results in unresolved
> externals.
>   
The g2c library is the run-time library of g77, which was the Fortran 77
compiler shipping with GCC 3.4.x.

gfortran, the Fortran (77/90/90/[2003]) compiler of GCC 4.x has its own
run-time library called (lib)gfortran.

You could try to use gfortran (possibly with the -ff2c option; cf. also
below) with ACML and the library g2c of gcc 3.4.x, but it is likely that
not everything works then.

Besides this experimental option, I think you have only the following
three options under Windows:

a) Using g77 with ACML

b) Use gfortran with another FFT/LAPACK/BLAS library, e.g. the one of
netlib.org [for my programs the difference in run time was about 2% only]
Or use ATLAS or gotoBLAS.

c) Send an email to AMD and ask them to provide you an ACML compiled
with a Windows' gfortran; I general I found them pretty responsive.
http://developer.amd.com/acml.jsp

> I don't do a lot of fortran programming, because I
> find I can generally make my C++ code outperform my
> fortran code by using C++ template metaprogramming
> (this comes at the cost of compile times - compiles
> take longer but this cost is generally worth it). 
> Anyway, I would like to retain the ability to compare
> my fortran code with my C++ code.
>   
If you only want to call the ACML routines from C or C++, you could
simply link the g77 library (of GCC 3.x.x) to your program.

Note. however, that g77 has by default a bit strange way of passing the
arguments (= -ff2c which is default in g77). I don't know the options
AMD used to compiled ACML with g77.  With -ff2c the following applies
(note: default GNU calling conventions = default gfortran = -fno-f2c in
g77):

"The calling conventions used by g77 (originally implemented in f2c)
require functions that return type default |REAL| to actually return the
C type |double|, and functions that return type |COMPLEX| to return the
values via an extra argument in the calling sequence that points to
where to store the return value. Under the default GNU calling
conventions, such functions simply return their results as they would in
GNU Câdefault |REAL| functions return the C type |float|, and |COMPLEX|
functions return the GNU C type |complex|. Additionally, this option
implies the -fsecond-underscore option, unless -fno-second-underscore is
explicitly requested."

(From http://gcc.gnu.org/onlinedocs/gfortran/Code-Gen-Options.html ;
g77's manual should have some more information)


Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]