[mpich-discuss] Hydra issues

Scott Atchley atchley at myri.com
Fri Aug 28 14:46:25 CDT 2009


On Aug 28, 2009, at 2:53 PM, Scott Atchley wrote:

> I tried your test app again and it starts immediately without NO_MPI  
> set and is delayed when NO-MPI=1; the exact opposite of the above. I  
> tested IMB 2.3 and it too is delayed.


I modified your test app (see below). I eliminated the sleep() and  
replaced it with busy work. I print it out at the end to avoid the  
compiler removing the code (my gcc did).

If I run it with -n 4 over two nodes, I see the output from the local  
host in real time (and interleaved). The other two ranks' output does  
not appear until the end of the run and the output is serialized.

Scott

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

int main(int argc, char *argv[])
{
    int i, use_mpi = 0, rank = -1;
    long sum = 0L;

    use_mpi = (!(getenv("NO_MPI"))) ? 1 : 0;

    if (use_mpi) {
        MPI_Init(&argc, &argv);
        MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    }

    for (i = 0; i < 20; i++) {
        int j;

        if (use_mpi)
            MPI_Barrier(MPI_COMM_WORLD);

        printf("%d: Hello World!\n", rank);
        for (j = 0; j < 10000000; j++) {
	       sum += j;
	       if (j > 0) sum /= j;
        }
    }

    if (use_mpi) {
        MPI_Barrier(MPI_COMM_WORLD);
        MPI_Finalize();
    }
    printf("%ld\n", sum);

    return 0;
}


More information about the mpich-discuss mailing list