Opened 19 years ago

Closed 18 years ago

Last modified 16 years ago

#55 closed defect (fixed)

ROPP 1DVAR Compilation Problem with g95

Reported by: frae Owned by: marq
Priority: major Milestone:
Component: ropp_1dvar Version: 0.8
Keywords: Cc: dave.offiler@…, carlo.buontempo@…, axel.vonengeln@…

Description

When runing a g95 compilation I get the following error:

g95 -I../build  -Wall -O2 -I/rinax/storage/projects/Radio_Occultation/GRAS/ROPP/g95//include -c -o matrix.o `test -f '../math/matrix/matrix.f90' || echo './'`../math/matrix/matrix.f90
In file ../math/matrix/matrix.f90:510

       real(wp), dimension((int(sqrt(8.*size(A))+1.)-1.)/2, &
                                                         1
Error: Expression at (1) must be of INTEGER type
In file ../math/matrix/matrix.f90:553

       real(wp), dimension((int(sqrt(8.*size(A%d))+1.)-1.)/2, &
                                                           1
Error: Expression at (1) must be of INTEGER type
In file ../math/matrix/matrix.f90:622

       real(wp), dimension((int(sqrt(8.*size(A))+1.)-1.)/2, &
                                                         1
Error: Expression at (1) must be of INTEGER type
In file ../math/matrix/matrix.f90:666

       real(wp), dimension((int(sqrt(8.*size(A%d))+1.)-1.)/2, &
                                                           1
Error: Expression at (1) must be of INTEGER type
In file ../math/matrix/matrix.f90:281

     end function matrix_divs_get_dble
                                      1
Error: Ambiguous interfaces 'matrix_divs_get_dble' and 'matrix_divs_get_float' in intrinsic '/' operator at (1)
make[1]: *** [matrix.o] Error 1
make[1]: Leaving directory `/home/home03/axel/temp/ropp_1dvar/build'
make: *** [all-recursive] Error 1

This is similar to the FM coding problem I had (#54), so it might be related.

Change history (11)

comment:1 by Dave Offiler, 19 years ago

a) which version (date) of g95 are you using? (g95 --version). G95 has updates (almost) daily, and this might alreday be fixed, so downlaod & install the latest & try again.

b) if (a) doesn't cure it, can you re-create the problem with a very simple code fragment - e.g. is the size() problem just size() or because it's in a declaration? If we can prove a bug in g95, I will report it.

c) this is a pretty complex declaration - can it be broken down so that the diemnsion() is a simple parameter declared above it?

Dave

comment:2 by marq, 19 years ago

Owner: changed from frcm to marq

Hmm,

I'll check later tonight, but I don't think there's a way of simplifying the declaration. The structure A (which is a representation of a covariance matrix) holds the matrix data itself (A%d) in packed form, i.e. only the upper right triangle plus the diagonal - so it saves about half of the required storage. Lapack is able to deal with this type of packed storage, only using half of the operations (or so) when doing calculations with it. So using the packed format for a symmetric matrix also makes things faster, which is the whole idea of this matrix class.

In the particular case Axel ran into, I probably try to get the dimension of the full matrix from the dimension of the data field in the structure passed to the routine. Because the size is only known at runtime, I either have to get it as automatic array in the declaration part, or I have to do the allocation and deallocation of memory manually in the routine body. The latter would require manual allocate()'s and deallocate()'s, and that's again a performance hit (I have been told several months ago by someone from the UM team) - so I rely on the compiler being able to do the automatic stuff.

If I remember correctly, it is part of the Fortran 95 standard to allow arbitrary mathematical expressions as long only intrinsics are involved; so it should be ok. It might be that I have to cast things to integer, though.

Chris.

comment:3 by marq, 19 years ago

Ok,

there are two problems in here. Changeset [811] fixes the second,

Error: Expression at (1) must be of INTEGER type
In file ../math/matrix/matrix.f90:281

     end function matrix_divs_get_dble
                                      1
Error: Ambiguous interfaces 'matrix_divs_get_dble' and 'matrix_divs_get_float' in intrinsic '/' operator at (1)

which was indeed a typo.

comment:4 by marq, 19 years ago

Cc: carlo.buontempo@… axel.vonengeln@… added; engeln@… removed
Priority: normalhigh
Version: 0.8

comment:5 by marq, 18 years ago

Resolution: fixed
Status: newclosed

The first (and remaining) part of the problem (declaration of dimensions in a way that makes g95 happy) should be fixed in [823].

Please reopen the ticket if not.

Chris.

comment:6 by frae, 18 years ago

Resolution: fixed
Status: closedreopened
Version: 0.8

Found some more of those...

g95 -I../build  -Wall -O2 -I/rinax/storage/projects/Radio_Occultation/GRAS/ROPP/g95//include -c -o matrix_sqrt.o `test -f '../math/matr
ix/matrix_sqrt.f90' || echo './'`../math/matrix/matrix_sqrt.f90
In file ../math/matrix/matrix_sqrt.f90:231

  n = (int(sqrt(8.*size(A))+1.)-1.)/2
                                    1
Warning (140): Implicit conversion at (1) may cause precision loss
In file ../math/matrix/matrix_sqrt.f90:222

  real(wp), dimension((int(sqrt(8.*size(A))+1.)-1.)/2, &
                                                    1
Error: Expression at (1) must be of INTEGER type
In file ../math/matrix/matrix_sqrt.f90:220

  real(wp), dimension((int(sqrt(8.*size(A))+1.)-1.)/2) :: svalues
                                                    1
Error: Expression at (1) must be of INTEGER type
In file ../math/matrix/matrix_sqrt.f90:222

  real(wp), dimension((int(sqrt(8.*size(A))+1.)-1.)/2, &
                                                    1
Error: Expression at (1) must be of INTEGER type
In file ../math/matrix/matrix_sqrt.f90:222

  real(wp), dimension((int(sqrt(8.*size(A))+1.)-1.)/2, &
                                                    1
Error: Expression at (1) must be of INTEGER type
make[1]: *** [matrix_sqrt.o] Error 1
make[1]: Leaving directory `/rinax/storage/projects/Radio_Occultation/temp/ropp_1dvar/build'
make: *** [all-recursive] Error 1

comment:7 by marq, 18 years ago

Resolution: fixed
Status: reopenedclosed

Ooops -

sorry - I forgot that one. Fixed in [825].

comment:8 by frae, 18 years ago

Resolution: fixed
Status: closedreopened

This is what I still get (svn version 825):

g95 -I../build  -Wall -O2 -I/rinax/storage/projects/Radio_Occultation/GRAS/ROPP/g95//include -c -o matrix_sqrt.o `test -f '../math/matrix/matrix_sqrt.f90' || echo './'`../math/matrix/matrix_sqrt.f90
In file ../math/matrix/matrix_sqrt.f90:231

  n = (int(sqrt(8.*size(A))+1.)-1.)/2
                                    1
Warning (140): Implicit conversion at (1) may cause precision loss
In file ../math/matrix/matrix_sqrt.f90:220

  real(wp), dimension((int(sqrt(8.*size(A))+1.)-1.)/2) :: svalues
                                                    1
Error: Expression at (1) must be of INTEGER type
In file ../math/matrix/matrix_sqrt.f90:226

comment:9 by Dave Offiler, 18 years ago

I've installed the very latest g95 (18/06/2006).

In my case:

g95 -I../build -O2 -I/data/nwp1/grassaf/ropp/g95/include -c -o matrix_sqrt.o test -f '../math/matrix/matrix_sqrt.f90' || echo './'../math/matrix/matrix_sqrt.f90 In file ../math/matrix/matrix_sqrt.f90:220

real(wp), dimension((int(sqrt(8.*size(A))+1.)-1.)/2)
svalues 1

Error: Expression at (1) must be of INTEGER type

(I don't set -Wall, so the first Warning is probbaly suppressed). Given that the Error points to the final '2', I wondered if the complete expression was casting to a Float? So adding a couple of extra () about the INT, to give:

real(wp), dimension((int((sqrt(8.*size(A))+1.)-1.)/2))
svalues

...and this compiles without the error.

comment:10 by marq, 18 years ago

Resolution: fixed
Status: reopenedclosed

Yeah,

I know - there are several ways to fix this for the g95, some which cause the Intel compiler to complain;-). I have gone (in all cases) with this one

   real(wp), dimension((int(sqrt(8.*size(A))+1.)-1)/2)

which seems to work for both (and hopefully for all others as well). If you're interested, Intel doesn't like the case where the 8. is an intenger, because the argument to sqrt() then becomes an int instead of a float. While that makes at least a little bit of sense, adding a pair of brackets is something I find completely pointless - that really shouldn't matter.

But well... I close this once more;-)

Chris.

comment:11 by (none), 16 years ago

Milestone: 0.9

Milestone 0.9 deleted

Note: See TracTickets for help on using tickets.