Skip to content

Commit 113d24e

Browse files
committed
add communication performance tests for SoA types
1 parent 9fe2f5f commit 113d24e

File tree

2 files changed

+48
-16
lines changed

2 files changed

+48
-16
lines changed

src/testbed/parallelperformancetests/main.cpp

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ template<typename CELL_TYPE>
2424
class CollectingWriterPerfTest : public CPUBenchmark
2525
{
2626
public:
27-
explicit CollectingWriterPerfTest(const std::string& modelName) :
28-
modelName(modelName)
27+
explicit CollectingWriterPerfTest(const std::string& modelName, const std::string& speciesName) :
28+
modelName(modelName),
29+
speciesName(speciesName)
2930
{}
3031

3132
std::string family()
@@ -34,7 +35,7 @@ class CollectingWriterPerfTest : public CPUBenchmark
3435
}
3536
std::string species()
3637
{
37-
return "gold";
38+
return speciesName;
3839
}
3940

4041
double performance(std::vector<int> rawDim)
@@ -73,7 +74,6 @@ class CollectingWriterPerfTest : public CPUBenchmark
7374
}
7475
}
7576

76-
// fixme: add test for cell with SoA
7777
return gigaBytesPerSecond(dim, seconds);
7878
}
7979

@@ -84,6 +84,7 @@ class CollectingWriterPerfTest : public CPUBenchmark
8484

8585
private:
8686
std::string modelName;
87+
std::string speciesName;
8788

8889
double gigaBytesPerSecond(const Coord<3>& dim, double seconds)
8990
{
@@ -101,8 +102,9 @@ template<typename CELL_TYPE>
101102
class PatchLinkPerfTest : public CPUBenchmark
102103
{
103104
public:
104-
explicit PatchLinkPerfTest(const std::string& modelName) :
105-
modelName(modelName)
105+
explicit PatchLinkPerfTest(const std::string& modelName, const std::string& speciesName) :
106+
modelName(modelName),
107+
speciesName(speciesName)
106108
{}
107109

108110
std::string family()
@@ -112,7 +114,7 @@ class PatchLinkPerfTest : public CPUBenchmark
112114

113115
std::string species()
114116
{
115-
return "gold";
117+
return speciesName;
116118
}
117119

118120
double performance(std::vector<int> rawDim)
@@ -139,7 +141,7 @@ class PatchLinkPerfTest : public CPUBenchmark
139141
transmissionRegion,
140142
1,
141143
666,
142-
APITraits::SelectMPIDataType<CELL_TYPE>::value());
144+
SerializationBuffer<CELL_TYPE>::cellMPIDataType());
143145
provider.charge(1234, maxNanoStep, 1000);
144146

145147
{
@@ -155,15 +157,14 @@ class PatchLinkPerfTest : public CPUBenchmark
155157
transmissionRegion,
156158
0,
157159
666,
158-
APITraits::SelectMPIDataType<CELL_TYPE>::value());
160+
SerializationBuffer<CELL_TYPE>::cellMPIDataType());
159161
accepter.charge(1234, maxNanoStep, 1000);
160162

161163
for (int i = 1234; i <= maxNanoStep; i += 1000) {
162164
accepter.put(grid, wholeGridRegion, dim, i, 0);
163165
}
164166
}
165167

166-
// fixme: add test for cell with SoA
167168
return gigaBytesPerSecond(transmissionBox.dimensions, repeats, seconds);
168169
}
169170

@@ -174,6 +175,7 @@ class PatchLinkPerfTest : public CPUBenchmark
174175

175176
private:
176177
std::string modelName;
178+
std::string speciesName;
177179

178180
double gigaBytesPerSecond(const Coord<3>& dim, int repeats, double seconds)
179181
{
@@ -294,12 +296,25 @@ int main(int argc, char **argv)
294296
eval.print_header();
295297
}
296298

297-
eval(CollectingWriterPerfTest<MySimpleCell>("MySimpleCell"), toVector(Coord<3>::diagonal(256)), output);
298-
eval(CollectingWriterPerfTest<TestCell<3> >("TestCell<3> "), toVector(Coord<3>::diagonal(64)), output);
299-
eval(PatchLinkPerfTest<MySimpleCell>("MySimpleCell"), toVector(Coord<3>::diagonal(200)), output);
300-
eval(PatchLinkPerfTest<TestCell<3> >("TestCell<3> "), toVector(Coord<3>::diagonal(64)), output);
301-
eval(PartitionManagerBig3DPerfTest<RecursiveBisectionPartition<3> >("RecursiveBisection"), toVector(Coord<3>::diagonal(100)), output);
302-
eval(PartitionManagerBig3DPerfTest<ZCurvePartition<3> >("ZCurve"), toVector(Coord<3>::diagonal(100)), output);
299+
std::vector<int> diag64 = toVector(Coord<3>::diagonal(64));
300+
std::vector<int> diag100 = toVector(Coord<3>::diagonal(100));
301+
std::vector<int> diag200 = toVector(Coord<3>::diagonal(200));
302+
std::vector<int> diag256 = toVector(Coord<3>::diagonal(256));
303+
304+
eval(CollectingWriterPerfTest<MySimpleCell>("MySimpleCell", "gold"), diag256, output);
305+
eval(CollectingWriterPerfTest<MySimpleCellSoA>("MySimpleCell", "platinum"), diag256, output);
306+
307+
eval(CollectingWriterPerfTest<TestCell<3> >("TestCell<3> ", "gold"), diag64, output);
308+
eval(CollectingWriterPerfTest<TestCellSoA>( "TestCell<3> ", "platinum"), diag64, output);
309+
310+
eval(PatchLinkPerfTest<MySimpleCell>("MySimpleCell", "gold"), diag200, output);
311+
eval(PatchLinkPerfTest<MySimpleCellSoA>("MySimpleCell", "platinum"), diag200, output);
312+
313+
eval(PatchLinkPerfTest<TestCell<3> >("TestCell<3> ", "gold"), diag64, output);
314+
eval(PatchLinkPerfTest<TestCellSoA>( "TestCell<3> ", "platinum"), diag64, output);
315+
316+
eval(PartitionManagerBig3DPerfTest<RecursiveBisectionPartition<3> >("RecursiveBisection"), diag100, output);
317+
eval(PartitionManagerBig3DPerfTest<ZCurvePartition<3> >("ZCurve"), diag100, output);
303318

304319
MPI_Finalize();
305320
return 0;

src/testbed/parallelperformancetests/mysimplecell.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,23 @@ class MySimpleCell
2020
double temp;
2121
};
2222

23+
/**
24+
* Variant of MySimpleCell, but with a registered Struct of Arrays
25+
* (SoA) memory layout.
26+
*/
27+
class MySimpleCellSoA : public MySimpleCell
28+
{
29+
public:
30+
class API :
31+
public MySimpleCell::API,
32+
public APITraits::HasSoA
33+
{};
34+
};
35+
2336
}
2437

38+
LIBFLATARRAY_REGISTER_SOA(
39+
LibGeoDecomp::MySimpleCellSoA,
40+
((double)(temp)))
41+
2542
#endif

0 commit comments

Comments
 (0)