Just Like to Point Something Out

Hard and soft ware discusion.

Moderator: Moderators

Just Like to Point Something Out

Postby dillona_aix » Sat May 06, 2006 5:37 am

I was just running some programs, and I thought that some here might find this interesting.

I compiled the same C program on both suse and a maybe 15 year old cray SUPERCOMPUTER.

The Cray:
[guest@yel guest]$ ./fib

Fibonacci Benchmark

The 40'th Fibonacci Number is: 102334155
Run Time (sec) = 714.043

[guest@yel guest]$


SUSE:
dillona@suse:~> ./a.out

Fibonacci Benchmark

The 40'th Fibonacci Number is: 102334155
Run Time (sec) = 6.710

dillona@suse:~>


Thats right. The supercomputer was aprox. 106 times slower than suse.

WOW!
There are 10 types of people in this world, those who understand binary and those who don't.
User avatar
dillona_aix
Moderator
Moderator
 
Posts: 185
Joined: Sun Sep 11, 2005 9:05 pm
Location: USA

Postby dillona_aix » Sat May 06, 2006 5:46 am

The same program ran on AIX:
bash-2.04$ ./a.out

Fibonacci Benchmark

The 40'th Fibonacci Number is: 102334155
Run Time (sec) = 99.240

bash-2.04$


I should have mentioned in my last post that all of the machines besides the cray are polarhome.

Z: Is OpenVMS/Alpha down?
There are 10 types of people in this world, those who understand binary and those who don't.
User avatar
dillona_aix
Moderator
Moderator
 
Posts: 185
Joined: Sun Sep 11, 2005 9:05 pm
Location: USA

Postby miker_alpha » Mon May 08, 2006 10:50 am

Polarhome Alpha was out of reach over the weekend, but seems back now.

Can you post the Fibbonacci source? I'll try to get it to run on an Alpha. Should be simple enough.

MikeR
Look for OpenVMS help on my webpage
Check for QOTD here.
Image
User avatar
miker_alpha
Moderator
Moderator
 
Posts: 256
Joined: Sat May 08, 2004 9:20 am
Location: Kibbutz Tzora, Israel

Postby zoli » Mon May 08, 2006 2:04 pm

hi,

something happened with the tcpip stack. Simple restart helped.

Otherwise, I will soon put online an dual cpu AIX box with 5.2 - please try on that as soon it is available.

I am not sure should we keep the old AIX box with 4.3.3 or it is enough to have just one AIX.
Regards,
Z
---
Zoltan Arpadffy
zoli
Forum Admin
Forum Admin
 
Posts: 784
Joined: Mon Sep 30, 2002 1:27 am
Location: Stockholm, Sweden

Postby dillona_aix » Mon May 08, 2006 7:05 pm

Hi,
It ran VERY quickly on alpha:
DILLONA@alpha$ run fib

Fibonacci Benchmark

The 40'th Fibonacci Number is: 102334155
Run Time (sec) = 7.700

DILLONA@alpha$


MikeR,
fib.c:
Code: Select all
#define VMS

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

void main(void);
unsigned long fib(long);

unsigned long fib(x)
long x;
{
 if (x > 2)
  return(fib(x-1)+fib(x-2));
 else
  return(1);
}


void main()
{
 register unsigned long IMax,value;
 double starttime, benchtime, dtime();

 IMax = 40;

 printf("\n");
 printf("Fibonacci Benchmark\n");

 starttime = dtime();
 value = fib(IMax);
 benchtime = dtime() - starttime;
 
 printf("\n");
 printf("The %02d'th Fibonacci Number is: %d\n",IMax,value);
 printf("Run Time (sec) =  %10.3lf\n\n",benchtime);
}
/*********************************************************/
/*  VMS dtime() for VMS systems.                         */
/*  Provided by: RAMO@uvphys.phys.UVic.CA                */
/*  Some people have run into problems with this timer.  */
/*********************************************************/
#ifdef VMS
#include time

#ifndef HZ
#define HZ 100
#endif

struct tbuffer_t
      {
       int proc_user_time;
       int proc_system_time;
       int child_user_time;
       int child_system_time;
      };

struct tbuffer_t tms;

double dtime()
{
 double q;

 times(&tms);

 q = (double)(tms.proc_user_time) / (double)HZ;
   
 return q;
}
#endif


