You are here: Foswiki>Main/Cimec Web>NetTest (18 Apr 2002, MarioStorti)Edit Attach
The code is here and can be downloaded from the link below also.

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 

double etime(timeval &x,timeval &y) {
  return double(y.tv_sec)-double(x.tv_sec)
	 +(double(y.tv_usec)-double(x.tv_usec))/1e6;
}

/** Computes random numbers between 0 and 1
*/ 
double drand() {  
  return ((double)(rand()))/((double)(RAND_MAX));
}

/** Computes an intger random number in the
	 range `imin'-`imax'
*/ 
int irand(int imin,int imax) {
  return int(rint(drand()*double(imax-imin+1)-0.5))+imin;
}

//#define CHECK

int main(int argc,char **argv) {

  int size,rank,p1=0,p2=1;
  int chunk_size=1000,ntimes=10;
  double tol=1e-10,sum_check;

  MPI_Status stat;
  
  /// time related quantities
  struct timeval start, end;

  /// Initializes MPI
  PetscInitialize(&argc,&argv,NULL,NULL);
  /// Initializes random
  srand(time (0));

  MPI_Comm_size(MPI_COMM_WORLD,&size);
  MPI_Comm_rank(MPI_COMM_WORLD,&rank);

  while (chunk_size>1) {
  
	 PetscPrintf(MPI_COMM_WORLD,
		"Results for chunk_size = %d double, (%d bytes, %d bits) ----------\n",
		chunk_size,chunk_size*8,chunk_size*64);
	 double *buff = new double[chunk_size];
	 for (int j=0; j proc %d connection bandwidth: %g Mbit/sec\n",p1,p2,speed);
	}
		}
	 }
	 delete[] buff;
	 chunk_size /= 10;
	 ntimes *= 10;
  }

  PetscFinalize();
  exit(0);

}

-- MarioStorti - 18 Apr 2002
Topic attachments
I Attachment Action Size Date Who Comment
nettest.cppcpp nettest.cpp manage 2 K 18 Apr 2002 - 21:28 UnknownUser Tests communication between a set of processors
Topic revision: r1 - 18 Apr 2002, MarioStorti
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback