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

Method async_copy_to_device

dlib/cuda/gpu_data.cpp:153–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151 }
152
153 void gpu_data::
154 async_copy_to_device() const
155 {
156 if (!cuda::use_cuda())
157 return;
158
159 if (!device_current)
160 {
161 if (device_in_use)
162 {
163 // Wait for any possible CUDA kernels that might be using our memory block to
164 // complete before we overwrite the memory.
165 synchronize_stream(0);
166 device_in_use = false;
167 }
168 CHECK_CUDA(cudaMemcpyAsync(data_device.get(), data_host.get(), data_size*sizeof(float), cudaMemcpyHostToDevice, (cudaStream_t)cuda_stream.get()));
169 have_active_transfer = true;
170 device_current = true;
171 }
172 }
173
174 void gpu_data::
175 set_size(

Callers

nothing calls this directly

Calls 3

use_cudaFunction · 0.85
synchronize_streamFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected