code: def cuda_serialize_cupy_ndarray(x):
      # Making sure `x` is behaving
      if not (x.flags["C_CONTIGUOUS"] or x.flags["F_CONTIGUOUS"]):
          x = cupy.array(x, copy=True)
  
      header = x.__cuda_array_interface__.copy()
      header["strides"] = tuple(x.strides)
      frames = [
          cupy.ndarray(
              shape=(x.nbytes,),
              dtype=cupy.dtype("u1"),
              memptr=x.data,
              strides=(1,),
          )
      ]
  
      return header, frames
  
file_path: distributed/distributed/protocol/cupy.py
imports: from __future__ import annotations
  import copyreg
  import cupy
  from distributed.protocol.cuda import cuda_deserialize, cuda_serialize
  from distributed.protocol.serialize import dask_deserialize, dask_serialize, register_generic
label_desc: Use image node_id 1 for calling a global function with example usage: cuda_serialize_cupy_ndarray(x) and returns: header,  frames