mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
Added cudaGetLastError() for cudaHostAlloc() to reset last cuda error
This commit is contained in:
@ -459,12 +459,13 @@ int resize_network(network *net, int w, int h)
|
||||
const int size = get_network_input_size(*net) * net->batch;
|
||||
#ifdef GPU
|
||||
if(gpu_index >= 0){
|
||||
printf(" try to allocate workspace = %zu * sizeof(float), ", workspace_size / sizeof(float) + 1);
|
||||
printf(" try to allocate additional workspace_size = %1.2f MB \n", (float)workspace_size / 1000000);
|
||||
net->workspace = cuda_make_array(0, workspace_size/sizeof(float) + 1);
|
||||
net->input_state_gpu = cuda_make_array(0, size);
|
||||
if (cudaSuccess == cudaHostAlloc(&net->input_pinned_cpu, size * sizeof(float), cudaHostRegisterMapped))
|
||||
net->input_pinned_cpu_flag = 1;
|
||||
else {
|
||||
cudaGetLastError(); // reset CUDA-error
|
||||
net->input_pinned_cpu = calloc(size, sizeof(float));
|
||||
net->input_pinned_cpu_flag = 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user