Question

i have been trying to test network performance, but have a question

static public void main(String[] args) 
{
    MPI.Init(args);
    int myrank = MPI.COMM_WORLD.Rank();
    int tag = 99;
    int maxlen = 104857600; 
    int minlen = 1; //1kb ?
    char [] sendbuff = new char [maxlen];
    char [] recvbuff = new char [maxlen];
    long speedKbps;
    long speedMbps;
    if (myrank == 0) 
    {
        for (int len = minlen; len <= maxlen; len *= 2) 
        { //len=*2 doubles the ping size each time
            long startTime = System.nanoTime();                  
            MPI.COMM_WORLD.Send(sendbuff, 0, len, MPI.CHAR, 1, tag);
            MPI.COMM_WORLD.Recv(recvbuff, 0, len, MPI.CHAR, 1, tag);
            long endTime = System.nanoTime();
            long duration = endTime - startTime;
            System.out.println("Time for the ping to be sent and recived of " + len + " kb is " + duration + " nanoseconds");
            double transferRate = (len/ duration ) ; //amount of data in kilobytes transferred in 1 second
            System.out.println("transferRate: " + transferRate + "KB per second");
        }
    }
}

The minlen = 1, what size is this, is it 1 KB, 1 bit, 1 byte?

Thanks

Was it helpful?

Solution 2

Since you're sending items from a character array, len in each iteration of the loop is the number of characters to send. So the size of minlen=1 is the size of 1 character, which in Java is 2 bytes.

Source for the size of a Java char

OTHER TIPS

As your send buffer used char as data type it's byte.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top