From 1f60ca57ad90f34a0559783656fa1ba98c61bb6d Mon Sep 17 00:00:00 2001 From: AlexeyAB Date: Thu, 7 May 2020 18:41:43 +0300 Subject: [PATCH] Minor fix --- src/dark_cuda.c | 3 ++- src/dark_cuda.h | 2 +- src/parser.c | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/dark_cuda.c b/src/dark_cuda.c index 695925d8..fec06473 100644 --- a/src/dark_cuda.c +++ b/src/dark_cuda.c @@ -491,12 +491,13 @@ int get_number_of_blocks(int array_size, int block_size) return array_size / block_size + ((array_size % block_size > 0) ? 1 : 0); } -int get_gpu_compute_capability(int i) +int get_gpu_compute_capability(int i, char *device_name) { typedef struct cudaDeviceProp cudaDeviceProp; cudaDeviceProp prop; cudaError_t status = cudaGetDeviceProperties(&prop, i); CHECK_CUDA(status); + if (device_name) strcpy(device_name, prop.name); int cc = prop.major * 100 + prop.minor * 10; // __CUDA_ARCH__ format return cc; } diff --git a/src/dark_cuda.h b/src/dark_cuda.h index 5f6978ae..0e5f39f9 100644 --- a/src/dark_cuda.h +++ b/src/dark_cuda.h @@ -79,7 +79,7 @@ extern "C" { cudaStream_t get_cuda_stream(); cudaStream_t get_cuda_memcpy_stream(); int get_number_of_blocks(int array_size, int block_size); - int get_gpu_compute_capability(int i); + int get_gpu_compute_capability(int i, char *device_name); void show_cuda_cudnn_info(); #ifdef CUDNN diff --git a/src/parser.c b/src/parser.c index 99436156..0df6bcc2 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1125,12 +1125,13 @@ void parse_net_options(list *options, network *net) net->burn_in = option_find_int_quiet(options, "burn_in", 0); #ifdef GPU if (net->gpu_index >= 0) { - int compute_capability = get_gpu_compute_capability(net->gpu_index); + char device_name[1024]; + int compute_capability = get_gpu_compute_capability(net->gpu_index, device_name); #ifdef CUDNN_HALF if (compute_capability >= 700) net->cudnn_half = 1; else net->cudnn_half = 0; #endif// CUDNN_HALF - fprintf(stderr, " compute_capability = %d, cudnn_half = %d \n", compute_capability, net->cudnn_half); + fprintf(stderr, " %d : compute_capability = %d, cudnn_half = %d, GPU: %s \n", net->gpu_index, compute_capability, net->cudnn_half, device_name); } else fprintf(stderr, " GPU isn't used \n"); #endif// GPU