code: def compile(
      source,
      nvcc="nvcc",
      options=None,
      keep=False,
      no_extern_c=False,
      arch=None,
      code=None,
      cache_dir=None,
      include_dirs=[],
      target="cubin",
  ):
      assert target in ["cubin", "ptx", "fatbin"]
  
      if not no_extern_c:
          source = 'extern "C" {\n%s\n}\n' % source
  
      if options is None:
          options = DEFAULT_NVCC_FLAGS
  
      options = options[:]
      if arch is None:
          from pycuda.driver import Error
  
          try:
              from pycuda.driver import Context
  
              arch = (
                  "sm_%d%d" % Context.get_device().compute_capability()
              )
          except Error:
              pass
  
      from pycuda.driver import CUDA_DEBUGGING
  
      if CUDA_DEBUGGING:
          cache_dir = False
          keep = True
          options.extend(["-g", "-G"])
  
      if "PYCUDA_CACHE_DIR" in os.environ and cache_dir is None:
          cache_dir = os.environ["PYCUDA_CACHE_DIR"]
  
      if "PYCUDA_DISABLE_CACHE" in os.environ:
          cache_dir = False
  
      if cache_dir is None:
          import appdirs
  
          cache_dir = os.path.join(
              appdirs.user_cache_dir("pycuda", "pycuda"),
              "compiler-cache-v1",
          )
  
          from os import makedirs
  
          try:
              makedirs(cache_dir)
          except OSError as e:
              from errno import EEXIST
  
              if e.errno != EEXIST:
                  raise
  
      if arch is not None:
          options.extend(["-arch", arch])
  
      if code is not None:
          options.extend(["-code", code])
  
      if (
          "darwin" in sys.platform
          and sys.maxsize == 9223372036854775807
      ):
          options.append("-m64")
      elif (
          "win32" in sys.platform and sys.maxsize == 9223372036854775807
      ):
          options.append("-m64")
      elif "win32" in sys.platform and sys.maxsize == 2147483647:
          options.append("-m32")
  
      include_dirs = include_dirs + [_find_pycuda_include_path()]
  
      for i in include_dirs:
          options.append("-I" + i)
  
      return compile_plain(
          source, options, keep, nvcc, cache_dir, target
      )
  
imports: from pytools import memoize
  import os
  import sys
  from tempfile import mkstemp
  from os import unlink
  from pytools.prefork import call_capture_output
label_desc: Use image node_id 7 for calling a global function with example usage: compile(source, nvcc, options, keep, no_extern_c, arch, code, cache_dir, include_dirs, target) and returns: compile_plain