()
| 94 | |
| 95 | # Performs the CPU->GPU copy in a background stream |
| 96 | def perform_copy(): |
| 97 | with torch.cuda.stream(stream): |
| 98 | tmp = t.copyto(nd.gpu(0)) |
| 99 | ptr[0] = F.from_dgl_nd(tmp).data_ptr() |
| 100 | torch.cuda.current_stream().wait_stream(stream) |
| 101 | tmp.record_stream(to_dgl_stream_handle(torch.cuda.current_stream())) |
| 102 | torch.cuda._sleep(int(50 * cycles_per_ms)) # delay the copy |
| 103 | result.copyfrom(tmp) |
| 104 | |
| 105 | perform_copy() |
| 106 | with torch.cuda.stream(stream): |
no test coverage detected