创建新组后,最低等级ID为零。如何保留处理器的原始等级?
#include <boost/mpi.hpp>
namespace bmpi = boost::mpi;
int main()
{
MPI_Init(NULL, NULL);
bmpi::communicator comm;
bmpi::group group = comm.group();
std::vector<int> to_be_excluded = {0};
group = group.exclude(to_be_excluded.begin(), to_be_excluded.end());
comm = bmpi::communicator(comm, group);
if (comm) {
std::cout << comm.rank() << std::endl; // want this to be original rank which is 1 not zero.
}
MPI_Finalize();
return 0;
}