Replicating results
- From: kalu <eric.becker.m@xxxxxxxxx>
- Date: Mon, 06 Aug 2007 04:10:02 -0000
Hi,
I have the following piece of fortran code that seems to give me
different answers every time I run it. I need to get the same result
every time because, although these differences look small, they
unravel into substantial differences. This code snippet is part of a
gradient calculation used in a large optimization routine.
I have printed the code and results below. Has anybody else run into
this problem? I am using the absoft compiler on an intel64 machine.
Please let me know if more information is needed.
-Kalu
begin CoDE:
-----------------------
real*8 :: x(n),grad(n),dh(nmax),ee(nmax,nmax),xsav(nmax)
! ... some more code goes here ...
do i = 1,n
do j = 1,n
x(j) = xsav(j) - ee(i,j)
end do
call evalf(x,tempf1)
do j = 1,n
x(j) = xsav(j) + ee(i,j)
end do
call evalf(x,tempf2)
! point of interest
grad(i) = (tempf2-tempf1)/(2.0D+00*dh(i))
! output below shows that the arguments to the right of the equal
sign are the
! same every time while the results of this calculation differ
print *,'tempf2 = ',tempf2,' tempf1 = ',tempf1,' dh(',i,') =
',dh(i),'grad(',i,') = ',grad(i)
end do
------------
End CoDE
Begin Output
-------------
tempf2 = -11.2891215185643 tempf1 = -11.2891217937382 dh( 4 )
= 8.680700000000000E-007 grad( 4 ) = 0.158497573828246
tempf2 = -11.2891215185643 tempf1 = -11.2891217937382 dh( 4 )
= 8.680700000000000E-007 grad( 4 ) = 0.158497571781917
------------
End Output
.
- Follow-Ups:
- Re: Replicating results
- From: mecej4
- Re: Replicating results
- From: highegg
- Re: Replicating results
- From: gsal
- Re: Replicating results
- From: Louis Krupp
- Re: Replicating results
- Prev by Date: Re: bug or mistake?
- Next by Date: Re: Why So Great for Numbers? / Best Compiler
- Previous by thread: bug or mistake?
- Next by thread: Re: Replicating results
- Index(es):
Relevant Pages
|