Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!mips!hal!mark From: mark@mips.COM (Mark G. Johnson) Newsgroups: comp.benchmarks Subject: Ole Swang's benchmark: Sum of Harmonic Series Message-ID: <44125@mips.mips.COM> Date: 15 Dec 90 18:08:04 GMT References: Sender: news@mips.COM Reply-To: mark@mips.COM (Mark G. Johnson) Lines: 59 In article oles@kelvin.uio.no (Ole Swang) writes: > >Another easy-to-memorize benchmark is the computation of the sum >of the first 10 million terms in the harmonic series. >This is a FORTRAN version, it should not be too hard to translate >even without f2c :-) > > PROGRAM RR > DOUBLE PRECISION R > R=0.0 > DO 10 I=1,10000000 > R=R+1/DBLE(I) >10 CONTINUE > WRITE(*,*)R,I > END Because the Suns that I have access to, don't have Fortran compilers, I translated (without f2c :-), giving #include main() { double r ; int i ; r = 0.0; for(i=1; i<=10000000; i++) { r += (1.0/( (double) i ) ) ; } printf(" r = %16.7le, i = %d\n", r, i); } >It vectorizes fully on the vectorizing compilers I've tested it on >(Cray and Convex). It has the advantage over the bc benchmark that >it's the same code every time. > Adding to Ole's list (user CPU seconds from /bin/time), >Cray X/MP 216 0.29 * MIPS RC6280 3.3 {added} MIPS RC3230 Magnum 8.1 {added} >Convex C 120 8.7 Sun SPARCstation II 10.0 {added} >DECstation 5000/200 10.5 >DECsystem 5400 13.1 Sun SPARCstation 1+ 33.0 {added} >VAX 6330/VMS5.3 FPA 41.9 >VAX 8650/VMS5.3 FPA 55.3 >VAX 8600/VMS5.2 FPA 77.1 >Sun 3/60 (m68881) 105.6 > > >* The code was modified to single presicion for the Cray, as this >yields the wanted 64-bits accuracy. > -- -- Mark Johnson MIPS Computer Systems, 930 E. Arques M/S 2-02, Sunnyvale, CA 94086 (408) 524-8308 mark@mips.com {or ...!decwrl!mips!mark}