I wrote MPI_Gather(&localSorted, 1, MPI_CXX_BOOL, &localSorteds, 1, MPI_CXX_BOOL, MASTER, MPI_COMM_WORLD);,
where
localSorteds = (bool*)malloc(numtasks*sizeof(bool)) and localSorted is simply a bool in each process.
However, it seems that MPI_Gather just messed up localSorteds. For example, before MPI_Gather I have task0:false and task1:false, but after Gather, localSorteds[0] can sometimes become true. What might lead to this problem? Is there any possible fix?
I'm trying to gather bools from processes.
I wrote
MPI_Gather(&localSorted, 1, MPI_CXX_BOOL, &localSorteds, 1, MPI_CXX_BOOL, MASTER, MPI_COMM_WORLD);
, wherelocalSorteds = (bool*)malloc(numtasks*sizeof(bool))
andlocalSorted
is simply a bool in each process.However, it seems that MPI_Gather just messed up localSorteds. For example, before MPI_Gather I have
task0:false
andtask1:false
, but after Gather,localSorteds[0]
can sometimes becometrue
. What might lead to this problem? Is there any possible fix?