def test_cuda_stream_wait_event_and_record_event(self): if paddle.is_compiled_with_cuda(): s1 = cuda.Stream(0) tensor1 = paddle.to_tensor(paddle.rand([1000, 1000])) tensor2 = paddle.matmul(tensor1, tensor1) e1 = cuda.Event(False, False, False) s1.record_event(e1) s2 = cuda.Stream(0) s2.wait_event(e1) s2.synchronize() self.assertTrue(e1.query() and s1.query() and s2.query())
def func_setUp(self): self.empty = paddle.to_tensor(np.array([], dtype="int64"), place=paddle.CPUPlace()) data = np.random.randn(100, 50, 50).astype("float32") self.src = paddle.to_tensor(data, place=paddle.CUDAPinnedPlace()) self.dst = paddle.empty(shape=[100, 50, 50], dtype="float32") self.index = paddle.to_tensor(np.array([1, 3, 5, 7, 9], dtype="int64")).cpu() self.buffer = paddle.empty(shape=[50, 50, 50], dtype="float32").pin_memory() self.stream = cuda.Stream()
def setUp(self): self.src = paddle.rand(shape=[100, 50, 50, 5], dtype="float32") self.dst = paddle.empty( shape=[200, 50, 50, 5], dtype="float32").pin_memory() self.stream = cuda.Stream()