mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-15 21:00:47 +00:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/56830 Opt into formatting on GitHub and format everything. This is a trial run before turning on formatting for more and eventually all of the codebase. Test Plan: CI Reviewed By: zertosh Differential Revision: D27979080 fbshipit-source-id: a80f0c48691c08ae8ca0af06377b87e6a2351151
34 lines
580 B
C++
34 lines
580 B
C++
// Just a little test file to make sure that the CUDA library works
|
|
|
|
#include <c10/cuda/CUDAException.h>
|
|
#include <c10/cuda/impl/CUDATest.h>
|
|
|
|
#include <cuda_runtime.h>
|
|
|
|
namespace c10 {
|
|
namespace cuda {
|
|
namespace impl {
|
|
|
|
bool has_cuda_gpu() {
|
|
int count;
|
|
C10_CUDA_CHECK(cudaGetDeviceCount(&count));
|
|
|
|
return count != 0;
|
|
}
|
|
|
|
int c10_cuda_test() {
|
|
int r = 0;
|
|
if (has_cuda_gpu()) {
|
|
C10_CUDA_CHECK(cudaGetDevice(&r));
|
|
}
|
|
return r;
|
|
}
|
|
|
|
// This function is not exported
|
|
int c10_cuda_private_test() {
|
|
return 2;
|
|
}
|
|
|
|
} // namespace impl
|
|
} // namespace cuda
|
|
} // namespace c10
|