Sorry to put that in a post, but other people may want it as well.
If anyone wants the full source (meaning UNIX, windows, DOS, etc.) PM me.

Zoli,
I will run it on the new AIX box as soon as it is online. As for the other box, IMHO both shouldn't be online.
There are 10 types of people in this world, those who understand binary and those who don't.
User avatar
dillona_aix
Moderator
Moderator
 
Posts: 185
Joined: Sun Sep 11, 2005 9:05 pm
Location: USA

Postby dillona_aix » Mon May 08, 2006 7:16 pm

It ran decent on VAX:
GUEST@vax$ run fib

Fibonacci Benchmark

The 40'th Fibonacci Number is: 102334155
Run Time (sec) = 93.690

GUEST@vax$
There are 10 types of people in this world, those who understand binary and those who don't.
User avatar
dillona_aix
Moderator
Moderator
 
Posts: 185
Joined: Sun Sep 11, 2005 9:05 pm
Location: USA

Postby miker_alpha » Tue May 09, 2006 7:41 pm

Calculating Fibbonacci numbers by recursion is *extremely* memory-hungry.
Just think: by the time you calculate Fib(40) you have all the lower numbers calculations on the stack - almost all of them several times.
So the speed is very dependent on how much memory you can use to save all the intermediate results.
On a memory-starved Alpha it took over a minute to count down from 40, because the program was paging frantically.
On the other hand, using a two-cell buffer to save the last two results was too fast to measure (less than one second to get to Fib(46) - as high an integer as fits into 32 bits. I'll try to use 64-bit integers when I get a round tuit.

MikeR
Look for OpenVMS help on my webpage
Check for QOTD here.
Image
User avatar
miker_alpha
Moderator
Moderator
 
Posts: 256
Joined: Sat May 08, 2004 9:20 am
Location: Kibbutz Tzora, Israel

Postby dillona_aix » Tue May 09, 2006 9:55 pm

Could you post or PM your code?
There are 10 types of people in this world, those who understand binary and those who don't.
User avatar
dillona_aix
Moderator
Moderator
 
Posts: 185
Joined: Sun Sep 11, 2005 9:05 pm
Location: USA

Postby zoli » Tue May 09, 2006 10:03 pm

Sure... MikeR is absolutelly right.

Fibonacci series is usually the first recursion example - but also it is the first example in advance coding in order to avoid unnecessary recursion :)

good luck Dillon.

BTW it is a definitive opinion to have just one AIX box (the 5.2 one) and nobody is interested in 4.3.3 any more?
Regards,
Z
---
Zoltan Arpadffy
zoli
Forum Admin
Forum Admin
 
Posts: 784
Joined: Mon Sep 30, 2002 1:27 am
Location: Stockholm, Sweden

Postby Matej » Wed May 10, 2006 12:03 am

zoli wrote:but also it is the first example in advance coding in order to avoid unnecessary recursion :)


Word. I was just playing around with recursion while programing a free fill (or color fill) function for a small image editor in java. Those things get huge resource demands really quickly and produce a stack overflow exception sooner or later (OR torch your computer if you're programing in evil c). ;)
User avatar
Matej
Forum Admin
Forum Admin
 
Posts: 365
Joined: Sun Sep 29, 2002 12:28 am
Location: Ljubljana, Slovenia

Postby miker_alpha » Wed May 10, 2006 1:00 pm

the following is Alpha-OpenVMS only.
It includes an ugly workaround to print QUAD (64-bit) numbers.
Code: Select all
1      declare integer quad f, f1, f2
        declare word i
        declare real double t1, t2

   f1 , f2 = 1
   t1 = time( 0% )
   for i = 3% to 92%
      f = f1 + f2
      f1 = f2
      f2 = f
   next i
   t2 = time( 0% )

   print "Fibbonacci("; i; ") ";
   print using "###,###,###,###,###,###,###",  &
             decimal( f,20,0 )
   print "seconds: "; (t2 - t1)
   end


MikeR
Look for OpenVMS help on my webpage
Check for QOTD here.
Image
User avatar
miker_alpha
Moderator
Moderator
 
Posts: 256
Joined: Sat May 08, 2004 9:20 am
Location: Kibbutz Tzora, Israel


Return to Computers

Who is online

Users browsing this forum: No registered users and 4 guests

cron