@@ -9,21 +9,21 @@ namespace caffe2 {
99struct CudaEventWrapper {
1010 explicit CudaEventWrapper (const DeviceOption& option)
1111 : cuda_stream_(nullptr ),
12- device_id_ (option.device_id ()),
12+ cuda_gpu_id_ (option.cuda_gpu_id ()),
1313 status_(EventStatus::EVENT_INITIALIZED) {
1414 CAFFE_ENFORCE (option.device_type (), PROTO_CUDA);
15- DeviceGuard g (device_id_ );
15+ DeviceGuard g (cuda_gpu_id_ );
1616 CUDA_ENFORCE (cudaEventCreate (
1717 &cuda_event_, cudaEventDefault | cudaEventDisableTiming));
1818 }
1919 ~CudaEventWrapper () {
20- DeviceGuard g (device_id_ );
20+ DeviceGuard g (cuda_gpu_id_ );
2121 CUDA_CHECK (cudaEventDestroy (cuda_event_));
2222 }
2323
2424 cudaEvent_t cuda_event_;
2525 cudaStream_t cuda_stream_;
26- int device_id_ ;
26+ int cuda_gpu_id_ ;
2727
2828 std::atomic<int > status_;
2929 std::mutex mutex_recorded_;
@@ -65,12 +65,12 @@ void EventRecordCUDA(Event* event, const void* context, const char* err_msg) {
6565 const auto & current_device = CaffeCudaGetDevice ();
6666 CAFFE_ENFORCE_EQ (
6767 current_device,
68- wrapper->device_id_ ,
68+ wrapper->cuda_gpu_id_ ,
6969 " When you call EventRecordCUDA, your current device should be the same "
7070 " as the device specified by the event." );
7171 CAFFE_ENFORCE_EQ (
7272 current_device,
73- static_cast <const CUDAContext*>(context)->device_id ());
73+ static_cast <const CUDAContext*>(context)->cuda_gpu_id ());
7474 CUDA_ENFORCE (cudaEventRecord (
7575 wrapper->cuda_event_ ,
7676 static_cast <const CUDAContext*>(context)->cuda_stream ()));
@@ -96,7 +96,7 @@ void EventFinishCUDA(const Event* event) {
9696
9797 if (wrapper->status_ == EventStatus::EVENT_SCHEDULED) {
9898 // 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_ );
100100 auto cudaResult = cudaEventSynchronize (wrapper->cuda_event_ );
101101 if (cudaResult == cudaSuccess) {
102102 wrapper->status_ = EventStatus::EVENT_SUCCESS;
@@ -127,7 +127,7 @@ void EventWaitCUDACUDA(const Event* event, void* context) {
127127 if (context_stream != event_stream) {
128128 // CAFFE_ENFORCE_EQ(
129129 // CaffeCudaGetDevice(),
130- // static_cast<const CUDAContext*>(context)->device_id ());
130+ // static_cast<const CUDAContext*>(context)->cuda_gpu_id ());
131131 CUDA_CHECK (cudaStreamWaitEvent (context_stream, wrapper->cuda_event_ , 0 ));
132132 }
133133 }
0 commit comments