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

Function CheckValidCUDABuffer

python/mod_cvcuda/nvcv/ExternalBuffer.cpp:33–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31using namespace py::literals;
32
33static void CheckValidCUDABuffer(const void *ptr)
34{
35 if (ptr == nullptr)
36 {
37 throw std::runtime_error("NULL CUDA buffer not accepted");
38 }
39
40 cudaPointerAttributes attrs = {};
41 cudaError_t err = cudaPointerGetAttributes(&attrs, ptr);
42 cudaGetLastError(); // reset the cuda error (if any)
43 if (err != cudaSuccess || attrs.type == cudaMemoryTypeUnregistered)
44 {
45 throw std::runtime_error("Buffer is not CUDA-accessible");
46 }
47}
48
49static std::string ToFormatString(const DLDataType &dtype)
50{

Callers 2

ExternalBufferMethod · 0.85
loadMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected