@@ -9,21 +9,21 @@ namespace caffe2 {
9
9
struct CudaEventWrapper {
10
10
explicit CudaEventWrapper (const DeviceOption& option)
11
11
: cuda_stream_(nullptr ),
12
- device_id_ (option.device_id ()),
12
+ cuda_gpu_id_ (option.cuda_gpu_id ()),
13
13
status_(EventStatus::EVENT_INITIALIZED) {
14
14
CAFFE_ENFORCE (option.device_type (), PROTO_CUDA);
15
- DeviceGuard g (device_id_ );
15
+ DeviceGuard g (cuda_gpu_id_ );
16
16
CUDA_ENFORCE (cudaEventCreate (
17
17
&cuda_event_, cudaEventDefault | cudaEventDisableTiming));
18
18
}
19
19
~CudaEventWrapper () {
20
- DeviceGuard g (device_id_ );
20
+ DeviceGuard g (cuda_gpu_id_ );
21
21
CUDA_CHECK (cudaEventDestroy (cuda_event_));
22
22
}
23
23
24
24
cudaEvent_t cuda_event_;
25
25
cudaStream_t cuda_stream_;
26
- int device_id_ ;
26
+ int cuda_gpu_id_ ;
27
27
28
28
std::atomic<int > status_;
29
29
std::mutex mutex_recorded_;
@@ -65,12 +65,12 @@ void EventRecordCUDA(Event* event, const void* context, const char* err_msg) {
65
65
const auto & current_device = CaffeCudaGetDevice ();
66
66
CAFFE_ENFORCE_EQ (
67
67
current_device,
68
- wrapper->device_id_ ,
68
+ wrapper->cuda_gpu_id_ ,
69
69
" When you call EventRecordCUDA, your current device should be the same "
70
70
" as the device specified by the event." );
71
71
CAFFE_ENFORCE_EQ (
72
72
current_device,
73
- static_cast <const CUDAContext*>(context)->device_id ());
73
+ static_cast <const CUDAContext*>(context)->cuda_gpu_id ());
74
74
CUDA_ENFORCE (cudaEventRecord (
75
75
wrapper->cuda_event_ ,
76
76
static_cast <const CUDAContext*>(context)->cuda_stream ()));
@@ -96,7 +96,7 @@ void EventFinishCUDA(const Event* event) {
96
96
97
97
if (wrapper->status_ == EventStatus::EVENT_SCHEDULED) {
98
98
// ok, even if event is already completed and status was not yet updated
99
- DeviceGuard g (wrapper->device_id_ );
99
+ DeviceGuard g (wrapper->cuda_gpu_id_ );
100
100
auto cudaResult = cudaEventSynchronize (wrapper->cuda_event_ );
101
101
if (cudaResult == cudaSuccess) {
102
102
wrapper->status_ = EventStatus::EVENT_SUCCESS;
@@ -127,7 +127,7 @@ void EventWaitCUDACUDA(const Event* event, void* context) {
127
127
if (context_stream != event_stream) {
128
128
// CAFFE_ENFORCE_EQ(
129
129
// CaffeCudaGetDevice(),
130
- // static_cast<const CUDAContext*>(context)->device_id ());
130
+ // static_cast<const CUDAContext*>(context)->cuda_gpu_id ());
131
131
CUDA_CHECK (cudaStreamWaitEvent (context_stream, wrapper->cuda_event_ , 0 ));
132
132
}
133
133
}
0 commit comments