code: def get_compiler_setting(ctx: Context, use_hip):
      cuda_path = None
      rocm_path = None
  
      if use_hip:
          rocm_path = get_rocm_path()
      else:
          cuda_path = get_cuda_path()
  
      include_dirs = ctx.include_dirs.copy()
      library_dirs = ctx.library_dirs.copy()
      define_macros = []
      extra_compile_args = []
  
      if cuda_path:
          include_dirs.append(os.path.join(cuda_path, "include"))
          if PLATFORM_WIN32:
              library_dirs.append(os.path.join(cuda_path, "bin"))
              library_dirs.append(os.path.join(cuda_path, "lib", "x64"))
          else:
              library_dirs.append(os.path.join(cuda_path, "lib64"))
              library_dirs.append(os.path.join(cuda_path, "lib"))
  
      if rocm_path:
          include_dirs.append(os.path.join(rocm_path, "include"))
          include_dirs.append(os.path.join(rocm_path, "include", "hip"))
          include_dirs.append(
              os.path.join(rocm_path, "include", "rocrand")
          )
          include_dirs.append(
              os.path.join(rocm_path, "include", "hiprand")
          )
          include_dirs.append(
              os.path.join(rocm_path, "include", "roctracer")
          )
          library_dirs.append(os.path.join(rocm_path, "lib"))
  
      if use_hip:
          extra_compile_args.append("-std=c++11")
  
      if PLATFORM_WIN32:
          nvtx_path = _environment.get_nvtx_path()
          if nvtx_path is not None and os.path.exists(nvtx_path):
              include_dirs.append(os.path.join(nvtx_path, "include"))
          else:
              define_macros.append(("CUPY_NO_NVTX", "1"))
  
      # For CUB, we need the complex and CUB headers. The search precedence for
      # the latter is:
      #   - for CUDA: CuPy's CUB (and Thrust) bundle
      #   - for ROCm: built-in CUB
      # Note that starting CuPy v8 we no longer use CUB_PATH, and starting v13
      # we no longer use Thrust/CUB bundled in CUDA.
  
      # for <cupy/complex.cuh>
      cupy_header = os.path.join(
          cupy_builder.get_context().source_root, "cupy/_core/include"
      )
      global _jitify_path
      _jitify_path = os.path.join(cupy_header, "cupy/_jitify")
      global _cub_path
      if rocm_path:
          _cub_path = os.path.join(rocm_path, "include", "hipcub")
          if not os.path.exists(_cub_path):
              raise Exception("Please install hipCUB and retry")
          _thrust_path = None
          _libcudacxx_path = None
      else:
          # all bundled together under cccl
          _cub_path = os.path.join(cupy_header, "cupy/_cccl/cub")
          _thrust_path = os.path.join(cupy_header, "cupy/_cccl/thrust")
          _libcudacxx_path = os.path.join(
              cupy_header, "cupy/_cccl/libcudacxx"
          )
      include_dirs.insert(0, cupy_header)
      include_dirs.insert(0, _cub_path)
      if _thrust_path and _libcudacxx_path:
          include_dirs.insert(0, _thrust_path)
          include_dirs.insert(0, _libcudacxx_path)
  
      return {
          "include_dirs": include_dirs,
          "library_dirs": library_dirs,
          "define_macros": define_macros,
          "language": "c++",
          "extra_compile_args": extra_compile_args,
      }
  
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 6 for calling a global function with example usage: get_compiler_setting(ctx, use_hip) and returns: dict