mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
Minor fix for CHECK_CUDA()
This commit is contained in:
18
src/cuda.c
18
src/cuda.c
@ -32,7 +32,6 @@ void check_error(cudaError_t status)
|
|||||||
const char *s = cudaGetErrorString(status);
|
const char *s = cudaGetErrorString(status);
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
printf("CUDA Error: %s\n", s);
|
printf("CUDA Error: %s\n", s);
|
||||||
assert(0);
|
|
||||||
snprintf(buffer, 256, "CUDA Error: %s", s);
|
snprintf(buffer, 256, "CUDA Error: %s", s);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
getchar();
|
getchar();
|
||||||
@ -44,7 +43,6 @@ void check_error(cudaError_t status)
|
|||||||
const char *s = cudaGetErrorString(status2);
|
const char *s = cudaGetErrorString(status2);
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
printf("CUDA Error Prev: %s\n", s);
|
printf("CUDA Error Prev: %s\n", s);
|
||||||
assert(0);
|
|
||||||
snprintf(buffer, 256, "CUDA Error Prev: %s", s);
|
snprintf(buffer, 256, "CUDA Error Prev: %s", s);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
getchar();
|
getchar();
|
||||||
@ -56,12 +54,12 @@ void check_error(cudaError_t status)
|
|||||||
void check_error_extended(cudaError_t status, const char *file, int line, const char *date_time)
|
void check_error_extended(cudaError_t status, const char *file, int line, const char *date_time)
|
||||||
{
|
{
|
||||||
if (status != cudaSuccess)
|
if (status != cudaSuccess)
|
||||||
printf("CUDA Prev Error: file: %s() : line: %d : build time: %s \n", file, line, date_time);
|
printf("CUDA status Error: file: %s() : line: %d : build time: %s \n", file, line, date_time);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
status = cudaDeviceSynchronize();
|
status = cudaDeviceSynchronize();
|
||||||
#endif
|
|
||||||
if (status != cudaSuccess)
|
if (status != cudaSuccess)
|
||||||
printf("CUDA Error: file: %s() : line: %d : build time: %s \n", file, line, date_time);
|
printf("CUDA status = cudaDeviceSynchronize() Error: file: %s() : line: %d : build time: %s \n", file, line, date_time);
|
||||||
|
#endif
|
||||||
check_error(status);
|
check_error(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +148,6 @@ void cudnn_check_error(cudnnStatus_t status)
|
|||||||
const char *s = cudnnGetErrorString(status);
|
const char *s = cudnnGetErrorString(status);
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
printf("cuDNN Error: %s\n", s);
|
printf("cuDNN Error: %s\n", s);
|
||||||
assert(0);
|
|
||||||
snprintf(buffer, 256, "cuDNN Error: %s", s);
|
snprintf(buffer, 256, "cuDNN Error: %s", s);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
getchar();
|
getchar();
|
||||||
@ -162,7 +159,6 @@ void cudnn_check_error(cudnnStatus_t status)
|
|||||||
const char *s = cudnnGetErrorString(status2);
|
const char *s = cudnnGetErrorString(status2);
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
printf("cuDNN Error Prev: %s\n", s);
|
printf("cuDNN Error Prev: %s\n", s);
|
||||||
assert(0);
|
|
||||||
snprintf(buffer, 256, "cuDNN Error Prev: %s", s);
|
snprintf(buffer, 256, "cuDNN Error Prev: %s", s);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
getchar();
|
getchar();
|
||||||
@ -173,13 +169,13 @@ void cudnn_check_error(cudnnStatus_t status)
|
|||||||
|
|
||||||
void cudnn_check_error_extended(cudnnStatus_t status, const char *file, int line, const char *date_time)
|
void cudnn_check_error_extended(cudnnStatus_t status, const char *file, int line, const char *date_time)
|
||||||
{
|
{
|
||||||
if (status != cudaSuccess)
|
if (status != CUDNN_STATUS_SUCCESS)
|
||||||
printf("\n cuDNN Prev Error in: file: %s() : line: %d : build time: %s \n", file, line, date_time);
|
printf("\n cuDNN status Error in: file: %s() : line: %d : build time: %s \n", file, line, date_time);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
status = cudaDeviceSynchronize();
|
status = cudaDeviceSynchronize();
|
||||||
|
if (status != CUDNN_STATUS_SUCCESS)
|
||||||
|
printf("\n cuDNN status = cudaDeviceSynchronize() Error in: file: %s() : line: %d : build time: %s \n", file, line, date_time);
|
||||||
#endif
|
#endif
|
||||||
if (status != cudaSuccess)
|
|
||||||
printf("\n cuDNN Error in: file: %s() : line: %d : build time: %s \n", file, line, date_time);
|
|
||||||
cudnn_check_error(status);
|
cudnn_check_error(status);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -97,16 +97,16 @@ void resize_maxpool_layer(maxpool_layer *l, int w, int h)
|
|||||||
l->output = realloc(l->output, output_size * sizeof(float));
|
l->output = realloc(l->output, output_size * sizeof(float));
|
||||||
l->delta = realloc(l->delta, output_size * sizeof(float));
|
l->delta = realloc(l->delta, output_size * sizeof(float));
|
||||||
|
|
||||||
#ifdef GPU
|
#ifdef GPU
|
||||||
cuda_free((float *)l->indexes_gpu);
|
CHECK_CUDA(cudaFree((float *)l->indexes_gpu));
|
||||||
cuda_free(l->output_gpu);
|
CHECK_CUDA(cudaFree(l->output_gpu));
|
||||||
cuda_free(l->delta_gpu);
|
CHECK_CUDA(cudaFree(l->delta_gpu));
|
||||||
l->indexes_gpu = cuda_make_int_array(output_size);
|
l->indexes_gpu = cuda_make_int_array(output_size);
|
||||||
l->output_gpu = cuda_make_array(l->output, output_size);
|
l->output_gpu = cuda_make_array(l->output, output_size);
|
||||||
l->delta_gpu = cuda_make_array(l->delta, output_size);
|
l->delta_gpu = cuda_make_array(l->delta, output_size);
|
||||||
|
|
||||||
cudnn_maxpool_setup(l);
|
cudnn_maxpool_setup(l);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void forward_maxpool_layer(const maxpool_layer l, network_state state)
|
void forward_maxpool_layer(const maxpool_layer l, network_state state)
|
||||||
|
Reference in New Issue
Block a user