code: def test_copy_from_to_host(size):
      # Create a buffer in host containing range(size)
      dt = np.dtype("uint16")
      nbytes = size * dt.itemsize
      buf = pa.allocate_buffer(nbytes, resizable=True)  # in host
      assert isinstance(buf, pa.Buffer)
      assert not isinstance(buf, cuda.CudaBuffer)
      arr = np.frombuffer(buf, dtype=dt)
      assert arr.size == size
      arr[:] = range(size)
      arr_ = np.frombuffer(buf, dtype=dt)
      np.testing.assert_equal(arr, arr_)
  
      # Create a device buffer of the same size and copy from host
      device_buffer = global_context.new_buffer(nbytes)
      assert isinstance(device_buffer, cuda.CudaBuffer)
      assert isinstance(device_buffer, pa.Buffer)
      assert device_buffer.size == nbytes
      assert not device_buffer.is_cpu
      device_buffer.copy_from_host(buf, position=0, nbytes=nbytes)
  
      # Copy back to host and compare contents
      buf2 = device_buffer.copy_to_host(position=0, nbytes=nbytes)
      arr2 = np.frombuffer(buf2, dtype=dt)
      np.testing.assert_equal(arr, arr2)
  
imports: import sys
  import sysconfig
  import pytest
  import pyarrow
  import numpy
label_desc: Use image node_id 12 for calling a global function with example usage: test_copy_from_to_host(size) without return types