|
[Sponsors] |
November 26, 1999, 02:09 |
HELP!LINUX g77
|
#1 |
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
|
|
November 27, 1999, 06:49 |
Re: HELP!LINUX g77
|
#2 |
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.
|
|
November 27, 1999, 07:20 |
Re: HELP!LINUX g77
|
#3 |
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.
|
|
November 27, 1999, 07:51 |
Re: HELP!LINUX g77 - PS
|
#4 |
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. |
|
November 29, 1999, 02:56 |
Re: HELP!LINUX g77
|
#5 |
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 |
|
November 29, 1999, 03:23 |
Re: HELP!LINUX g77
|
#6 |
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. |
|
November 29, 1999, 05:03 |
Re: HELP!LINUX g77
|
#7 |
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 |
|
November 29, 1999, 05:09 |
Re: HELP!LINUX g77
|
#8 |
Guest
Posts: n/a
|
-fshort-double command option did not work ! It should be but not. I do not know why
|
|
November 29, 1999, 05:56 |
Re: HELP!LINUX g77
|
#9 |
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. |
|
November 29, 1999, 06:12 |
Re: HELP!LINUX g77
|
#10 |
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.
|
|
November 29, 1999, 06:20 |
Re: HELP!LINUX g77
|
#11 |
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 |
|
November 29, 1999, 06:44 |
Re: HELP!LINUX g77
|
#12 |
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? |
|
December 19, 1999, 16:30 |
Re: HELP!LINUX g77
|
#13 |
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 |
|
December 20, 1999, 09:04 |
Re: HELP!LINUX g77
|
#14 |
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
CYGWIN G77 + CFX + WINDOWS. | cfdguy | CFX | 2 | January 18, 2009 23:10 |
fortran error on g77 compiler | vishwas | Main CFD Forum | 1 | February 8, 2006 10:47 |
fortran error for g77 compiler | vishwas | Main CFD Forum | 10 | January 30, 2006 17:16 |
g77 compiling option | Dario | Main CFD Forum | 1 | November 25, 2004 09:02 |
g77 | chneg | Siemens | 2 | September 17, 2002 11:55 |