Closed Ross-Li closed 1 year ago
Hi @Ross-Li,
on the MPI process whose rank equals root_rank
, the variable my_value
is not used in the MPI_Scatter
. The value scattered by the root MPI process to itself is 90 based on your example.
This example may come across as confusing, if you were to state its main objective, how would you describe it?
Note: do not replace integers with NULL
, semantically you are mixing integral values and a constant representing the bottom value for addresses. The fact that NULL
translates to 0 should not encourage you to use it in other contexts than addresses. This is one of the reason that led to the implementation of nullptr
in C++ for instance.
You do have a point, the objective of this program is not clear enough. This is a attempt of me trying to do something, but this program doesn't manifest nor achieve my goal. I finally achieved what I was trying to do with MPI_Scatterv()
and it is a bit different from the example code you have about MPI_Scatterv()
and I am considering whether to submitting another issue about it.
About do not replace integer with NULL
, thanks for the advice! I won't do that in actual code though, I was just noting what is going to happen if I do so.
There already exists a program using
MPI_IN_PLACE
in gathering. I would like to add a program utilizingMPI_IN_PLACE
in scattering:A sample print result is: