Newsgroups: comp.parallel.pvm
From: thomas@wein01.elektro.uni-wuppertal.de (thomas faerbinger)
Subject: static load balancing on DECs w. ULTRIX, a try
Organization: University of Wuppertal
Date: 26 Aug 1994 20:56:22 GMT
Message-ID: <33lktm$4rl@wmwap1.math.Uni-Wuppertal.DE>


Hi,

just tonight I tried the subject above,
spawning one slave on each host.
The load on all systems is quite stable,
at least at night, so I gave the following
function a try . It uses 'cpustat' and
is called by the slaves who pass the result to
the master:



int  get_speed( int speed )
{
   char   hostname[33], stat_command[33], stat_name[33];
   FILE   *stat_file;
   float  user, nice, sys, idle;

   sprintf( stat_name, "/tmp/%dcpu.stat", pvm_mytid() );
   sprintf( stat_command, "cpustat > %s\n", stat_name );
   system(stat_command);
   if( (stat_file = fopen(stat_name, "r")) != 0 )
   {  fscanf(stat_file, "[12 times '%*s'] %*d %f %f %f %f", &user, &nice, &sys, &idle );
      fclose(stat_file);
      unlink(stat_name);
      speed = speed * (100 - user - sys - 0.5 * nice )/100;  }

   return(speed);
}


It seems to work ~fine but maybe
someone's having an idea with this?
Maybe a better formula for the system-times?

I'd like PVM to spot the host's speed
more accurately, its the default 1000 for
both 5000/125 and 5000/260.
Does somebody know how ?(looks like a newbie question :-) )

Cheers and have a nice weekend first,
	Thomas


thomas@wein01.elektro.uni-wuppertal.de



"The Web seemed to be full of all manner of curious things, but the oddest
part of it was that, whenever Alice looked hard at any server, to make out
exactly what it had on it, that particular server was always quite empty,
though the others round it were crowded as full as they could hold."
- Lewis Carroll, 'Through the Looking Glass' (not literally)

