code: def test_device_transfer(
      benchmark,
      result_device_id,
      client_of_sg_server_on_device_1_with_test_array,
  ):
      (
          client,
          test_array_id,
          nbytes,
      ) = client_of_sg_server_on_device_1_with_test_array
  
      # device to host via RPC is too slow for large transfers, so skip
      if result_device_id is None and nbytes > 1e6:
          return
  
      bytes_returned = benchmark(
          client._receive_test_array,
          test_array_id,
          result_device=result_device_id,
      )
  
      # bytes_returned should be a cupy array of int8 values on
      # result_device_id, and each value should be 1.
      # Why not uint8 and value 255? Because when transferring data to a CPU
      # (result_device=None), Apache Thrift is used, which does not support
      # unsigned int types.
      assert len(bytes_returned) == nbytes
      if result_device_id is None:
          assert type(bytes_returned) is list
          assert False not in [n == 1 for n in bytes_returned]
      else:
          assert type(bytes_returned) is cp.ndarray
          assert (bytes_returned == cp.ones(nbytes, dtype="int8")).all()
          device_n = cp.cuda.Device(result_device_id)
          assert bytes_returned.device == device_n
  
imports: import os
  from pathlib import Path
  import pytest
  import cupy
  from cugraph_service_server.testing import utils
  from .None import data
label_desc: Use image node_id 11 for calling a global function with example usage: test_device_transfer(benchmark, result_device_id, client_of_sg_server_on_device_1_with_test_array) without return types