|
|
#pragma once
|
|
|
|
|
|
#include <ATen/core/CachingHostAllocator.h>
|
|
|
#include <c10/core/Allocator.h>
|
|
|
#include <c10/cuda/CUDAStream.h>
|
|
|
#include <c10/util/Deprecated.h>
|
|
|
|
|
|
namespace at::cuda {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
C10_DEPRECATED_MESSAGE(
|
|
|
"at::cuda::getCachingHostAllocator() is deprecated. Please use at::getHostAllocator(at::kCUDA) instead.")
|
|
|
inline TORCH_CUDA_CPP_API at::HostAllocator* getCachingHostAllocator() {
|
|
|
return at::getHostAllocator(at::kCUDA);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
C10_DEPRECATED_MESSAGE(
|
|
|
"at::cuda::CachingHostAllocator_recordEvent(...) is deprecated. Please use at::getHostAllocator(at::kCUDA)->record_event(...) instead.")
|
|
|
inline TORCH_CUDA_CPP_API bool CachingHostAllocator_recordEvent(
|
|
|
void* ptr,
|
|
|
void* ctx,
|
|
|
c10::cuda::CUDAStream stream) {
|
|
|
return getHostAllocator(at::kCUDA)->record_event(ptr, ctx, stream.unwrap());
|
|
|
}
|
|
|
|
|
|
|
|
|
C10_DEPRECATED_MESSAGE(
|
|
|
"at::cuda::CachingHostAllocator_emptyCache() is deprecated. Please use at::getHostAllocator(at::kCUDA)->empty_cache() instead.")
|
|
|
inline TORCH_CUDA_CPP_API void CachingHostAllocator_emptyCache() {
|
|
|
getHostAllocator(at::kCUDA)->empty_cache();
|
|
|
}
|
|
|
|
|
|
C10_DEPRECATED_MESSAGE(
|
|
|
"at::cuda::HostAlloc(...) is deprecated. Please use at::getHostAllocator(at::kCUDA)->allocate(...) instead.")
|
|
|
inline TORCH_CUDA_CPP_API at::DataPtr HostAlloc(size_t size) {
|
|
|
return getHostAllocator(at::kCUDA)->allocate(size);
|
|
|
}
|
|
|
|
|
|
C10_DEPRECATED_MESSAGE(
|
|
|
"at::cuda::CachingHostAllocator_getStats() is deprecated. Please use at::getHostAllocator(at::kCUDA)->get_stats() instead.")
|
|
|
inline TORCH_CUDA_CPP_API at::HostStats CachingHostAllocator_getStats() {
|
|
|
return getHostAllocator(at::kCUDA)->get_stats();
|
|
|
}
|
|
|
|
|
|
C10_DEPRECATED_MESSAGE(
|
|
|
"at::cuda::CachingHostAllocator_resetAccumulatedStats() is deprecated. Please use at::getHostAllocator(at::kCUDA)->reset_accumulated_stats() instead.")
|
|
|
inline TORCH_CUDA_CPP_API void CachingHostAllocator_resetAccumulatedStats() {
|
|
|
getHostAllocator(at::kCUDA)->reset_accumulated_stats();
|
|
|
}
|
|
|
|
|
|
C10_DEPRECATED_MESSAGE(
|
|
|
"at::cuda::CachingHostAllocator_resetPeakStats() is deprecated. Please use at::getHostAllocator(at::kCUDA)->reset_peak_stats() instead.")
|
|
|
inline TORCH_CUDA_CPP_API void CachingHostAllocator_resetPeakStats() {
|
|
|
getHostAllocator(at::kCUDA)->reset_peak_stats();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|