Caffe2 - C++ API
A deep learning, cross platform ML framework
event_cpu.h
1 
17 #include "caffe2/core/event.h"
18 #include "caffe2/core/operator.h"
19 
20 #include <atomic>
21 
22 namespace caffe2 {
23 
25  explicit CPUEventWrapper(const DeviceOption& option)
26  : status_(EventStatus::EVENT_INITIALIZED) {
27  CAFFE_ENFORCE(
28  option.device_type() == CPU || option.device_type() == MKLDNN,
29  "Expected CPU/MKLDNN device type");
30  }
31  ~CPUEventWrapper() {}
32 
33  std::mutex mutex_;
34  std::condition_variable cv_completed_;
35  std::atomic<int> status_;
36  std::string err_msg_;
37 };
38 
39 void EventCreateCPU(const DeviceOption& option, Event* event);
40 
41 void EventRecordCPU(
42  Event* event,
43  const void* /* unused */,
44  const char* err_msg);
45 
46 void EventFinishCPU(const Event* event);
47 
48 void EventWaitCPUCPU(const Event* event, void* /* context */);
49 
50 EventStatus EventQueryCPU(const Event* event);
51 
52 const std::string& EventErrorMessageCPU(const Event* event);
53 
54 void EventSetFinishedCPU(const Event* event, const char* err_msg);
55 
56 bool EventCanScheduleCPU(const Event*, const Event*);
57 
58 void EventResetCPU(Event*);
59 
60 } // namespace caffe2
Copyright (c) 2016-present, Facebook, Inc.