Skip to content

Commit 671816e

Browse files
cgcgcgeeprude
authored andcommitted
Zoltan2: Add performance tests
Signed-off-by: Christian Glusa <caglusa@sandia.gov>
1 parent 6cf15d6 commit 671816e

File tree

7 files changed

+273
-44
lines changed

7 files changed

+273
-44
lines changed

packages/zoltan2/test/core/driver/CMakeLists.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,34 @@ IF (${PROJECT_NAME}_ENABLE_Galeri)
185185
PASS_REGULAR_EXPRESSION "PASS"
186186
FAIL_REGULAR_EXPRESSION "FAIL"
187187
)
188+
189+
190+
TRIBITS_ADD_TEST(
191+
test_driver
192+
NAME PerformanceTest
193+
NUM_MPI_PROCS 4
194+
COMM mpi
195+
ARGS
196+
"./driverinputs/galeriTestsPerformance4.xml"
197+
PASS_REGULAR_EXPRESSION "PASS"
198+
FAIL_REGULAR_EXPRESSION "FAIL"
199+
RUN_SERIAL
200+
CATEGORIES PERFORMANCE
201+
)
202+
203+
TRIBITS_ADD_TEST(
204+
test_driver
205+
NAME PerformanceTest
206+
NUM_MPI_PROCS 16
207+
COMM mpi
208+
ARGS
209+
"./driverinputs/galeriTestsPerformance16.xml"
210+
PASS_REGULAR_EXPRESSION "PASS"
211+
FAIL_REGULAR_EXPRESSION "FAIL"
212+
RUN_SERIAL
213+
CATEGORIES PERFORMANCE
214+
)
215+
188216
ENDIF()
189217

