MCPcopy Create free account
hub / github.com/davisking/dlib / cuda_data_void_ptr

Method cuda_data_void_ptr

dlib/cuda/cuda_data_ptr.cpp:48–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 // -----------------------------------------------------------------------------------
47
48 cuda_data_void_ptr::
49 cuda_data_void_ptr(
50 size_t n
51 ) : num(n)
52 {
53 if (n == 0)
54 return;
55
56 void* data = nullptr;
57
58 CHECK_CUDA(cudaMalloc(&data, n));
59 pdata.reset(data, [](void* ptr){
60 auto err = cudaFree(ptr);
61 if(err!=cudaSuccess)
62 std::cerr << "cudaFree() failed. Reason: " << cudaGetErrorString(err) << std::endl;
63 });
64 }
65
66 // ------------------------------------------------------------------------------------
67

Callers

nothing calls this directly

Calls 1

resetMethod · 0.45

Tested by

no test coverage detected