Caffe2 - C++ API
A deep learning, cross platform ML framework
common.cc
1 #include <atomic>
2 
3 #include "caffe2/core/common.h"
4 
5 namespace caffe2 {
6 
7 // A global variable to mark if Caffe2 has cuda linked to the current runtime.
8 // Do not directly use this variable, but instead use the HasCudaRuntime()
9 // function below.
10 std::atomic<bool> g_caffe2_has_cuda_linked{false};
11 
12 bool HasCudaRuntime() {
13  return g_caffe2_has_cuda_linked.load();
14 }
15 
16 namespace internal {
17 void SetCudaRuntimeFlag() {
18  g_caffe2_has_cuda_linked.store(true);
19 }
20 } // namespace internal
21 
22 const std::map<string, string>& GetBuildOptions() {
23 #ifndef CAFFE2_BUILD_STRINGS
24 #define CAFFE2_BUILD_STRINGS {}
25 #endif
26  static const std::map<string, string> kMap = CAFFE2_BUILD_STRINGS;
27  return kMap;
28 }
29 
30 } // namespace caffe2
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...