SCIENTIFIC-LINUX-USERS Archives

September 2007

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Klaus Wacker <[log in to unmask]>
Reply To:
Klaus Wacker <[log in to unmask]>
Date:
Thu, 20 Sep 2007 10:12:50 +0200
Content-Type:
text/plain
Parts/Attachments:
text/plain (67 lines)
On Wed, Sep 19, 2007 at 10:25:55AM -0500, Hendrik van Hees wrote:
> Thank you very much for all the responses. I think I didn't make the 
> problem clear. With the older version of gcc (I am using the fortran 
> compiler, g77)
> 
> gcc version 3.3.5 20050117 (prerelease) (SUSE Linux)
> 
> the little code runs fine.
> 
> With the newer version, which is definitely in my installation of SL 5 
> (I use yum as a package manager),
> 
> gcc version 3.4.6 20060404 (Red Hat 3.4.6-4)
> 
> the same code does not work any more. Perhaps it helps, when I give the 
> relevant piece of code:
> 
> cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
> 
>       open(unit=1,
>      $     file='RW-total-tadmix4pi-6pi-DY.dat')
> 
>       do x=0.2d0,1.45d0,0.01d0
>          erg=ipol(x1,set1,x)+ipol(x2,set2,x)+ipol(x3,set3,x)
>      $        +ipol(x4,set4,x)+ipol(x5,set5,x)
>          write(unit=1,fmt='(2g25.8e3)') 
>      $        x,erg
>       end do
>       
>       close(unit=1)
>       
> cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
> c     add omega and phi (all pT)
>       open (unit=2, file='RW-total-tadmix4pi-6pi-DY.dat',
>      $     status='old')
>       do j=1,nmax1
>          read(unit=2,fmt='(2g25.8e3)') x1(j),set1(j)
> c         write(*,*) x1(j),set1(j)
>       end do
>       close(unit=2)
> cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
> 
> As you see. It simply writes some columns of double precision, and in 
> the next step it reads the same in again.
> 


Somehow the code you show doesn't fit the error message. You seem to be
using unit 1 only for writing, whereas the error message talks about
reading from unit 1. 

However, this program will inevitably produce results which depend on
the version of the compiler, on the type of hardware and maybe on other
things. The first loop will be executed either 125 or 126 times, with
about equal probability. If you must use a floating point variable as
loop index, at least add half the step width to the upper limit. Better
use an integer loop index.

Cheers, Klaus.


-- 
Klaus Wacker              [log in to unmask]
Experimentelle Physik V   http://www.physik.uni-dortmund.de/~wacker
Universitaet Dortmund     Tel.: +49 231 755 3587
D-44221 Dortmund          Fax:  +49 231 755 4547

ATOM RSS1 RSS2