[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

MPICH 1.2 performance

I wrote a simple program to find out the messages / sec that MPICH could
I used the deb of 1.2 as was posted on this list some time back.
I attach the program hereby.
What was surprising is that I got only around 100 messages / sec where each
message is about 350 bytes send, 350 bytes recv.
LAM gave me something like 2000.

I have compiled MPI myself and run the program, but its given the same
results, 100 messages/sec.
However, if i compile with -mpilog, i see 166 messages/sec, which i thought
was weird behaviour. All this was replicable. 

I might be doing something stupid, probably i am missing something obvious..


I am just a figment of my own imagination !
#include <unistd.h>
#include <stdio.h>
#include <string.h>

#include <stdlib.h>
#include <sys/time.h>
#include <mpi/mpi.h>

#define TOTAL_AMOUNT 50000

int main(int argc, char* argv[])
  int my_rank;
  int proc;
  int count = 0;
  char mesg[500] = "Hello World";
  time_t tmend, tmstart;
  MPI_Status status;

  MPI_Init(&argc, &argv);
  MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
  MPI_Comm_size(MPI_COMM_WORLD, &proc);

  if (my_rank == 0) {

    MPI_Barrier (MPI_COMM_WORLD);

     while (count != TOTAL_AMOUNT) {
	MPI_Send(mesg, 350, MPI_CHAR, 1, 1, MPI_COMM_WORLD);
	MPI_Recv(mesg, 350, MPI_CHAR, 1, 1, MPI_COMM_WORLD, &status);


    printf("%d packets transmitted to and fro in %ld seconds\n",
	   TOTAL_AMOUNT, (int)tmend - tmstart);
    printf("No. of packets per second: %ld\n",
	   TOTAL_AMOUNT / (tmend - tmstart));

  else if (my_rank == 1) {
     MPI_Barrier (MPI_COMM_WORLD);

    while (count != TOTAL_AMOUNT) {
       MPI_Recv(mesg, 350, MPI_CHAR, 0, 1, MPI_COMM_WORLD, &status);
       MPI_Send(mesg, 350, MPI_CHAR, 0, 1, MPI_COMM_WORLD);

  return 0;

Reply to: