Can MPI_Bcast correctly while using multiple threads?

Viewed 32

When I use the MPI, there are multiple threads doing MPI_Bcast. Like

#pragma omp parallel for
for(int i = 0; i < k; i++)
{
  MPI_Bcast(&a[i], 1, MPI_INT32_T, TargetRank, MPI_COMM_WORLD);
}

If the data size and type are the same, it seems they will broadcast to the wrong places. How could I fix it? (Now I use a my_bcast with Tag) Problem Schematic

0 Answers
Related