File: benchLoadNeeded.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 (49 lines) | stat: -rw-r--r-- 1,781 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
45
46
47
48
49
#ifndef _TASMANIAN_BENCHMARK_LOADNEEDED_HPP
#define _TASMANIAN_BENCHMARK_LOADNEEDED_HPP

#include "benchCommon.hpp"

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

    // report the test parameters to reference later
    cout << "loadneeded";
    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, num_jumps, device;
    TypeDepth dtype;
    TypeOneDRule rule;
    TypeAcceleration acc;

    auto riter = readEntries(args.begin(), num_dimensions, num_outputs, num_depth, dtype, rule, order, iteratons, num_jumps, 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);

    for(int jump = 0; jump < num_jumps; jump++){
        auto grid = make_grid();
        //grid.printStats(); // uncomment to make sure the right grid is constructed

        if (jump == 0) cout << " (points: " << grid.getNumPoints() << ")" << endl;
        grid.enableAcceleration(acc, device);
        if (flavor != "auto")
            grid.favorSparseAcceleration((flavor == "sparse"));

        auto values = getGenericModel((size_t) grid.getNumDimensions(),
                                      (size_t) grid.getNumOutputs(),
                                      grid.getNeededPoints());

        cout << setw(7) << testMethod<DryRun>(iteratons, [&](int)->void{ grid.loadNeededPoints(values); }) << endl;
        num_outputs *= 2;
    }

    return true;
}

#endif