forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with OPTIMISE switch with FTN95 compiler

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Ananda



Joined: 02 Aug 2005
Posts: 8
Location: Croydon

PostPosted: Wed Aug 03, 2005 4:46 am    Post subject: Problem with OPTIMISE switch with FTN95 compiler Reply with quote

I have identified a problem with the OPTIMISE switch with FTN95. The following screen dump demonstrate this.

------------------------------------------------------------
D:contramc7tubaver16opt_test>type test.inc
integer*4 M_vtype,M_Ftype,N_vtype,N_Ftype,N_Evlyrs
parameter (M_vtype=10)
parameter (M_Ftype=3)
real*4 dmfc_allyr(M_vtype,M_Ftype),dsfc_allyr(M_vtype,M_Ftype)
common /cdata/N_vtype,N_Ftype,N_Evlyrs,dmfc_allyr,dsfc_allyr

D:contramc7tubaver16opt_test>type test.for
C*******************************************************************************
PROGRAM TEST
C*******************************************************************************
include 'test.inc'

c integer*4 M_vtype,M_Ftype,N_vtype,N_Ftype,N_Evlyrs
c parameter (M_vtype=10)
c parameter (M_Ftype=3)
c real*4 dmfc_allyr(M_vtype,M_Ftype),dsfc_allyr(M_vtype,M_Ftype)
c common /cdata/N_vtype,N_Ftype,N_Evlyrs,dmfc_allyr,dsfc_allyr

integer*4 S_dmfc,A_dmfc,A_dsfc
N_vtype=1
N_Ftype=2
N_Evlyrs=1
S_dmfc=8*N_vtype*N_Ftype*N_Evlyrs
call get_storage@(A_dmfc,s_dmfc)
call get_storage@(A_dsfc,s_dmfc)
call fuel_con_out(DCORE8(A_dmfc),DCORE8(A_dsfc))
call return_storage@(A_dsfc)
call return_storage@(A_dmfc)
end
C*******************************************************************************
subroutine fuel_con_out(dm_fuel_con,ds_fuel_con)
C*******************************************************************************

include 'test.inc'
c
real*8 dm_fuel_con(N_vtype,N_Evlyrs,N_Ftype)
real*8 ds_fuel_con(N_vtype,N_Evlyrs,N_Ftype)
c
dm_fuel_con(1,1,1)=1000.0
dm_fuel_con(1,1,2)=1000.0
call fuel_aggr(dm_fuel_con,dmfc_allyr)
ds_fuel_con(1,1,1)=2000.0
ds_fuel_con(1,1,2)=2000.0
call fuel_aggr(ds_fuel_con,dsfc_allyr)
write(*,*)'Aggr=',dsfc_allyr(1,1)
return
end
C*******************************************************************************
subroutine fuel_aggr(fuel_con,fc_allyr)
C*******************************************************************************

include 'test.inc'
c
integer*4 v,y,f
real*4 fc_allyr(M_vtype,M_Ftype)
real*8 fuel_con(N_vtype,N_Evlyrs,N_Ftype)
c
do f=1,N_Ftype
do v=1,N_vtype
fc_allyr(v,f)=0.0
do y=1,N_Evlyrs
fc_allyr(v,f)=fc_allyr(v,f)+fuel_con(v,y,f)
if(f.eq.1.and.v.eq.1.and.y.eq.1)
+ write(*,*)fc_allyr(v,f),fuel_con(v,y,f)
end do
end do
end do
return
end

D:contramc7tubaver16opt_test>ftn95 test.for/link [FTN95/Win32 Ver. 4.8.2038 Copyright (C) Salford Software Ltd 1993-2005]
Licensed to: Paul Chu
Organisation: MOTT MACDONALD

NO ERRORS [<TEST> FTN95/Win32 v4.8.2038]
NO ERRORS [<FUEL_CON_OUT> FTN95/Win32 v4.8.2038]
NO ERRORS [<FUEL_AGGR> FTN95/Win32 v4.8.2038]
Creating executable: test.EXE

D:contramc7tubaver16opt_test>test
1000.00 1000.00000000
2000.00 2000.00000000
Aggr= 2000.00

D:contramc7tubaver16opt_test>ftn95 /intl /logl /save /zeroise /INHIBIT_OPT 36 /OPTIMISE test.for /link [FTN95/Win32 Ver. 4.8.2038 Copyright (C) Salford Software Ltd 1993-2005]
Licensed to: Paul Chu
Organisation: MOTT MACDONALD

NO ERRORS [<TEST> FTN95/Win32 v4.8.2038]
NO ERRORS [<FUEL_CON_OUT> FTN95/Win32 v4.8.2038]
NO ERRORS [<FUEL_AGGR> FTN95/Win32 v4.8.2038]
Creating executable: test.EXE

D:contramc7tubaver16opt_test>test
0.00000 1000.00000000
0.00000 2000.00000000
Aggr= 0.00000

------------------------------------------------------------

The test program works fine without the OPTIMISE switch. However, with the /OPTIMISE switch it produces wrong results.


Ananda
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7924
Location: Salford, UK

PostPosted: Fri Aug 05, 2005 7:05 am    Post subject: Problem with OPTIMISE switch with FTN95 compiler Reply with quote

Ananda

Your program reveals a bug the optimiser that is affecting the line

fc_allyr(v,f)=fc_allyr(v,f)+fuel_con(v,y,f)

The problem is caused by the mixed precision (*4 and *Cool in the expression.

There are various ways around this (until the bug is fixed)

1) Change all REAL*4 to REAL*8 or
2) Break the assignment into two parts to avoid adding REAL*4 to REAL*8
3) Use /INHIBIT_OPT 30 on this part of the code.

Note for other users reading this correspondance...
1) There may not be much improvement in performance when using /OPTIMISE except perhaps during intensive numerical calculations. If you want do use /OPTIMISE, do some timing tests to see if there is a significant improvement in the runtime. If there is no improvement, then for safety, do not use /OPTIMISE.

2) /INHIBIT_OPT will not generally be available until the next release.

Back to top
View user's profile Send private message AIM Address
Anonymous
Guest





PostPosted: Fri Aug 05, 2005 7:15 am    Post subject: Problem with OPTIMISE switch with FTN95 compiler Reply with quote

Paul,

Thank you for the solution to this problem. I had a test with and without /OPTIMISE swith and run showed about 2 minutes saving on a 11 minute run. That is why I wanted to use the /OPTIMISE switch.

I prefer to convert all the code to REAL*8 and continue.

Regards
Ananda

Ananda
Back to top
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7924
Location: Salford, UK

PostPosted: Tue Aug 23, 2005 12:59 pm    Post subject: Problem with OPTIMISE switch with FTN95 compiler Reply with quote

This bug has now been fixed.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group