Subject: CCL:"ETIME" command in LINUX (f77)

From: "Igor - 9597" <[email-masked]>
Date: Mon, 12 Dec 1994 16:11:33 GMT+2

I have installed LINUX on my pentium in order to run some 
molecular dinamics writen in FORTRAN for unix. When I tryed to 
compile the programs I have found that it uses external function 
ETIME ( for cpu run time) but on LINUX that function doesnt seem to 
exist. 
         During my investigation of a problem I have found up that 
LINUX doesnt realy have a f77 compiler. All it has is F77 script that 
uses f2c translator to compile F-programs. After searching some ftp 
sites I have come up with an f77.c file BUT in that ftp site there 
were no proper headers to compile it ( I mean  .h files) so it turned 
out to be useless. 
     I would be very gratefull if any of you could help me with one 
of the following problems: 
   1. What is LINUX'es external function for reading the CPU time in 
fortran ( i.e. ETIME)
    2. Where could I find an f77.c together with all needed headers 
to compile it on LINUX.
    
thank you in advance Igor Derzy.

---

From: Lorenzo Pueyo <[email-masked]>
Date: Mon, 12 Dec 1994 16:27:50 +0100

Here you have a routine etime.c that compiles with no problem on a Linux
box and can be called from any fortran program.

On the other hand, I have been developing programs on Linux and porting
them effortless to Convex (and nearly effortless to HP's) for the last year.
The standard route is to use the f77 shell script directly available in the
Slackware distribution of Linux. F77 uses f2c in a transparent way to
translate your f77 code to c, and then it uses the gcc compiler. The process
is quite fast and clean. The only problem with this method is that using
the gdb debugger is cumbersome.

   Best regards,
                    Victor Lua~na

>>>>>>>>>>>>>>>>>>> etime.c <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
/*
    etime implementation, by Kevin Dowd, 'High Performance Computing',
    (O'Reilly, Sebastopol, CA, 1993)
*/
#include <sys/times.h>
#define INTERVAL 60
float etime_ (tarray)
struct { float user; float system; } *tarray;
{
 struct tms local;
 times (&local);
 tarray->user   = (float) local.tms_utime/INTERVAL;
 tarray->system = (float) local.tms_stime/INTERVAL;
 return (tarray->user + tarray->system);
}

+--------------------------------------------+  +---^---/    /
!               Victor Lua~na                !  |   ~       / Just in case
! Departamento de Quimica Fisica y Analitica !  |           | you don't
! Universidad de Oviedo, 33006-Oviedo, Spain ! <            / remember
!  e-mail: [email-masked]   !  |          /  where Oviedo
!          phone: (34)-8-5103523             !  |____  ___/   is  ;-)
!           fax: (34)-8-5103480              !       \/
+--------------------------------------------+

---

From: [email-masked] (Frits Daalmans)
Date: Mon, 12 Dec 94 17:19:14 GMT

(This reply does not seem to bear any direct importance to computational 
chemistry, but may be useful for people wanting to compile comp.chem. 
programs in Fortran under Linux.)

Fortran compilers under Linux that I know of:
- You can use the tandem:
 fortran code  ---------------> (unreadable) C code  -------------> executable
                f2c translator                        gcc compiler
This is the only workable option at this time, AFAIK.
Both f2c and gcc are obtainable from all main Linux ftp sites, and included
in packages like the Slackware distribution.
Although this route may seem cumbersome, *it works*. f2c comes with a
small shellscript called f77 what does exactly what you'd expect 
(i.e. you don't see the intermediate C code any more).

- Or, buy the NAGWare f90 compiler from the Numerical Algorithms Group;
this one has been announced in the NetNews group comp.os.linux.announce
recently (begin November?); I take the freedom to spread this information 
further. The advert said that more information can be obtained by mailing
their informationdesk, [email-masked].

- Or, wait for, or better still help with, the development of the 
Gnu g77 compiler. I don't know very much about it, except that it
is not yet stable. Information can be gotten by using finger:
finger [email-masked]

Concerning the need for some system functions that your Fortran program
expects the Linux f2c library (libf2c.a or libF77.a, libI77.a) to have:
If you can't find any Fortran timing routines, you can tinker around with
C library functions. Those are in chapter 3 of the (online) manual.
If I had time to try some compiles at home, I'd be able to give you
more information :-(. I only have a general idea of some workarounds
right now. Sorry.

Hopefully this information is sufficiently useful to enough Computational 
Chemists to justify posting it here.
Good luck with it,

Frits Daalmans

Disclaimer: all opinions stated here are mine and not necessarily those of
my employer(s). 

Frits Daalmans
OIO Conformational Analysis
Gorlaeus Laboratoria
Leiden, The Netherlands
E-mail: [email-masked]
Tel: [+31] (0)71-274505