190218
TRIBITS_ADD_TEST(

packages/zoltan2/test/core/driver/driverinputs/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ TRIBITS_COPY_FILES_TO_BINARY_DIR(copy_input_files_for_driver
3838
pamgenSphericalTest.xml
3939
pamgenPoissonTest.xml
4040
parmetisSubComm.xml
41-
galeriTest.xml
41+
galeriTest.xml
42+
galeriTestsPerformance4.xml
4243
simple.pmgen
4344
simplePamgen.xml
4445
simple3d.pmgen
@@ -56,5 +57,6 @@ TRIBITS_COPY_FILES_TO_BINARY_DIR(copy_input_files_for_driver
5657
zoltanGraphAdapterEwgt.xml
5758
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
5859
DEST_DIR ${CMAKE_CURRENT_BINARY_DIR}
60+
CATEGORIES BASIC PERFORMANCE
5961
)
6062

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<ParameterList name="testDriverExample">
2+
3+
<!-- 1. INPUT BLOCK DEFINITION -->
4+
5+
<ParameterList name="InputParameters">
6+
<Parameter name="debug" type="bool" value="false" />
7+
<Parameter name="x" type="int" value="480"/>
8+
<Parameter name="y" type="int" value="240"/>
9+
<Parameter name="z" type="int" value="240"/>
10+
<Parameter name="equation type" type="string" value="Laplace3D"/>
11+
</ParameterList>
12+
13+
<!-- 2. PROBLEM BLOCK DEFINITIONS -->
14+
15+
<ParameterList name="RCB">
16+
<Parameter name="kind" type="string" value="partitioning"/>
17+
18+
<ParameterList name="InputAdapterParameters">
19+
<Parameter name="data type" type="string" value="coordinates"/>
20+
<Parameter name="input adapter" type="string" value="XpetraMultiVector"/>
21+
</ParameterList>
22+
23+
<ParameterList name="Zoltan2Parameters">
24+
<Parameter name="timer_output_stream" type="string" value="std::cout"/>
25+
<Parameter name="algorithm" type="string" value="rcb" />
26+
<Parameter name="compute_metrics" type="bool" value="true"/>
27+
</ParameterList>
28+
29+
<ParameterList name="Metrics">
30+
<ParameterList name="metriccheck1">
31+
<Parameter name="check" type="string" value="imbalance"/>
32+
<Parameter name="lower" type="double" value="0.99"/>
33+
<Parameter name="upper" type="double" value="1.4"/>
34+
</ParameterList>
35+
</ParameterList>
36+
</ParameterList>
37+
38+
<ParameterList name="RIB">
39+
<Parameter name="kind" type="string" value="partitioning"/>
40+
41+
<ParameterList name="InputAdapterParameters">
42+
<Parameter name="data type" type="string" value="coordinates"/>
43+
<Parameter name="input adapter" type="string" value="XpetraMultiVector"/>
44+
</ParameterList>
45+
46+
<ParameterList name="Zoltan2Parameters">
47+
<Parameter name="timer_output_stream" type="string" value="std::cout"/>
48+
<Parameter name="algorithm" type="string" value="rib" />
49+
<Parameter name="compute_metrics" type="bool" value="true"/>
50+
</ParameterList>
51+
52+
<ParameterList name="Metrics">
53+
<ParameterList name="metriccheck1">
54+
<Parameter name="check" type="string" value="imbalance"/>
55+
<Parameter name="lower" type="double" value="0.99"/>
56+
<Parameter name="upper" type="double" value="1.4"/>
57+
</ParameterList>
58+
</ParameterList>
59+
</ParameterList>
60+
61+
<ParameterList name="Multijagged">
62+
<Parameter name="kind" type="string" value="partitioning"/>
63+
64+
<ParameterList name="InputAdapterParameters">
65+
<Parameter name="data type" type="string" value="coordinates"/>
66+
<Parameter name="input adapter" type="string" value="XpetraMultiVector"/>
67+
</ParameterList>
68+
69+
<ParameterList name="Zoltan2Parameters">
70+
<Parameter name="algorithm" type="string" value="multijagged"/>
71+
<Parameter name="rectilinear" type="bool" value="true"/>
72+
<Parameter name="compute_metrics" type="bool" value="true"/>
73+
</ParameterList>
74+
75+
<ParameterList name="Metrics">
76+
<ParameterList name="metriccheck1">
77+
<Parameter name="check" type="string" value="imbalance"/>
78+
<Parameter name="lower" type="double" value="0.99"/>
79+
<Parameter name="upper" type="double" value="1.4"/>
80+
</ParameterList>
81+
</ParameterList>
82+
</ParameterList>
83+
84+
</ParameterList>
85+
86+
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<ParameterList name="testDriverExample">
2+
3+
<!-- 1. INPUT BLOCK DEFINITION -->
4+
5+
<ParameterList name="InputParameters">
6+
<Parameter name="debug" type="bool" value="false" />
7+
<Parameter name="x" type="int" value="240"/>
8+
<Parameter name="y" type="int" value="240"/>
9+
<Parameter name="z" type="int" value="120"/>
10+
<Parameter name="equation type" type="string" value="Laplace3D"/>
11+
</ParameterList>
12+
13+
<!-- 2. PROBLEM BLOCK DEFINITIONS -->
14+
15+
<ParameterList name="RCB">
16+
<Parameter name="kind" type="string" value="partitioning"/>
17+
18+
<ParameterList name="InputAdapterParameters">
19+
<Parameter name="data type" type="string" value="coordinates"/>
20+
<Parameter name="input adapter" type="string" value="XpetraMultiVector"/>
21+
</ParameterList>
22+
23+
<ParameterList name="Zoltan2Parameters">
24+
<Parameter name="timer_output_stream" type="string" value="std::cout"/>
25+
<Parameter name="algorithm" type="string" value="rcb" />
26+
<Parameter name="compute_metrics" type="bool" value="true"/>
27+
</ParameterList>
28+
29+
<ParameterList name="Metrics">
30+
<ParameterList name="metriccheck1">
31+
<Parameter name="check" type="string" value="imbalance"/>
32+
<Parameter name="lower" type="double" value="0.99"/>
33+
<Parameter name="upper" type="double" value="1.4"/>
34+
</ParameterList>
35+
</ParameterList>
36+
</ParameterList>
37+
38+
<ParameterList name="RIB">
39+
<Parameter name="kind" type="string" value="partitioning"/>
40+
41+
<ParameterList name="InputAdapterParameters">
42+
<Parameter name="data type" type="string" value="coordinates"/>
43+
<Parameter name="input adapter" type="string" value="XpetraMultiVector"/>
44+
</ParameterList>
45+
46+
<ParameterList name="Zoltan2Parameters">
47+
<Parameter name="timer_output_stream" type="string" value="std::cout"/>
48+
<Parameter name="algorithm" type="string" value="rib" />
49+
<Parameter name="compute_metrics" type="bool" value="true"/>
50+
</ParameterList>
51+
52+
<ParameterList name="Metrics">
53+
<ParameterList name="metriccheck1">
54+
<Parameter name="check" type="string" value="imbalance"/>
55+
<Parameter name="lower" type="double" value="0.99"/>
56+
<Parameter name="upper" type="double" value="1.4"/>
57+
</ParameterList>
58+
</ParameterList>
59+
</ParameterList>
60+
61+
<ParameterList name="Multijagged">
62+
<Parameter name="kind" type="string" value="partitioning"/>
63+
64+
<ParameterList name="InputAdapterParameters">
65+
<Parameter name="data type" type="string" value="coordinates"/>
66+
<Parameter name="input adapter" type="string" value="XpetraMultiVector"/>
67+
</ParameterList>
68+
69+
<ParameterList name="Zoltan2Parameters">
70+
<Parameter name="algorithm" type="string" value="multijagged"/>
71+
<Parameter name="rectilinear" type="bool" value="true"/>
72+
<Parameter name="compute_metrics" type="bool" value="true"/>
73+
</ParameterList>
74+
75+
<ParameterList name="Metrics">
76+
<ParameterList name="metriccheck1">
77+
<Parameter name="check" type="string" value="imbalance"/>
78+
<Parameter name="lower" type="double" value="0.99"/>
79+
<Parameter name="upper" type="double" value="1.4"/>
80+
</ParameterList>
81+
</ParameterList>
82+
</ParameterList>
83+
84+
</ParameterList>
85+
86+

packages/zoltan2/test/core/driver/test_driver.cpp

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <Teuchos_DefaultComm.hpp>
3434
#include <Teuchos_XMLObject.hpp>
3535
#include <Teuchos_FileInputSource.hpp>
36+
#include <Teuchos_StackedTimer.hpp>
3637

3738
#include <sstream>
3839
#include <string>
@@ -226,25 +227,22 @@ bool run(const UserInputForTests &uinput,
226227
////////////////////////////////////////////////////////////
227228
// 0. add comparison source
228229
////////////////////////////////////////////////////////////
229-
RCP<ComparisonSource> comparison_source = rcp(new ComparisonSource);
230+
auto comparison_source = comparison_helper->AddSource(problem_parameters.name());
230231

231-
comparison_helper->AddSource(problem_parameters.name(), comparison_source);
232-
comparison_source->addTimer("adapter construction time");
233-
comparison_source->addTimer("problem construction time");
234-
comparison_source->addTimer("solve time");
232+
comparison_source->startBaseTimer();
235233

236234
////////////////////////////////////////////////////////////
237235
// 1. get basic input adapter
238236
////////////////////////////////////////////////////////////
239237
const ParameterList &adapterPlist =
240238
problem_parameters.sublist("InputAdapterParameters");
241-
comparison_source->timers["adapter construction time"]->start();
239+
comparison_source->startTimer("adapter construction time");
242240

243241
// a pointer to a basic type
244242
RCP<AdapterFactory> adapterFactory = rcp(new AdapterFactory(
245243
const_cast<UserInputForTests*>(&uinput), adapterPlist, comm));
246244

247-
comparison_source->timers["adapter construction time"]->stop();
245+
comparison_source->stopTimer("adapter construction time");
248246

249247
comparison_source->adapterFactory = adapterFactory; // saves until done
250248

@@ -260,7 +258,7 @@ bool run(const UserInputForTests &uinput,
260258
std::cout << std::endl;
261259
}
262260

263-
comparison_source->timers["problem construction time"]->start();
261+
comparison_source->startTimer("problem construction time");
264262
std::string problem_kind = problem_parameters.get<std::string>("kind");
265263
if (rank == 0) {
266264
std::cout << "Creating a new " << problem_kind << " problem." << std::endl;
@@ -279,16 +277,18 @@ bool run(const UserInputForTests &uinput,
279277
std::cout << "Using input adapter type: " + adapter_name << std::endl;
280278
}
281279

280+
comparison_source->stopTimer("problem construction time");
281+
282282
comparison_source->problemFactory = problemFactory; // saves until done
283283

284284
////////////////////////////////////////////////////////////
285285
// 3. Solve the problem
286286
////////////////////////////////////////////////////////////
287-
comparison_source->timers["solve time"]->start();
287+
comparison_source->startTimer("solve time");
288288

289289
problemFactory->getProblem()->solve();
290290

291-
comparison_source->timers["solve time"]->stop();
291+
comparison_source->stopTimer("solve time");
292292
if (rank == 0) {
293293
std::cout << problem_kind + " problem solved." << std::endl;
294294
}
@@ -410,7 +410,7 @@ bool run(const UserInputForTests &uinput,
410410
}
411411
#endif
412412

413-
comparison_source->printTimers();
413+
comparison_source->stopBaseTimer();
414414

415415
// write mesh solution
416416
// if(problem_kind == "partitioning") {
@@ -424,6 +424,8 @@ bool run(const UserInputForTests &uinput,
424424

425425
bool mainExecute(int narg, char *arg[], RCP<const Comm<int> > &comm)
426426
{
427+
Teuchos::RCP<Teuchos::StackedTimer> stacked_timer = Teuchos::rcp(new Teuchos::StackedTimer("Zoltan2_Driver"));;
428+
427429
////////////////////////////////////////////////////////////
428430
// (0) Set up MPI environment and timer
429431
////////////////////////////////////////////////////////////
@@ -484,7 +486,7 @@ bool mainExecute(int narg, char *arg[], RCP<const Comm<int> > &comm)
484486
// MyUtils::writeMesh(uinput,comm);
485487
// MyUtils::getConnectivityGraph(uinput, comm);
486488

487-
RCP<ComparisonHelper> comparison_manager = rcp(new ComparisonHelper);
489+
RCP<ComparisonHelper> comparison_manager = rcp(new ComparisonHelper(stacked_timer));
488490
while (!problems.empty()) {
489491
UserInputForTests uinput(inputParameters,comm);
490492

@@ -521,6 +523,15 @@ bool mainExecute(int narg, char *arg[], RCP<const Comm<int> > &comm)
521523
}
522524
}
523525

526+
stacked_timer->stopBaseTimer();
527+
Teuchos::StackedTimer::OutputOptions options;
528+
options.output_fraction = options.output_histogram = options.output_minmax = true;
529+
stacked_timer->report(std::cout, comm, options);
530+
std::string watchrProblemName = std::string("Zoltan2 test driver ") + std::to_string(comm->getSize()) + " ranks";
531+
auto xmlOut = stacked_timer->reportWatchrXML(watchrProblemName, comm);
532+
if (xmlOut.length())
533+
std::cout << "\nAlso created Watchr performance report " << xmlOut << '\n';
534+
524535
return bPass;
525536
}
526537

0 commit comments

Comments
 (0)