| 129 |
|
switch(D) { |
| 130 |
|
case Row : |
| 131 |
|
MPI_Comm_split(MPI_COMM_WORLD, rowIndex_, 0, &myComm); |
| 132 |
– |
// myComm = MPI::COMM_WORLD.Split(rowIndex_, 0); |
| 132 |
|
break; |
| 133 |
|
case Column: |
| 134 |
|
MPI_Comm_split(MPI_COMM_WORLD, columnIndex_, 0, &myComm); |
| 136 |
– |
//myComm = MPI::COMM_WORLD.Split(columnIndex_, 0); |
| 135 |
|
break; |
| 136 |
|
case Global: |
| 137 |
|
MPI_Comm_split(MPI_COMM_WORLD, myRank, 0, &myComm); |
| 140 |
– |
//myComm = MPI::COMM_WORLD.Split(myRank, 0); |
| 138 |
|
} |
| 139 |
|
|
| 140 |
|
} |
| 156 |
|
|
| 157 |
|
int nCommProcs; |
| 158 |
|
MPI_Comm_size( myComm, &nCommProcs ); |
| 162 |
– |
|
| 163 |
– |
//int nCommProcs = myComm.Get_size(); |
| 159 |
|
|
| 160 |
|
counts.resize(nCommProcs, 0); |
| 161 |
|
displacements.resize(nCommProcs, 0); |
| 163 |
|
planSize_ = MPITraits<T>::Length() * nObjects; |
| 164 |
|
|
| 165 |
|
MPI_Allgather(&planSize_, 1, MPI_INT, &counts[0], 1, MPI_INT, myComm); |
| 171 |
– |
//myComm.Allgather(&planSize_, 1, MPI_INT, &counts[0], 1, MPI_INT); |
| 166 |
|
|
| 167 |
|
displacements[0] = 0; |
| 168 |
|
for (int i = 1; i < nCommProcs; i++) { |
| 189 |
|
&displacements[0], |
| 190 |
|
MPITraits<T>::Type(), |
| 191 |
|
myComm); |
| 198 |
– |
// myComm.Allgatherv(&v1[0], |
| 199 |
– |
// planSize_, |
| 200 |
– |
// MPITraits<T>::Type(), |
| 201 |
– |
// &v2[0], |
| 202 |
– |
// &counts[0], |
| 203 |
– |
// &displacements[0], |
| 204 |
– |
// MPITraits<T>::Type()); |
| 192 |
|
} |
| 193 |
|
|
| 194 |
|
void scatter(vector<T>& v1, vector<T>& v2) { |
| 197 |
|
|
| 198 |
|
MPI_Reduce_scatter(&v1[0], &v2[0], &counts[0], |
| 199 |
|
MPITraits<T>::Type(), MPI_SUM, myComm); |
| 213 |
– |
|
| 214 |
– |
// myComm.Reduce_scatter(&v1[0], &v2[0], &counts[0], |
| 215 |
– |
// MPITraits<T>::Type(), MPI::SUM); |
| 200 |
|
} |
| 201 |
|
|
| 202 |
|
int getSize() { |