()
| 410 | @eval_modes() |
| 411 | @attr("multi_gpu") |
| 412 | def test_cross_device_copy(): |
| 413 | if _b.GetCUDADeviceCount() < 2: |
| 414 | raise SkipTest("At least 2 devices needed for the test") |
| 415 | c0 = ndd.as_batch( |
| 416 | [ |
| 417 | ndd.tensor([[1, 2, 3], [4, 5, 6]], dtype=ndd.int32), |
| 418 | ndd.tensor([[7, 8, 9, 10], [11, 12, 13, 14]], dtype=ndd.int32), |
| 419 | ] |
| 420 | ) |
| 421 | g0 = c0.to_device("gpu:0") |
| 422 | g1 = g0.to_device("gpu:1") |
| 423 | c1 = g1.cpu() |
| 424 | assert batch_equal(asnumpy(c0), asnumpy(c1)) |
| 425 | g0 = g1.to_device("gpu:0") |
| 426 | c0 = g0.cpu() |
| 427 | assert batch_equal(asnumpy(c0), asnumpy(c1)) |
| 428 | |
| 429 | |
| 430 | @eval_modes() |
nothing calls this directly
no test coverage detected