mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: 1. Added `torch/csrc/cuda/Event.h` and `torch/csrc/cuda/Event.cpp` to bind Python Event class to C++ implementation. 2. Move all CUDA runtime invocations from `torch/cuda/streams.py` to C++ 3. Added tests to cover Stream and Event APIs. ~(event IPC handle tests is introduced in #15974)~ Pull Request resolved: https://github.com/pytorch/pytorch/pull/15937 Differential Revision: D13649001 Pulled By: mrshenli fbshipit-source-id: 84ca58f35f6ba679a4ba33150ceba678d760d240
21 lines
429 B
C
21 lines
429 B
C
#ifndef THCP_EVENT_INC
|
|
#define THCP_EVENT_INC
|
|
|
|
#include <ATen/cuda/CUDAEvent.h>
|
|
#include <torch/csrc/python_headers.h>
|
|
#include <THC/THC.h>
|
|
|
|
struct THCPEvent {
|
|
PyObject_HEAD
|
|
at::cuda::CUDAEvent cuda_event;
|
|
};
|
|
extern PyObject *THCPEventClass;
|
|
|
|
void THCPEvent_init(PyObject *module);
|
|
|
|
inline bool THCPEvent_Check(PyObject* obj) {
|
|
return THCPEventClass && PyObject_IsInstance(obj, THCPEventClass);
|
|
}
|
|
|
|
#endif // THCP_EVENT_INC
|