CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Main CFD Forum

HELP!LINUX g77

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 26, 1999, 03:09
Default HELP!LINUX g77
  #1
nuray kayakol
Guest
 
Posts: n/a
I have a ridiculous problem during compiling my code using g77 instead of digital fortran compiler. how can i define all variables as double precision (real(8)) from command line ? (It is not easy to define all variables one by one as double ) Because of this problem all intrinsic functions dmin1, dsin etc cause problems? Regards nuray

  Reply With Quote

Old   November 27, 1999, 07:49
Default Re: HELP!LINUX g77
  #2
Jonas Larsson
Guest
 
Posts: n/a
I'm not that familiar with g77, sorry. We decided to use Absoft Fortran for Linux instead and we are quite happy with it - didn't have much difficulties to port our F77 codes to it and it gives quite good performance on our in-house CFD code.
  Reply With Quote

Old   November 27, 1999, 08:20
Default Re: HELP!LINUX g77
  #3
andy
Guest
 
Posts: n/a
I have had a quick look and cannot see how either but some suggestions. Firstly, look at the gcc options -fshort-double "Use the same size for double as for float". Bit ambiguous since it could achive this by making floats doubles or vice-versa but it may do what you want. Secondly, use the generic function names sin(), cos(), etc... and not the old Fortran 66 specific names. This would sidestep the problem. Thirdly, use another compiler (e.g. Portland Group for general Linux or DEC(Compaq?) on alpha chips). Although useful and much appreciated g77 is something of an odd Fortran compiler evolving from the earlier f2c approach. It is certainly not a traditional optimising Fortran compiler (not sure it is meant to be either but cannot really speak on behalf of the developers). If you are still having problems you could drop the developers a message (http://world.std.com/~burley/g77.html). I am sure they would welcome the input.
  Reply With Quote

Old   November 27, 1999, 08:51
Default Re: HELP!LINUX g77 - PS
  #4
andy
Guest
 
Posts: n/a
Under wanted features on the g77 web pages:

"Full compatibility with regard to f2c. Now that run-time bounds checking is complete, we believe this means supporting AUTOMATIC and providing an equivalent to -r8."

That probably means you are beaten.
  Reply With Quote

Old   November 29, 1999, 03:56
Default Re: HELP!LINUX g77
  #5
nuray kayakol
Guest
 
Posts: n/a
Andy thank you for your interest. Generic functions cause another problems. the use of dcos(), dsin() causes compiler errors because the arguments should also defined as double.

besides,

do i=1,n a(i)=0.0 enddo

can be written as a=0 ! this is an array operation

in fortran 90

gcc option -ff90 is available but I have still the same compiler error

There are many compiler options in GNU fortran but it does not work.

Nuray
  Reply With Quote

Old   November 29, 1999, 04:23
Default Re: HELP!LINUX g77
  #6
Juin Kim
Guest
 
Posts: n/a
Hi..

I am not sure that this would be helpful for you, but it is my way of solving similar problems as you have.

First, put the following at very first line of your code

implicit real*8 (a-h,o-z)

After that all your variables(scalar and arrary) are real*8. You just put dimension aa(*,*) for array definition. No need to do real*8 aa(*,*).

Second, pass real*8 variables into intrinsic arguements. I mean all the argument variables must start with a through h or o through z.

I do not have any problem to use dmin1 or dsin functions with the remedy. However, I am not sure about whether it is really double precision calculation or just real precision calculation with just avoiding compiling error.

Good luck.
  Reply With Quote

Old   November 29, 1999, 06:03
Default Re: HELP!LINUX g77
  #7
nuray kayakol
Guest
 
Posts: n/a
You are right implicit real*8 (a-h,o-z) I will try it. this one works for variables how about constants i.e.,

a=1 c=dmin1(a,0.0)

for this statement compiler gives error message but not the following one a=1 c=dmin1(a,0d0)

in the code there is many such statements. It will take too much time to define all variables and constants as double The accuracy is needed during the application. The study is done for a CFD code applicable to a furnace simulation.

Thank you for your interest Nuray
  Reply With Quote

Old   November 29, 1999, 06:09
Default Re: HELP!LINUX g77
  #8
nuray kayakol
Guest
 
Posts: n/a
-fshort-double command option did not work ! It should be but not. I do not know why
  Reply With Quote

Old   November 29, 1999, 06:56
Default Re: HELP!LINUX g77
  #9
andy
Guest
 
Posts: n/a
I am slightly confused. dsin() is not the generic name for sin(). The generic name for sin() is sin(). If you use this function then the returned type will be the type of the argument. It is the task of the compiler to sort this out and not the programmer. This is one of many examples where Fortran is superior to C for general purpose numerical programming (guessing this may be the source of your confusion?).

g77 is not a Fortran 90 compiler but has the odd extension in the direction of Fortran 90. If you wish to program at a higher level than Fortran then I would suggest using a higher level language such as Mathematica.

I have used g77 with standard Fortran 77 plus the two essential extensions of longer names and "end do". It worked with no problems for a number of substantial numerical codes. It does not produce optimised code that runs at the speed of native Fortran compilers but is not a long way off (unlike C++ unless you really work at it). However, I have had problems integrating it with other code written in different languages but succeeded in the end by writing wrapper functions after working out what it was doing which was a bit weird (it was removing internal underscores). I have also had problems on SMP machines but suspect this is the kernel and not g77. "Fortran/numerical type" extensions of the kind you were originally trying to use are generally not well supported but the standard Fortran looks sound to me.

  Reply With Quote

Old   November 29, 1999, 07:12
Default Re: HELP!LINUX g77
  #10
andy
Guest
 
Posts: n/a
If you are trying to run an existing old Fortran 66 code then use the old AT&T f2c program (or the older Gnu f77 program based on it). I believe the default behaviour is to convert all the reals to doubles. It will certainly contain all the switches you want. The only disadvantage is that by converting to C the code will run at less than optimal speed but this is unlikely to be worse than 50% or so. If your Linux installation does not have it (mine did) you can get the program from netlib.
  Reply With Quote

Old   November 29, 1999, 07:20
Default Re: HELP!LINUX g77
  #11
nuray kayakol
Guest
 
Posts: n/a
consider simple a code

a=1.d0 b=2.d0 c=dmin1(a,b) print*, c end

compiler will give following error message Reference to intirinsic 'dmin' (^) invalid --one or more arguments have incorrent type unless you write

double precision a, b,c

at the top of the program Actually -fshort-double should work without defining all the variables as double

Same discussion is valid dsin()

nuray
  Reply With Quote

Old   November 29, 1999, 07:44
Default Re: HELP!LINUX g77
  #12
andy
Guest
 
Posts: n/a
The compiler should report an error. You have passed real arguments to the specific function dmin1 which has two double arguments and returns a double. The error message is slightly misleading. The "correct" thing to do is to use the generic function min() then you can pass a pair of real, double or integer values with no problems. You cannot, of course, have 1 real and 1 double since the function would not know which type to return.

By declaring the arguments as doubles it works. Good. Assuming you do not want the nasty silent coercions that C provides everything seems fine to me. What is the problem?

  Reply With Quote

Old   December 19, 1999, 17:30
Default Re: HELP!LINUX g77
  #13
Jannis Dotsikas
Guest
 
Posts: n/a
Dear Nuray, I had the same and some more Problems with the g77 Compiler. What I did, was that I bought an other Fortran Compiler ( SNI77 from Siemens Nixdorf). While using Linux you have a working envinronment of fantastic stability and with an comercial Compiler you have the whole functionality, since g77 is actually a quite slow non-native Fortran compiler. SNI77 or any other Compiler are not cheap, but you are probably paid in order to work productively and not trying to solve compiler problems that shouldn´t exist. My opinion: buy (or let your company buy) an other compiler and you will be happy.

Best regards

I.Dotsikas
  Reply With Quote

Old   December 20, 1999, 10:04
Default Re: HELP!LINUX g77
  #14
nuray kayakol
Guest
 
Posts: n/a
Dear I.Dotsikas,

Thank you for your interest. You are right. Compilers other than g77 look as better solution. For example PGI WORKSTATION 3.1. It is about $699 for Full F77/F90/HPF/C/C++ packages. I hope it works.

Nuray
  Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CYGWIN G77 + CFX + WINDOWS. cfdguy CFX 2 January 19, 2009 00:10
fortran error on g77 compiler vishwas Main CFD Forum 1 February 8, 2006 11:47
fortran error for g77 compiler vishwas Main CFD Forum 10 January 30, 2006 18:16
g77 compiling option Dario Main CFD Forum 1 November 25, 2004 10:02
g77 chneg CD-adapco 2 September 17, 2002 11:55


All times are GMT -4. The time now is 09:57.