Print CuDNN version correctly. (#19110)
authorEdward Yang <ezyang@fb.com>
Wed, 10 Apr 2019 21:09:35 +0000 (14:09 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 10 Apr 2019 21:20:22 +0000 (14:20 -0700)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19110
ghimport-source-id: efbaf9b23cb61e7ea65460684778c6eeb38ae28e

Differential Revision: D14874497

Pulled By: ezyang

fbshipit-source-id: ced03576f7598189dd8cce79b3303a5529551f46

aten/src/ATen/cuda/detail/CUDAHooks.cpp

index 70b1e77..a8aa2a7 100644 (file)
@@ -150,9 +150,18 @@ std::string CUDAHooks::showConfig() const {
 
 #ifndef __HIP_PLATFORM_HCC__
 #if AT_CUDNN_ENABLED()
+
+
+  auto printCudnnStyleVersion = [&](int v) {
+    oss << (v / 1000) << "." << (v / 100 % 10);
+    if (v % 100 != 0) {
+      oss << "." << (v % 100);
+    }
+  };
+
   size_t cudnnVersion = cudnnGetVersion();
-  oss << "  - CudNN ";
-  printCudaStyleVersion(cudnnVersion);
+  oss << "  - CuDNN ";
+  printCudnnStyleVersion(cudnnVersion);
   size_t cudnnCudartVersion = cudnnGetCudartVersion();
   if (cudnnCudartVersion != CUDART_VERSION) {
     oss << "  (built against CUDA ";
@@ -161,8 +170,8 @@ std::string CUDAHooks::showConfig() const {
   }
   oss << "\n";
   if (cudnnVersion != CUDNN_VERSION) {
-    oss << "  - Built with CuDNN ";
-    printCudaStyleVersion(CUDNN_VERSION);
+    oss << "    - Built with CuDNN ";
+    printCudnnStyleVersion(CUDNN_VERSION);
     oss << "\n";
   }
 #endif