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

Method Read

dali/operators/decoder/cache/image_cache_blob.cc:66–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66bool ImageCacheBlob::Read(const ImageKey& image_key,
67 void* destination_buffer,
68 cudaStream_t stream) const {
69 DALI_ENFORCE(!image_key.empty());
70 DALI_ENFORCE(destination_buffer != nullptr);
71 std::lock_guard<std::mutex> lock(mutex_);
72 LOG_LINE << "Read: image_key[" << image_key << "]" << std::endl;
73 const auto it = cache_.find(image_key);
74 if (it == cache_.end())
75 return false;
76 const auto& data = it->second;
77 DALI_ENFORCE(data.data < tail_);
78 const auto n = data.num_elements();
79 DALI_ENFORCE(data.data + n <= tail_);
80
81 SyncToRead(stream);
82 MemCopy(destination_buffer, data.data, n, stream);
83
84 if (stats_enabled_) stats_[image_key].reads++;
85 return true;
86}
87
88ImageCache::DecodedImage ImageCacheBlob::Get(const ImageKey& image_key) const {
89 DALI_ENFORCE(!image_key.empty());

Callers 3

TEST_FFunction · 0.45
TEST_FFunction · 0.45
CacheLoadMethod · 0.45

Calls 5

MemCopyFunction · 0.85
emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45
num_elementsMethod · 0.45

Tested by 2

TEST_FFunction · 0.36
TEST_FFunction · 0.36