code: def compile_device_code(
      ctx: Context, ext: setuptools.Extension
  ) -> Tuple[List[str], List[str]]:
      """Compiles device code ("*.cu").
  
      This method invokes the device compiler (nvcc/hipcc) to build object
      files from device code, then returns the tuple of:
      - list of remaining (non-device) source files ("*.cpp")
      - list of compiled object files for device code ("*.o")
      """
      sources_cu, sources_cpp = filter_files_by_extension(
          ext.sources, ".cu"
      )
      if len(sources_cu) == 0:
          # No device code used in this extension.
          return ext.sources, []
  
      if sys.platform == "win32":
          compiler = DeviceCompilerWin32(ctx)
      else:
          compiler = DeviceCompilerUnix(ctx)
  
      objects = []
      for src in sources_cu:
          print(f"{ext.name}: Device code: {src}")
          obj_ext = "obj" if sys.platform == "win32" else "o"
          # TODO(kmaehashi): embed CUDA version in path
          obj = f"build/temp.device_objects/{src}.{obj_ext}"
          if os.path.exists(obj) and (
              _get_timestamp(src) < _get_timestamp(obj)
          ):
              print(f"{ext.name}: Reusing cached object file: {obj}")
          else:
              os.makedirs(os.path.dirname(obj), exist_ok=True)
              print(f"{ext.name}: Building: {obj}")
              compiler.compile(obj, src, ext)
          objects.append(obj)
  
      return sources_cpp, objects
  
imports: import json
  import os
  import os.path
  import subprocess
  import sys
  from typing import Any, Dict, List, Tuple
  import setuptools
  import setuptools.command.build_ext
  import cupy_builder
  import cupy_builder.install_build
  from cupy_builder._context import Context
  from cupy_builder._compiler import DeviceCompilerUnix, DeviceCompilerWin32
label_desc: Use image node_id 2 for calling a global function with example usage: compile_device_code(ctx, ext) and returns: sources_cpp,  objects, ext,  list