我收到 MPI_Bcast 错误(我认为这是一个旧错误)我不确定为什么会发生这种情况。错误如下:
An error occurred in MPI_Bcast
on communicator MPI_COMM_WORLD
MPI_ERR_TRUNCATE: message truncated
MPI_ERRORS_ARE_FATAL: your MPI job will now abort
它发生的代码是:
for (int i = 0; i < nbProcs; i++){
for (int j = firstLocalGrainRegion; j < lastLocalGrainRegion; j++){
GrainRegion * grainRegion = microstructure->getGrainRegionAt(j);
int grainSize = grainRegion->getBoxSize(nb);
double * newValues;
if (myId == i)
newValues = grainRegion->getNewValues();
else
newValues = new double[grainSize];
MPI_Bcast(newValues, grainSize, MPI_DOUBLE, i, MPI_COMM_WORLD);
MPI_Barrier(MPI_COMM_WORLD);
if (myId != i)
grainRegion->setNewValues(newValues);
}
}