()
| 825 | |
| 826 | |
| 827 | def test_copy_to(): |
| 828 | _, buf = make_random_buffer(size=10, target='device') |
| 829 | mm_cuda = buf.memory_manager |
| 830 | |
| 831 | for dest in [mm_cuda, mm_cuda.device]: |
| 832 | arr = pa.array([0, 1, 2]) |
| 833 | arr_cuda = arr.copy_to(dest) |
| 834 | assert not arr_cuda.buffers()[1].is_cpu |
| 835 | assert arr_cuda.buffers()[1].device_type == pa.DeviceAllocationType.CUDA |
| 836 | assert arr_cuda.buffers()[1].device == mm_cuda.device |
| 837 | |
| 838 | arr_roundtrip = arr_cuda.copy_to(pa.default_cpu_memory_manager()) |
| 839 | assert arr_roundtrip.equals(arr) |
| 840 | |
| 841 | batch = pa.record_batch({"col": arr}) |
| 842 | batch_cuda = batch.copy_to(dest) |
| 843 | buf_cuda = batch_cuda["col"].buffers()[1] |
| 844 | assert not buf_cuda.is_cpu |
| 845 | assert buf_cuda.device_type == pa.DeviceAllocationType.CUDA |
| 846 | assert buf_cuda.device == mm_cuda.device |
| 847 | |
| 848 | batch_roundtrip = batch_cuda.copy_to(pa.default_cpu_memory_manager()) |
| 849 | assert batch_roundtrip.equals(batch) |
| 850 | |
| 851 | |
| 852 | def test_device_interface_array(): |
nothing calls this directly
no test coverage detected