Caffe2 - C++ API
A deep learning, cross platform ML framework
common_cudnn.cc
1 #include "caffe2/core/common_cudnn.h"
2 
3 #include "caffe2/core/init.h"
4 
5 namespace caffe2 {
6 
7 thread_local CuDNNHandles CuDNNWrapper::tls_cudnn_handles_;
8 
9 CuDNNWrapper::PerGPUCuDNNStates& CuDNNWrapper::cudnn_states() {
10  // New it (never delete) to avoid calling the destructors on process
11  // exit and racing against the CUDA shutdown sequence.
12  static auto* p = new CuDNNWrapper::PerGPUCuDNNStates();
13  CHECK_NOTNULL(p);
14  return *p;
15 }
16 
17 namespace {
18 bool PrintCuDNNInfo(int*, char***) {
19  VLOG(1) << "Caffe2 is built with CuDNN version " << CUDNN_VERSION;
20  return true;
21 }
22 
23 REGISTER_CAFFE2_INIT_FUNCTION(PrintCuDNNInfo, &PrintCuDNNInfo,
24  "Print CuDNN Info.");
25 
26 } // namespace
27 } // namespace caffe2
Simple registry implementation in Caffe2 that uses static variables to register object creators durin...