69 counts =
new int[commSize];
70 displs =
new int[commSize];
71 for(
int i = 0; i < commSize; ++i) {
107 for(
int i = 0; i < ranks; ++i) {
108 totalSize += counts[i];
123 int* displs =
new int[ranks];
126 for(
int i = 1; i < ranks; ++i) {
127 displs[i] = counts[i - 1] + displs[i - 1];
145 displsOut =
new int[ranks];
146 countsOut =
new int[ranks];
148 countsOut[0] = counts[0] * scale;
150 for(
int i = 1; i < ranks; ++i) {
151 countsOut[i] = counts[i] * scale;
152 displsOut[i] = countsOut[i - 1] + displsOut[i - 1];
169 template<
typename Datatype>
171 linearCounts =
new int[ranks];
173 linearCounts[0] = type->computeActiveElements(displs[0] + counts[0]);
174 int lastSum = linearCounts[0];
175 for(
int i = 1; i < ranks; ++i) {
176 int curSum = type->computeActiveElements(displs[i] + counts[i]);
177 linearCounts[i] = curSum - lastSum;
Global namespace for MeDiPack - Message Differentiation Package.
Definition adjointInterface.hpp:37
int computeDisplacementsTotalSize(const int *counts, int ranks)
Compute the total size of a message that has a different size on each rank.
Definition displacementTools.hpp:105
int * createLinearDisplacements(const int *counts, int ranks)
Creates the linearized displacements of a message with a different size on each rank.
Definition displacementTools.hpp:122
void createLinearDisplacementsAndCount(int *&countsOut, int *&displsOut, const int *counts, int ranks, int scale)
Creates the linearized displacements of a message with a different size on each rank.
Definition displacementTools.hpp:144
void createLinearIndexCounts(int *&linearCounts, const int *counts, const int *displs, int ranks, Datatype *type)
Creates the counts for a message with a different size on each rank.
Definition displacementTools.hpp:170
Helper structure for the easy creation of a linear displacement with a the same length.
Definition displacementTools.hpp:43
int * displs
The array with the displacements.
Definition displacementTools.hpp:48
int * counts
The array with the counts.
Definition displacementTools.hpp:53
LinearDisplacements(int commSize, int length)
Create displacemnts where each displacement has the size length.
Definition displacementTools.hpp:68
~LinearDisplacements()
Destroy the structure.
Definition displacementTools.hpp:80
static void deleteFunc(void *d)
Helper function for deleting a LinearDisplacements structure.
Definition displacementTools.hpp:90