File: benchMakeGrid.hpp

package info (click to toggle)
tasmanian 8.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,852 kB
  • sloc: cpp: 34,523; python: 7,039; f90: 5,080; makefile: 224; sh: 64; ansic: 8
file content (44 lines) | stat: -rw-r--r-- 1,445 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef _TASMANIAN_BENCHMARK_MAKEGRID_HPP
#define _TASMANIAN_BENCHMARK_MAKEGRID_HPP

#include "benchCommon.hpp"

bool benchmark_makegrid(std::deque<std::string> &args){
    if (args.size() < 7) return false;

    // report the test parameters to reference later
    cout << "makegrid";
    for(auto &s : args) cout << " " << s;
    cout << endl;

    auto grid_family = getGridFamily(args);
    if (grid_family == GridFamily::none) return false;

    int num_dimensions, num_depth, iteratons, num_jumps;
    TypeDepth dtype;
    TypeOneDRule rule;

    auto riter = readEntries(args.begin(), num_dimensions, num_depth, dtype, rule, iteratons, num_jumps);

    auto extra = extractWeightsLimits(grid_family, num_dimensions, dtype, riter, args.end());

    int num_outputs = 1, order = 1;
    auto make_grid = getLambdaMakeGrid(grid_family, num_dimensions, num_outputs, num_depth, dtype, rule, order, extra);

    num_jumps = std::max(num_jumps, 1); // make at least one test

    cout << setw(12) << "num points" << setw(12) << "miliseconds" << endl;
    for(int jump = 0; jump < num_jumps; jump++){
        auto grid = make_grid();
        //grid.printStats(); // uncomment to make sure the right grid is constructed

        cout << setw(12) << grid.getNumPoints() << setw(12)
             << testMethod(iteratons, [&](int)->void{ auto grid_temp = make_grid(); })
             << endl;
        num_depth += 1;
    }

    return true;
}

#endif