Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

transfer compiler flags from pgif95 to gfortran

Status
Not open for further replies.

marcs18

Programmer
Sep 30, 2010
4
DE
Dear all,

I'm a newbie in programming with Fortran. My problem is as follows: I work with a code, which was programmed for the use of the pgif90 compiler. Now, on my computer I use the gfortran
compiler (Version: 4:4.4.3-1ubuntu1). My question is - is there a webside or a manual, which describes how to transfer the compiler flags from pgif90 to gfortran. In some cases I could translate the flags with help of the man-pages. But for following I don't find anything: -fast -Kieee

Another question is, if I ignore the -Kieee-flag and use instead of -fast -o3 for gfortran I get this error-message:

ERROR: symbol 'ns' at (1) has no IMPLICIT type

I have read that this is a common problem of gfortran caused gfortran seems to be more strict than pgif90. So, are there some flags to overcome this problem without changing the whole code?

In any case I'm happy about your help.

Greetings,

marcs
 
ERROR: symbol 'ns' at (1) has no IMPLICIT type

This error is strange and is not due to the option -o3.

Did you use other compiling options ? Indeed, by default, the FORTRAN language provides a data type for any variables, depending on the first letter of the variable name : i,j,k,l,m,n for integers, other for real.

The only reason of the error message is therefore an instruction like IMPLICIT NONE which disables the standard default type. But in that case, the compiler pgf90 would have detected the same mistake as gfortran.

Another possibility is the use of a compilation flag which disables the default typing. For gfortran, the flag is -fimplicit-none. Did you use it ?

At last, show us the subroutine of function involved in that error.
 
Thanks for your rapid response!

I used this other flags:

INCLUDES=
F90FLAGS = $(INCLUDES) -o3 -w -m64 -fall-intrinsics -I/usr/lib/gcc/i486-linux-gnu/4.4/include

The IMPLICIT NONE instruction is build in the code. And with pgf90 I don't receive any error message. I don't use the -fimplicit-none flag.

Here the whole shell output after "make", I hope you get an idea of the problem:

$ make -f Makefile3
gfortran -o3 -w -m64 -fall-intrinsics -I/usr/lib/gcc/i486-linux-gnu/4.4/include -c modules.f90
gfortran -o3 -w -m64 -fall-intrinsics -I/usr/lib/gcc/i486-linux-gnu/4.4/include -c Main.f90
gfortran -o3 -w -m64 -fall-intrinsics -I/usr/lib/gcc/i486-linux-gnu/4.4/include -c ReadData.f90
gfortran -o3 -w -m64 -fall-intrinsics -I/usr/lib/gcc/i486-linux-gnu/4.4/include -c startup.f90
gfortran -o3 -w -m64 -fall-intrinsics -I/usr/lib/gcc/i486-linux-gnu/4.4/include -c timer.f90
gfortran -o3 -w -m64 -fall-intrinsics -I/usr/lib/gcc/i486-linux-gnu/4.4/include -c NUMBERS.F90
gfortran -o3 -w -m64 -fall-intrinsics -I/usr/lib/gcc/i486-linux-gnu/4.4/include -c HYPVGVG.F90
gfortran -o3 -w -m64 -fall-intrinsics -I/usr/lib/gcc/i486-linux-gnu/4.4/include -c CHKVGVG.F90
gfortran -o3 -w -m64 -fall-intrinsics -I/usr/lib/gcc/i486-linux-gnu/4.4/include -c FLOW.F90
FLOW.F90:145.65:

INTEGER::i,iflux,ih0,iok,itmp,j,ns,nsat,nsatlast,nsteps0, k, nObs
1
Error: Symbol 'nobs' at (1) already has basic type of INTEGER
FLOW.F90:148.15:

REAL(RK):: time,preTime
1
Error: Symbol 'time' at (1) already has basic type of REAL
FLOW.F90:381.18:

do i=1,n
1
Error: Symbol 'i' at (1) has no IMPLICIT type
FLOW.F90:217.14:

do iflux=1,2 ! sometimes need twice to adjust phi at satn
1
Error: Symbol 'iflux' at (1) has no IMPLICIT type
FLOW.F90:420.13:

ih0=0
1
Error: Symbol 'ih0' at (1) has no IMPLICIT type
FLOW.F90:354.13:

iok=0 ! flag for time step test
1
Error: Symbol 'iok' at (1) has no IMPLICIT type
FLOW.F90:355.14:

itmp=0 ! counter to abort if not getting solution
1
Error: Symbol 'itmp' at (1) has no IMPLICIT type
FLOW.F90:173.1:

j=jt(1); p=>par(j)
1
Error: Symbol 'j' at (1) has no IMPLICIT type
FLOW.F90:235.14:

ns=1 ! start index for eqns
1
Error: Symbol 'ns' at (1) has no IMPLICIT type
FLOW.F90:195.28:

t=ts; nsteps0=nsteps; nsat=0
1
Error: Symbol 'nsat' at (1) has no IMPLICIT type
FLOW.F90:223.16:

nsatlast=nsat ! for detecting onset of profile saturation
1
Error: Symbol 'nsatlast' at (1) has no IMPLICIT type
FLOW.F90:195.15:

t=ts; nsteps0=nsteps; nsat=0
1
Error: Symbol 'nsteps0' at (1) has no IMPLICIT type
make: *** [FLOW.o] Fehler 1


It seems it is a problem with IMPLICIT NONE. Should I try to comment out the IMPLICIT NONE option.

Sorry for not posting the code. It's not my own (I don't know how it is with the copyright).

Thanks and cheers,

marcs

 
When you get a cascade of errors, please, look at the first error messages only ! The rest is often noise...

Code:
FLOW.F90:145.65:

INTEGER::i,iflux,ih0,iok,itmp,j,ns,nsat,nsatlast,nsteps0, k, nObs
                                                                 1
Error: Symbol 'nobs' at (1) already has basic type of INTEGER

The message is quite clear : you have defined twice the same variable and this is forbidden ! As gfortran has found an error in that instruction, it considers it invalid and prefers to ignore it totally. So the following errors are due to that : a variable like "i" of "ns" has never been defined (error caused by a previous error).

Do not forget also to delete a declaration of the variable "Time", defined twice as "nobs".

After these two corrections, the file FLOW.F90 should be compiled correctly.

So, as conclusion, gfortran is "normal" and pgf90 not strict enough! And the flags are not responsible of that.

 
Thank you again FJacq for your quick response.
I will try it.
And thank you for your hints, very valuable for me newbie!

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top