MCPcopy Create free account
hub / github.com/NVIDIA/DALI / test_cross_device_copy

Function test_cross_device_copy

dali/test/python/experimental_mode/test_batch.py:412–427  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

410@eval_modes()
411@attr("multi_gpu")
412def 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()

Callers

nothing calls this directly

Calls 5

batch_equalFunction · 0.85
as_batchMethod · 0.80
asnumpyFunction · 0.70
to_deviceMethod · 0.45
cpuMethod · 0.45

Tested by

no test coverage detected