diff --git a/src/cuda.c b/src/cuda.c index 6a2407a3..b790e7f5 100644 --- a/src/cuda.c +++ b/src/cuda.c @@ -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 diff --git a/src/maxpool_layer.c b/src/maxpool_layer.c index 8c1265e3..2eaa7dec 100644 --- a/src/maxpool_layer.c +++ b/src/maxpool_layer.c @@ -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->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); +#ifdef 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); cudnn_maxpool_setup(l); - #endif +#endif } void forward_maxpool_layer(const maxpool_layer l, network_state state)