diff options
author | Teng Li <tengli@fb.com> | 2018-11-07 17:07:14 -0800 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2018-11-07 17:09:08 -0800 |
commit | eb88098e1157d17421d4202d37f1d7f3f8e21809 (patch) | |
tree | 55b2bfab13924fe3228c31175264796863cf0e6a /torch/lib | |
parent | c8bb665b5d2afddc4ba48acf28eca10ebbc344d2 (diff) | |
download | pytorch-eb88098e1157d17421d4202d37f1d7f3f8e21809.tar.gz pytorch-eb88098e1157d17421d4202d37f1d7f3f8e21809.tar.bz2 pytorch-eb88098e1157d17421d4202d37f1d7f3f8e21809.zip |
Kill c10d/private/CUDAUtils.hpp (#13681)
Summary:
Use AT_CUDA_CHECK instead
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13681
Differential Revision: D12966607
Pulled By: teng-li
fbshipit-source-id: da0431f588969791a19519368edb909b9c3dc5ab
Diffstat (limited to 'torch/lib')
-rw-r--r-- | torch/lib/c10d/ProcessGroupGloo.cpp | 2 | ||||
-rw-r--r-- | torch/lib/c10d/ProcessGroupNCCL.cpp | 3 | ||||
-rw-r--r-- | torch/lib/c10d/private/CUDAUtils.hpp | 23 | ||||
-rw-r--r-- | torch/lib/c10d/test/CUDATest.cu | 5 | ||||
-rw-r--r-- | torch/lib/c10d/test/CUDATest.hpp | 3 | ||||
-rw-r--r-- | torch/lib/c10d/test/ProcessGroupGlooAsyncTest.cpp | 1 | ||||
-rw-r--r-- | torch/lib/c10d/test/ProcessGroupNCCLTest.cpp | 1 |
7 files changed, 3 insertions, 35 deletions
diff --git a/torch/lib/c10d/ProcessGroupGloo.cpp b/torch/lib/c10d/ProcessGroupGloo.cpp index cd226f0fff..6b6a77932d 100644 --- a/torch/lib/c10d/ProcessGroupGloo.cpp +++ b/torch/lib/c10d/ProcessGroupGloo.cpp @@ -21,8 +21,6 @@ #include <gloo/cuda_allreduce_halving_doubling.h> #include <gloo/cuda_allreduce_ring_chunked.h> #include <gloo/cuda_broadcast_one_to_all.h> - -#include <c10d/private/CUDAUtils.hpp> #endif #include <gloo/rendezvous/context.h> diff --git a/torch/lib/c10d/ProcessGroupNCCL.cpp b/torch/lib/c10d/ProcessGroupNCCL.cpp index 9e64fe7fae..a3ede7b1cc 100644 --- a/torch/lib/c10d/ProcessGroupNCCL.cpp +++ b/torch/lib/c10d/ProcessGroupNCCL.cpp @@ -10,7 +10,6 @@ #include <ATen/cuda/CUDAGuard.h> #include <c10d/Utils.hpp> -#include <c10d/private/CUDAUtils.hpp> namespace c10d { @@ -103,7 +102,7 @@ bool ProcessGroupNCCL::WorkNCCL::finishedGPUExecution() const { // Checking the work's corresponding CUDA events' status auto ret = cudaEventQuery(cudaEvents_[i]); if (ret != cudaSuccess && ret != cudaErrorNotReady) { - C10D_CUDA_CHECK(ret); + AT_CUDA_CHECK(ret); } if (ret == cudaErrorNotReady) { return false; diff --git a/torch/lib/c10d/private/CUDAUtils.hpp b/torch/lib/c10d/private/CUDAUtils.hpp deleted file mode 100644 index 6b31263add..0000000000 --- a/torch/lib/c10d/private/CUDAUtils.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include <sstream> -#include <stdexcept> - -#include <cuda.h> -#include <cuda_runtime.h> - -// TODO: Use AT_CHECK or similar here -#define C10D_CUDA_CHECK(condition) \ - do { \ - cudaError_t error = (condition); \ - if (error != cudaSuccess) { \ - std::stringstream ss; \ - ss << "Error at: "; \ - ss << __FILE__; \ - ss << ":"; \ - ss << __LINE__; \ - ss << ": "; \ - ss << cudaGetErrorString(error); \ - throw std::runtime_error(ss.str()); \ - } \ - } while (0) diff --git a/torch/lib/c10d/test/CUDATest.cu b/torch/lib/c10d/test/CUDATest.cu index ef8a2780c6..b6efe6fceb 100644 --- a/torch/lib/c10d/test/CUDATest.cu +++ b/torch/lib/c10d/test/CUDATest.cu @@ -1,6 +1,5 @@ #include "CUDATest.hpp" - -#include <c10d/private/CUDAUtils.hpp> +#include <ATen/cuda/Exceptions.h> namespace c10d { namespace test { @@ -22,7 +21,7 @@ void cudaSleep(at::cuda::CUDAStream& stream, uint64_t clocks) { int cudaNumDevices() { int n = 0; - C10D_CUDA_CHECK(cudaGetDeviceCount(&n)); + AT_CUDA_CHECK(cudaGetDeviceCount(&n)); return n; } diff --git a/torch/lib/c10d/test/CUDATest.hpp b/torch/lib/c10d/test/CUDATest.hpp index d2275c128e..5e02e317fb 100644 --- a/torch/lib/c10d/test/CUDATest.hpp +++ b/torch/lib/c10d/test/CUDATest.hpp @@ -1,8 +1,5 @@ #pragma once -#include <cuda.h> -#include <cuda_runtime.h> - #include <ATen/cuda/CUDAStream.h> namespace c10d { diff --git a/torch/lib/c10d/test/ProcessGroupGlooAsyncTest.cpp b/torch/lib/c10d/test/ProcessGroupGlooAsyncTest.cpp index 5c4912706c..10b7ab1c10 100644 --- a/torch/lib/c10d/test/ProcessGroupGlooAsyncTest.cpp +++ b/torch/lib/c10d/test/ProcessGroupGlooAsyncTest.cpp @@ -4,7 +4,6 @@ #include <c10d/FileStore.hpp> #include <c10d/ProcessGroupGloo.hpp> -#include <c10d/private/CUDAUtils.hpp> #include <c10d/test/CUDATest.hpp> #include <c10d/test/TestUtils.hpp> diff --git a/torch/lib/c10d/test/ProcessGroupNCCLTest.cpp b/torch/lib/c10d/test/ProcessGroupNCCLTest.cpp index 4f0f0c33f7..20ae4dda56 100644 --- a/torch/lib/c10d/test/ProcessGroupNCCLTest.cpp +++ b/torch/lib/c10d/test/ProcessGroupNCCLTest.cpp @@ -2,7 +2,6 @@ #include <c10d/FileStore.hpp> #include <c10d/ProcessGroupNCCL.hpp> -#include <c10d/private/CUDAUtils.hpp> #include <c10d/test/CUDATest.hpp> #include <c10d/test/TestUtils.hpp> |