MCPcopy Create free account
hub / github.com/CVCUDA/CV-CUDA / Stack

Function Stack

bench/BenchStack.cpp:25–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24template<typename T>
25inline void Stack(nvbench::state &state, nvbench::type_list<T>)
26try
27{
28 long3 shape = benchutils::GetShape<3>(state.get_string("shape"));
29
30 using BT = typename nvcv::cuda::BaseType<T>;
31
32 int ch = nvcv::cuda::NumElements<T>;
33
34 state.add_global_memory_reads(shape.x * shape.y * shape.z * sizeof(T));
35 state.add_global_memory_writes(shape.x * shape.y * shape.z * sizeof(T));
36
37 cvcuda::Stack op;
38
39 // clang-format off
40
41 nvcv::TensorBatch src(nvcv::TensorBatch::CalcRequirements(shape.x));
42 nvcv::Tensor dst({{shape.x, shape.y, shape.z, ch}, "NHWC"}, benchutils::GetDataType<BT>());
43
44 for (int i = 0 ; i < shape.x; i++)
45 {
46 nvcv::Tensor srcIn({{shape.y, shape.z, ch}, "HWC"}, benchutils::GetDataType<BT>());
47 benchutils::FillTensor<BT>(srcIn, benchutils::RandomValues<BT>());
48 src.pushBack(srcIn);
49 }
50
51 state.exec(nvbench::exec_tag::sync, [&op, &src, &dst](nvbench::launch &launch)
52 {
53 op(launch.get_stream(), src, dst);
54 });
55
56}
57catch (const std::exception &err)
58{
59 state.skip(err.what());
60}
61
62// clang-format on
63

Callers

nothing calls this directly

Calls 2

whatMethod · 0.80
pushBackMethod · 0.45

Tested by

no test coverage detected