MCPcopy Create free account
hub / github.com/NVIDIA/DALI / RunCPU

Method RunCPU

dali/benchmark/slice_kernel_bench.cc:43–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41 }
42
43 void RunCPU(benchmark::State& st) {
44 int H = st.range(0);
45 int W = st.range(1);
46 int C = st.range(2);
47 int anchor_h = st.range(3);
48 int anchor_w = st.range(4);
49 int anchor_c = st.range(5);
50 int crop_h = st.range(6);
51 int crop_w = st.range(7);
52 int crop_c = st.range(8);
53
54 TensorShape<Dims> in_shape{H, W, C};
55 TensorShape<Dims> anchor{anchor_h, anchor_w, anchor_c};
56 TensorShape<Dims> out_shape{crop_h, crop_w, crop_c};
57 Setup(in_shape, out_shape);
58
59 using Kernel = kernels::SliceCPU<OutputType, InputType, Dims>;
60 Kernel kernel;
61
62 kernels::SliceArgs<OutputType, Dims> args;
63 args.anchor = anchor;
64 args.shape = out_shape;
65
66 auto out_tv = out_data.cpu()[0];
67 auto in_tv = test_data.cpu()[0];
68
69 for (auto _ : st) {
70 kernels::KernelContext ctx;
71 auto kernel_req = kernel.Setup(ctx, in_tv, args);
72 kernel.Run(ctx, out_tv, in_tv, args);
73 st.counters["FPS"] = benchmark::Counter(st.iterations() + 1,
74 benchmark::Counter::kIsRate);
75 }
76 }
77};
78
79static void SliceKernelArgs_OnlySlice_CPU(benchmark::Benchmark *b) {

Calls 4

SetupFunction · 0.50
cpuMethod · 0.45
SetupMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected