| 506 |
|
int nGlobalMols = info->getNGlobalMolecules(); |
| 507 |
|
std::vector<int> molToProcMap(nGlobalMols, -1); // default to an error condition: |
| 508 |
|
|
| 509 |
< |
MPI_Comm_size(MPI_COMM_WORLD, &nProcessors); |
| 509 |
> |
nProcessors = MPI::COMM_WORLD.Get_size(); |
| 510 |
|
|
| 511 |
|
if (nProcessors > nGlobalMols) { |
| 512 |
|
sprintf(painCave.errMsg, |
| 621 |
|
delete myRandom; |
| 622 |
|
|
| 623 |
|
// Spray out this nonsense to all other processors: |
| 624 |
< |
|
| 625 |
< |
MPI_Bcast(&molToProcMap[0], nGlobalMols, MPI_INT, 0, MPI_COMM_WORLD); |
| 624 |
> |
MPI::COMM_WORLD.Bcast(&molToProcMap[0], nGlobalMols, MPI::INT, 0); |
| 625 |
|
} else { |
| 626 |
|
|
| 627 |
|
// Listen to your marching orders from processor 0: |
| 628 |
< |
|
| 630 |
< |
MPI_Bcast(&molToProcMap[0], nGlobalMols, MPI_INT, 0, MPI_COMM_WORLD); |
| 628 |
> |
MPI::COMM_WORLD.Bcast(&molToProcMap[0], nGlobalMols, MPI::INT, 0); |
| 629 |
|
} |
| 630 |
|
|
| 631 |
|
info->setMolToProcMap(molToProcMap); |
| 849 |
|
// This would be prettier if we could use MPI_IN_PLACE like the MPI-2 |
| 850 |
|
// docs said we could. |
| 851 |
|
std::vector<int> tmpGroupMembership(info->getNGlobalAtoms(), 0); |
| 852 |
< |
MPI_Allreduce(&globalGroupMembership[0], &tmpGroupMembership[0], nGlobalAtoms, |
| 853 |
< |
MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
| 852 |
> |
MPI::COMM_WORLD.Allreduce(&globalGroupMembership[0], |
| 853 |
> |
&tmpGroupMembership[0], nGlobalAtoms, |
| 854 |
> |
MPI::INT, MPI::SUM); |
| 855 |
|
info->setGlobalGroupMembership(tmpGroupMembership); |
| 856 |
|
#else |
| 857 |
|
info->setGlobalGroupMembership(globalGroupMembership); |
| 868 |
|
|
| 869 |
|
#ifdef IS_MPI |
| 870 |
|
std::vector<int> tmpMolMembership(info->getNGlobalAtoms(), 0); |
| 871 |
+ |
MPI::COMM_WORLD.Allreduce(&globalMolMembership[0], &tmpMolMembership[0], |
| 872 |
+ |
nGlobalAtoms, |
| 873 |
+ |
MPI::INT, MPI::SUM); |
| 874 |
|
|
| 873 |
– |
MPI_Allreduce(&globalMolMembership[0], &tmpMolMembership[0], nGlobalAtoms, |
| 874 |
– |
MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
| 875 |
– |
|
| 875 |
|
info->setGlobalMolMembership(tmpMolMembership); |
| 876 |
|
#else |
| 877 |
|
info->setGlobalMolMembership(globalMolMembership); |
| 887 |
|
|
| 888 |
|
#ifdef IS_MPI |
| 889 |
|
std::vector<int> numIntegrableObjectsPerMol(info->getNGlobalMolecules(), 0); |
| 890 |
< |
MPI_Allreduce(&nIOPerMol[0], &numIntegrableObjectsPerMol[0], |
| 891 |
< |
info->getNGlobalMolecules(), MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
| 890 |
> |
MPI::COMM_WORLD.Allreduce(&nIOPerMol[0], &numIntegrableObjectsPerMol[0], |
| 891 |
> |
info->getNGlobalMolecules(), MPI::INT, MPI::SUM); |
| 892 |
|
#else |
| 893 |
|
std::vector<int> numIntegrableObjectsPerMol = nIOPerMol; |
| 894 |
|
#endif |