Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14110
I'm planning to move CUDAStream to c10/cuda, without also moving
CUDAContext, and so it's most convenient if these definitions
are in the actual header file in question.
Reviewed By: smessmer
Differential Revision:
D13104693
fbshipit-source-id:
23ce492003091adadaa5ca6a17124213005046c2
return THCState_getDeviceProperties(at::globalContext().getTHCState(), (int)device);
}
-/* Streams */
-CUDAStream getStreamFromPool(
- const bool isHighPriority
-, int64_t device) {
- return CUDAStream(impl::CUDAStream_getStreamFromPool(isHighPriority, device));
-}
-
-CUDAStream getDefaultCUDAStream(int64_t device) {
- return CUDAStream(impl::CUDAStream_getDefaultStream(device));
-}
-CUDAStream getCurrentCUDAStream(int64_t device) {
- return CUDAStream(impl::CUDAStream_getCurrentStream(device));
-}
-
-void setCurrentCUDAStream(CUDAStream stream) {
- impl::CUDAStream_setStream(stream.internals());
-}
-void uncheckedSetCurrentCUDAStream(CUDAStream stream) {
- impl::CUDAStream_uncheckedSetStream(stream.internals());
-}
-
Allocator* getCUDADeviceAllocator() {
return at::globalContext().getTHCState()->cudaDeviceAllocator;
}
CAFFE2_API cudaDeviceProp* getDeviceProperties(int64_t device);
-/* Streams */
-
-/**
- * Get a new stream from the CUDA stream pool. You can think of this
- * as "creating" a new stream, but no such creation actually happens;
- * instead, streams are preallocated from the pool and returned in a
- * round-robin fashion.
- *
- * You can request a stream from the high priority pool by setting
- * isHighPriority to true, or a stream for a specific device by setting device
- * (defaulting to the current CUDA stream.)
- */
-CAFFE2_API CUDAStream
-getStreamFromPool(const bool isHighPriority = false, int64_t device = -1);
-
-CAFFE2_API CUDAStream getDefaultCUDAStream(int64_t device = -1);
-CAFFE2_API CUDAStream getCurrentCUDAStream(int64_t device = -1);
-
-CAFFE2_API void setCurrentCUDAStream(CUDAStream stream);
-CAFFE2_API void uncheckedSetCurrentCUDAStream(CUDAStream stream);
-
CAFFE2_API Allocator* getCUDADeviceAllocator();
/* Handles */
}
}
+/* Streams */
+CUDAStream getStreamFromPool(
+ const bool isHighPriority
+, int64_t device) {
+ return CUDAStream(impl::CUDAStream_getStreamFromPool(isHighPriority, device));
+}
+
+CUDAStream getDefaultCUDAStream(int64_t device) {
+ return CUDAStream(impl::CUDAStream_getDefaultStream(device));
+}
+CUDAStream getCurrentCUDAStream(int64_t device) {
+ return CUDAStream(impl::CUDAStream_getCurrentStream(device));
+}
+
+void setCurrentCUDAStream(CUDAStream stream) {
+ impl::CUDAStream_setStream(stream.internals());
+}
+void uncheckedSetCurrentCUDAStream(CUDAStream stream) {
+ impl::CUDAStream_uncheckedSetStream(stream.internals());
+}
+
+
} // namespace cuda
} // namespace at
* A CUDAStream interface. See CUDAStream.cpp for implementation details.
*
* Includes the CUDAStream convenience class and a pointer-based stream API.
-*
-* The ATen/cuda/CUDAContext interface should be preferred when working with streams.
*/
/*
Stream stream_;
};
+/**
+ * Get a new stream from the CUDA stream pool. You can think of this
+ * as "creating" a new stream, but no such creation actually happens;
+ * instead, streams are preallocated from the pool and returned in a
+ * round-robin fashion.
+ *
+ * You can request a stream from the high priority pool by setting
+ * isHighPriority to true, or a stream for a specific device by setting device
+ * (defaulting to the current CUDA stream.)
+ */
+CAFFE2_API CUDAStream
+getStreamFromPool(const bool isHighPriority = false, int64_t device = -1);
+
+CAFFE2_API CUDAStream getDefaultCUDAStream(int64_t device = -1);
+CAFFE2_API CUDAStream getCurrentCUDAStream(int64_t device = -1);
+
+CAFFE2_API void setCurrentCUDAStream(CUDAStream stream);
+CAFFE2_API void uncheckedSetCurrentCUDAStream(CUDAStream stream);
+
+
} // namespace cuda
} // namespace at