I have two blocks of code which consume 2 seconds each, In a classic structure they run sequentially, in 4 seconds
In mpi format, it supposed to consume 2 seconds but it takes 5 seconds
WHY?
int main ( int argc, char *argv[] )
{
MPI_Init( &argc, &argv );
MPI_Comm_size(MPI_COMM_WORLD,&p );
MPI_Comm_rank(MPI_COMM_WORLD,&id);
if(id==0)
{
// 2 seconds Block
}
if(id==1)
{
// 2 seconds Block
}
MPI_Finalize();
}
sleep(2)as the blocks, for instance, you'll find the program runs in just a few tens of milliseconds longer than 2s.