Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is this a bug of the Compaq fortran on Trux64?

2 views
Skip to first unread message

Wai Sun Don

unread,
Jun 1, 2001, 9:14:33 AM6/1/01
to
Please take a look a this small piece of code below,

% f90 -free Bug.F
%a.out

U and V are 3D arrays of size ( 2, 2, 2 )

**********************************************************************
PS_Grad_1 : Passing in a SLICE of a 3D array U(:,:,k), V(:,:,k)

Slice Number k=1
Acutal U : 0. 1. 2. 3.
Acutal V : 0. 1. 2. 3.
Dummy U : 4. 5. 6. 7.
Dummy V : 0. 1. 2. 3.

Slice Number k=2
Acutal U : 4. 5. 6. 7.
Acutal V : 4. 5. 6. 7.
Dummy U : 0. NaN 0. 0.
Dummy V : 4. 5. 6. 7.

**********************************************************************
PS_Grad_2 : Passing in a FULL 3D array U(:,:,k), V(:,:,k)

Slice Number k=1
Dummy U : 0. 1. 2. 3.
Dummy V : 0. 1. 2. 3.

Slice Number k=2
Dummy U : 4. 5. 6. 7.
Dummy V : 4. 5. 6. 7.

**********************************************************************

Notice that there is a NaN in the dummy array U.

The 2 arrays of rank 3 (U and V) have elements increase from 0-7
with U(i,j,k) = i+ j*(N+1) + k*(N+1)*(M+1) and N=M=L=1 and
i=0:N, j=0:M, k=0:L
Similar definition is applied to V as well.

U and V are defined as (0:N,0:M,0:L) in the main program
and (:,:,:) in the subroutine.

The whole 3D array U when passed a slice of 2D array
into a subroutine PS_Grad_1, seems to shifted the last index from 1 to
0.
But it is not the case for the array V.

It is fine if the whole 3D arrays U and V are passed to the subroutine
PS_Grad_2.

If you find any bug in the code, please let me know.

Thanks

Don
-----------------------------------------------------------------
MODULE Gradient_Function

implicit NONE

PRIVATE

PUBLIC :: PS_Grad

CONTAINS

Subroutine PS_Grad (U, V)

INTEGER
:: N1, N2, N3, k
DOUBLE PRECISION, dimension(:,:,:) :: U, V

N1 = SIZE(u, DIM=1) ; N2 = SIZE(u, DIM=2) ; N3 = SIZE(u, DIM=3)

write (6,'(1x,"U and V are 3D arrays of size (",2(i2,","),i2" )" )')
N1,N2,N3

write (6,'(1x/1x,70("*")/1x, &
"PS_Grad_1 : Passing in a SLICE of a 3D array U(:,:,k),
V(:,:,k)")')

do k = 1,N3
write (6,'(1x/1x,"Slice Number k=",i1)') k
write (6,'(1x," Acutal U : ",4f7.0)') U(:,:,k)
write (6,'(1x," Acutal V : ",4f7.0)') V(:,:,k)

call PS_Grad_1 (U(:,:,k), V(:,:,k))
enddo

write (6,'(1x/1x,70("*")/1x, &
"PS_Grad_2 : Passing in a FULL 3D array U(:,:,k),
V(:,:,k)")')

call PS_Grad_2 (U, V)

CONTAINS
!
! --------------------------------------------------------------------
!
Subroutine PS_Grad_1 (U, V)

DOUBLE PRECISION, dimension(N1,N2) :: U, V

write (6,'(1x," Dummy U : ",4f7.0)') U(:,:)
write (6,'(1x," Dummy V : ",4f7.0)') V(:,:)

END Subroutine PS_Grad_1
!
! --------------------------------------------------------------------
!
Subroutine PS_Grad_2 (U, V)

DOUBLE PRECISION, dimension(N1,N2,N3) :: U, V

do k = 1,N3
write (6,'(1x/1x,"Slice Number k=",i1)') k
write (6,'(1x," Dummy U : ",4f7.0)') U(:,:,k)
write (6,'(1x," Dummy V : ",4f7.0)') V(:,:,k)
enddo
write (6,'(1x/1x,70("*"))')

END Subroutine PS_Grad_2

END Subroutine PS_Grad

END MODULE Gradient_Function

PROGRAM Compaq_Bug_1
USE Gradient_Function

implicit NONE

INTEGER
:: N=1, M=1, L=1, i, j, k
DOUBLE PRECISION, dimension(:,:,:), ALLOCATABLE :: U

Allocate ( U(0:N,0:M,0:L) )

do k = 0,L ; do j = 0,M ; do i = 0,N
U(i,j,k) = i+j*(N+1)+k*(N+1)*(M+1)
enddo ; enddo ; enddo

call Gradient_Test

CONTAINS

Subroutine Gradient_Test

DOUBLE PRECISION, dimension(0:N,0:M,0:L) :: V

do k = 0,L ; do j = 0,M ; do i = 0,N
V(i,j,k) = i+j*(N+1)+k*(N+1)*(M+1)
enddo ; enddo ; enddo

call PS_Grad (U, V)

END Subroutine Gradient_Test

End PROGRAM


Steve Lionel

unread,
Jun 1, 2001, 3:28:32 PM6/1/01
to
On Fri, 01 Jun 2001 09:14:33 -0400, Wai Sun Don <ws...@cfm.brown.edu>
wrote:

>Please take a look a this small piece of code below,

[snip]

Yes, it is a bug. A workaround is to add:

-switch fe_not_contig

when compiling. We'll fix it for a future update.

In the future, please feel free to send problem reports like this on
Compaq Fortran compilers OTHER than Visual Fortran to
for...@compaq.com and we'll respond directly. Visual Fortran support
requests should be sent to vf-su...@compaq.com only.


Steve Lionel (mailto:Steve....@compaq.com)
Fortran Engineering
Compaq Computer Corporation, Nashua NH

Compaq Fortran web site: http://www.compaq.com/fortran

Wai Sun Don

unread,
Jun 2, 2001, 7:28:43 PM6/2/01
to
What does this compiler option mean and do?
Is there any side effect that I should know before using it?
Could you clarify it further?
I can't find any reference to this compiler option in the man page!

Do you maintain a list of known compiler/run time error bugs or known problems
that you can provide to
the user like us who doesn't like to spend days just trying to find out the source of
the compiler/run time errors that might already been reported?

Furthermore, I have a number of compiler/run time memory errors which does
not make any sense (to me at least!).
For example, I have to change all the Pointer arrays to Allocatable arrays to avoid
a segmentation errors on the Trux64 Fortran.
Isolating the source of the all these small but non-trivial problems is a difficult and time consuming task.

It is a very frustrating experience for me trying to port a F90 library modules that compile/run
on numerous other computer hardware/OS but not so on the Compaq Trux64-Fortran
platform.

Yours

Don

-- 
.....................................................................
Prof. Wai Sun Don, PhD

Box F, 182 George Street        
Div. of Applied Math.                 Tel : (401)-863-2250
Brown University                      Fax : (401)-863-1355
Providence, RI 02912
 

0 new messages