code: def _get_compiler_base_options(compiler_path):
      # Try compiling a dummy code.
      # If the compilation fails, try to parse the output of compilation
      # and try to compose base options according to it.
      # compiler_path is the path to nvcc (CUDA) or hipcc (ROCm/HIP)
      with _tempdir() as temp_dir:
          test_cu_path = os.path.join(temp_dir, "test.cu")
          test_out_path = os.path.join(temp_dir, "test.out")
          with open(test_cu_path, "w") as f:
              f.write("int main() { return 0; }")
          proc = subprocess.Popen(
              compiler_path + ["-o", test_out_path, test_cu_path],
              stdout=subprocess.PIPE,
              stderr=subprocess.PIPE,
          )
          stdoutdata, stderrdata = proc.communicate()
          stderrlines = stderrdata.split(b"\n")
          if proc.returncode != 0:
              # No supported host compiler
              matches = _match_output_lines(
                  stderrlines,
                  [
                      b"^ERROR: No supported gcc/g\\+\\+ host compiler found, "
                      b"but .* is available.$",
                      b"^ *Use 'nvcc (.*)' to use that instead.$",
                  ],
              )
              if matches is not None:
                  base_opts = matches[1].group(1)
                  base_opts = base_opts.decode("utf8").split(" ")
                  return base_opts
  
              # Unknown error
              raise RuntimeError(
                  "Encountered unknown error while testing nvcc:\n"
                  + stderrdata.decode("utf8")
              )
  
      return []
  
imports: import contextlib
  import os
  import re
  import shlex
  import shutil
  import subprocess
  import sys
  import tempfile
  from typing import List, Set
  import cupy_builder
  import cupy_builder.install_utils
  from cupy_builder import _environment
  from cupy_builder._context import Context
label_desc: Use image node_id 9 for calling a global function with example usage: _get_compiler_base_options(compiler_path) and returns: list, base_opts