Replace caffe2::DeviceGuard with c10::cuda::CUDAGuard (#17623)
authorEdward Yang <ezyang@fb.com>
Wed, 6 Mar 2019 18:32:38 +0000 (10:32 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 6 Mar 2019 18:48:15 +0000 (10:48 -0800)
commit1e6acc676fc312e940dbb8ecb7d41c1b352f3749
treeaaae94fefa3bb61c59cb5a622008cec8df16bdc2
parente9eb18a18c3e67a2fa72283d3dd66969188aa85b
Replace caffe2::DeviceGuard with c10::cuda::CUDAGuard (#17623)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17623

Despite it's generic sounding name, caffe2::DeviceGuard actually
only worked on CUDA devices.  Rename it to something that more
clearly spells out its applicability.

I'm not sure if it's the right call, but in this patch I added
'using CUDAGuard = c10::cuda::CUDAGuard', as this seems to be more
in-line with how the Caffe2 codebase is currently written.  More
idiomatic c10 namespace style would be to say cuda::CUDAGuard.
Willing to change this if people shout.

This is a respin of D13156470 (#14284)

Reviewed By: dzhulgakov

Differential Revision: D14285504

fbshipit-source-id: 93b8ab938b064572b3b010c307e1261fde0fff3d
caffe2/contrib/nccl/cuda_nccl_gpu.cc
caffe2/core/blob_gpu_test.cc
caffe2/core/blob_serialization.cc
caffe2/core/common_gpu.h
caffe2/core/context_gpu.cu
caffe2/core/context_gpu.h
caffe2/core/context_gpu_test.cc
caffe2/core/cudnn_wrappers.h
caffe2/core/event_gpu.cc
caffe2/core/hip/miopen_wrapper.h
caffe2/python/pybind_state.h