pytorch/torch/csrc/cuda/Event.h
Shen Li 24f4d3987e Move all Stream and Event Python implementation to C++ (#15937)
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
2019-01-17 07:29:22 -08:00

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