|
#pragma once |
|
|
|
#include <cstdint> |
|
|
|
#include <cuda_runtime_api.h> |
|
#include <cusparse.h> |
|
#include <cublas_v2.h> |
|
|
|
#ifdef CUDART_VERSION |
|
#include <cusolverDn.h> |
|
#endif |
|
|
|
#include <ATen/core/ATenGeneral.h> |
|
#include <ATen/Context.h> |
|
#include <c10/cuda/CUDAStream.h> |
|
#include <c10/cuda/CUDAFunctions.h> |
|
#include <ATen/cuda/Exceptions.h> |
|
|
|
namespace at { |
|
namespace cuda { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline int64_t getNumGPUs() { |
|
return c10::cuda::device_count(); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
inline bool is_available() { |
|
return c10::cuda::device_count() > 0; |
|
} |
|
|
|
TORCH_CUDA_CPP_API cudaDeviceProp* getCurrentDeviceProperties(); |
|
|
|
TORCH_CUDA_CPP_API int warp_size(); |
|
|
|
TORCH_CUDA_CPP_API cudaDeviceProp* getDeviceProperties(int64_t device); |
|
|
|
TORCH_CUDA_CPP_API bool canDeviceAccessPeer( |
|
int64_t device, |
|
int64_t peer_device); |
|
|
|
TORCH_CUDA_CPP_API Allocator* getCUDADeviceAllocator(); |
|
|
|
|
|
TORCH_CUDA_CPP_API cusparseHandle_t getCurrentCUDASparseHandle(); |
|
TORCH_CUDA_CPP_API cublasHandle_t getCurrentCUDABlasHandle(); |
|
|
|
#ifdef CUDART_VERSION |
|
TORCH_CUDA_CPP_API cusolverDnHandle_t getCurrentCUDASolverDnHandle(); |
|
#endif |
|
|
|
} |
|
} |
|
|