Caffe2 - C++ API
A deep learning, cross platform ML framework
ideep_register.cc
1 #include <caffe2/core/event_cpu.h>
2 #include <caffe2/core/operator.h>
3 #include <caffe2/proto/caffe2_pb.h>
4 #include <ideep_pin_singletons.hpp>
5 #include "ideep_context.h"
6 
7 namespace at {
8 REGISTER_CONTEXT(DeviceType::IDEEP, caffe2::IDEEPContext);
9 
10 namespace {
11 void CopyBytesWrapper(
12  size_t nbytes,
13  const void* src,
14  Device src_device,
15  void* dst,
16  Device dst_device) {
17  if (nbytes == 0) {
18  return;
19  }
20  CAFFE_ENFORCE(src);
21  CAFFE_ENFORCE(dst);
22  memcpy(dst, src, nbytes);
23 }
24 } // namespace
25 
26 REGISTER_COPY_BYTES_FUNCTION(
27  DeviceType::IDEEP,
28  DeviceType::CPU,
29  CopyBytesWrapper);
30 REGISTER_COPY_BYTES_FUNCTION(
31  DeviceType::CPU,
32  DeviceType::IDEEP,
33  CopyBytesWrapper);
34 REGISTER_COPY_BYTES_FUNCTION(
35  DeviceType::IDEEP,
36  DeviceType::IDEEP,
37  CopyBytesWrapper);
38 } // namespace at
39 
40 namespace caffe2 {
41 
42 CAFFE_KNOWN_TYPE(ideep::tensor);
43 
44 C10_DEFINE_REGISTRY(
45  IDEEPOperatorRegistry,
46  OperatorBase,
47  const OperatorDef&,
48  Workspace*);
49 
50 CAFFE_REGISTER_DEVICE_TYPE(DeviceType::IDEEP, IDEEPOperatorRegistry);
51 
52 REGISTER_EVENT_CREATE_FUNCTION(IDEEP, EventCreateCPU);
53 REGISTER_EVENT_RECORD_FUNCTION(IDEEP, EventRecordCPU);
54 REGISTER_EVENT_WAIT_FUNCTION(IDEEP, IDEEP, EventWaitCPUCPU);
55 REGISTER_EVENT_WAIT_FUNCTION(IDEEP, CPU, EventWaitCPUCPU);
56 REGISTER_EVENT_WAIT_FUNCTION(CPU, IDEEP, EventWaitCPUCPU);
57 REGISTER_EVENT_FINISH_FUNCTION(IDEEP, EventFinishCPU);
58 REGISTER_EVENT_QUERY_FUNCTION(IDEEP, EventQueryCPU);
59 REGISTER_EVENT_ERROR_MESSAGE_FUNCTION(IDEEP, EventErrorMessageCPU);
60 REGISTER_EVENT_SET_FINISHED_FUNCTION(IDEEP, EventSetFinishedCPU);
61 REGISTER_EVENT_RESET_FUNCTION(IDEEP, EventResetCPU);
62 
63 } // namespace caffe2
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13
Flush-To-Zero and Denormals-Are-Zero mode.