MCPcopy Create free account
hub / github.com/NVIDIA/nvcomp / BatchDataCPU

Method BatchDataCPU

examples/BatchDataCPU.h:37–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35{
36public:
37 BatchDataCPU(
38 const std::vector<std::vector<char>>& host_data,
39 const size_t chunk_size) :
40 m_ptrs(),
41 m_sizes(),
42 m_data(),
43 m_size(0)
44 {
45 m_size = compute_batch_size(host_data, chunk_size);
46 m_sizes = compute_chunk_sizes(host_data, m_size, chunk_size);
47
48 size_t data_size = std::accumulate(
49 m_sizes.begin(), m_sizes.end(), static_cast<size_t>(0));
50 m_data = std::vector<uint8_t>(data_size);
51
52 size_t offset = 0;
53 m_ptrs = std::vector<void*>(size());
54 for (size_t i = 0; i < size(); ++i) {
55 m_ptrs[i] = data() + offset;
56 offset += m_sizes[i];
57 }
58
59 std::vector<void*> src = get_input_ptrs(host_data, size(), chunk_size);
60 for (size_t i = 0; i < size(); ++i)
61 std::memcpy(m_ptrs[i], src[i], m_sizes[i]);
62 }
63
64 BatchDataCPU(const size_t max_output_size, const size_t batch_size) :
65 m_ptrs(),

Callers

nothing calls this directly

Calls 4

compute_batch_sizeFunction · 0.85
compute_chunk_sizesFunction · 0.85
get_input_ptrsFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected