Caffe2 - C++ API
A deep learning, cross platform ML framework
common.cc
1 
17 #include <atomic>
18 
19 #include "caffe2/core/common.h"
20 
21 namespace caffe2 {
22 
23 // A global variable to mark if Caffe2 has cuda linked to the current runtime.
24 // Do not directly use this variable, but instead use the HasCudaRuntime()
25 // function below.
26 std::atomic<bool> g_caffe2_has_cuda_linked{false};
27 
28 bool HasCudaRuntime() {
29  return g_caffe2_has_cuda_linked.load();
30 }
31 
32 namespace internal {
33 void SetCudaRuntimeFlag() {
34  g_caffe2_has_cuda_linked.store(true);
35 }
36 } // namespace internal
37 
38 const std::map<string, string>& GetBuildOptions() {
39 #ifndef CAFFE2_BUILD_STRINGS
40 #define CAFFE2_BUILD_STRINGS {}
41 #endif
42  static const std::map<string, string> kMap = CAFFE2_BUILD_STRINGS;
43  return kMap;
44 }
45 
46 } // namespace caffe2
Copyright (c) 2016-present, Facebook, Inc.