Hi all,
I'm running openmpi-1.2.6, and my computer is connected to a Ethernet network. 
I have no experience in setting up a network that supports parallel computing 
using MPI before, nor do I know much about networking. So please excuse me if 
my questions seem too simple or silly.

What I simply did was install the Open MPI package on my computer, and executed 
the following simple code to test if I can successfully run MPI programs:

#include <stdio.h>
#include <mpi.h>

int main(int argc, char** argv)
{
    int rank, size, i = 1, j, total = 1, total2;
    MPI_Status status;
    MPI_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);
    printf("Hello... %d of %d processors\n", rank, size);
    if (rank != 0)
        MPI_Send(&i, 1, MPI_INT, 0, 1, MPI_COMM_WORLD);
    else
    {
        for (j = 1 ; j < size ; j++)
        {
            MPI_Recv(&i, 1, MPI_INT, j, 1, MPI_COMM_WORLD, &status);
            total += i;
        }
        printf("%d Calculated total: %d\n", rank, total);
    }
    MPI_Reduce(&i, &total2, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
    if (!rank)
        printf("%d Reduced total: %d\n", rank, total2);
    MPI_Finalize();
    return 0;
}

I got the correct output, i.e.

Hello... 0 of 3 processors
Hello... 1 of 3 processors
Hello... 2 of 3 processors
0 Calculated total: 3
0 Reduced total: 3

together with the warning message about OpenIB and UDAPL, which after some 
Googling, I was able to resolve using "-mca btl ^openib,udapl".

I was trying to see if my MPI program is really running on the Ethernet 
network, so I deactivated the network, but the program still works. Then I 
unplugged the network cable and still the program works. Then I ran Wireshark, 
which is a kind of packet sniffer program, and ran the MPI program again to see 
if the Send/Receive functions work right, as I thought if the program is 
sending/receiving the variable i, something should show up in Wireshark. 
However, no packets are captured by Wireshark.

Can someone help me understand what is going on here, as it seems like the 
program is working when it shouldn't?

Thank you.

Regards,
Rayne


      New Email addresses available on Yahoo!
Get the Email name you&#39;ve always wanted on the new @ymail and @rocketmail. 
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/sg/

Reply via email to