Minor fix for CHECK_CUDA()

This commit is contained in:
AlexeyAB 2019-02-08 00:48:27 +03:00
parent 98103552fb
commit 58de6b2d3d
2 changed files with 12 additions and 16 deletions

View File

@ -32,7 +32,6 @@ void check_error(cudaError_t status)
const char *s = cudaGetErrorString(status);
char buffer[256];
printf("CUDA Error: %s\n", s);
assert(0);
snprintf(buffer, 256, "CUDA Error: %s", s);
#ifdef WIN32
getchar();
@ -44,7 +43,6 @@ void check_error(cudaError_t status)
const char *s = cudaGetErrorString(status2);
char buffer[256];
printf("CUDA Error Prev: %s\n", s);
assert(0);
snprintf(buffer, 256, "CUDA Error Prev: %s", s);
#ifdef WIN32
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)
{
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
status = cudaDeviceSynchronize();
#endif
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);
}
@ -150,7 +148,6 @@ void cudnn_check_error(cudnnStatus_t status)
const char *s = cudnnGetErrorString(status);
char buffer[256];
printf("cuDNN Error: %s\n", s);
assert(0);
snprintf(buffer, 256, "cuDNN Error: %s", s);
#ifdef WIN32
getchar();
@ -162,7 +159,6 @@ void cudnn_check_error(cudnnStatus_t status)
const char *s = cudnnGetErrorString(status2);
char buffer[256];
printf("cuDNN Error Prev: %s\n", s);
assert(0);
snprintf(buffer, 256, "cuDNN Error Prev: %s", s);
#ifdef WIN32
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)
{
if (status != cudaSuccess)
printf("\n cuDNN Prev Error in: file: %s() : line: %d : build time: %s \n", file, line, date_time);
if (status != CUDNN_STATUS_SUCCESS)
printf("\n cuDNN status Error in: file: %s() : line: %d : build time: %s \n", file, line, date_time);
#ifdef DEBUG
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
if (status != cudaSuccess)
printf("\n cuDNN Error in: file: %s() : line: %d : build time: %s \n", file, line, date_time);
cudnn_check_error(status);
}
#endif

View File

@ -98,9 +98,9 @@ void resize_maxpool_layer(maxpool_layer *l, int w, int h)
l->delta = realloc(l->delta, output_size * sizeof(float));
#ifdef GPU
cuda_free((float *)l->indexes_gpu);
cuda_free(l->output_gpu);
cuda_free(l->delta_gpu);
CHECK_CUDA(cudaFree((float *)l->indexes_gpu));
CHECK_CUDA(cudaFree(l->output_gpu));
CHECK_CUDA(cudaFree(l->delta_gpu));
l->indexes_gpu = cuda_make_int_array(output_size);
l->output_gpu = cuda_make_array(l->output, output_size);
l->delta_gpu = cuda_make_array(l->delta, output_size);