-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #758 from mkstoyanov/add_refine_benchmark
added benchamrk to test refinement
- Loading branch information
Showing
5 changed files
with
100 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#ifndef _TASMANIAN_BENCHMARK_REFINE_HPP | ||
#define _TASMANIAN_BENCHMARK_REFINE_HPP | ||
|
||
#include "benchCommon.hpp" | ||
|
||
bool benchmark_refine(std::deque<std::string> &args){ | ||
if (args.size() < 15) return false; | ||
|
||
// report the test parameters to reference later | ||
cout << "refine"; | ||
for(auto &s : args) cout << " " << s; | ||
|
||
auto grid_family = getGridFamily(args); | ||
if (grid_family == GridFamily::none) return false; | ||
|
||
int num_dimensions, num_outputs, num_depth, order, iteratons; | ||
TypeDepth dtype; | ||
TypeOneDRule rule; | ||
TypeAcceleration acc; | ||
int device; | ||
|
||
TypeDepth ref_aniso_type; | ||
int aniso_min_growth; | ||
double surp_tolerance; | ||
TypeRefinement surp_criteria; | ||
int output; | ||
|
||
auto riter = readEntries(args.begin(), num_dimensions, num_outputs, num_depth, dtype, rule, order, | ||
ref_aniso_type, aniso_min_growth, surp_tolerance, surp_criteria, output, iteratons, acc, device); | ||
|
||
std::string flavor = checkFlavor(riter, args.end()); | ||
|
||
auto extra = extractWeightsLimits(grid_family, num_dimensions, dtype, riter, args.end()); | ||
|
||
auto make_grid = getLambdaMakeGrid(grid_family, num_dimensions, num_outputs, num_depth, dtype, rule, order, extra); | ||
|
||
auto grid = make_grid(); | ||
cout << " (points: " << grid.getNumPoints() << ")\n"; | ||
loadGenericModel(grid); | ||
|
||
grid.enableAcceleration(acc, device); | ||
if (flavor != "auto") | ||
grid.favorSparseAcceleration((flavor == "sparse")); | ||
|
||
auto test_lambda = [&](int)->void{ | ||
if (aniso_min_growth < 1) { | ||
grid.setSurplusRefinement(surp_tolerance, surp_criteria, output); | ||
} else { | ||
grid.setAnisotropicRefinement(ref_aniso_type, aniso_min_growth, output); | ||
} | ||
}; | ||
|
||
// make one dry-run | ||
cout << setw(7) << testMethod<DryRun>(iteratons, test_lambda) << endl; | ||
|
||
return true; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters