code: def set_tf_cuda_compute_capabilities(environ_cp):
      """Set TF_CUDA_COMPUTE_CAPABILITIES."""
      while True:
          native_cuda_compute_capabilities = (
              get_native_cuda_compute_capabilities(environ_cp)
          )
          if not native_cuda_compute_capabilities:
              default_cuda_compute_capabilities = (
                  _DEFAULT_CUDA_COMPUTE_CAPABILITIES
              )
          else:
              default_cuda_compute_capabilities = (
                  native_cuda_compute_capabilities
              )
  
          ask_cuda_compute_capabilities = (
              "Please specify a list of comma-separated CUDA compute capabilities "
              "you want to build with.\nYou can find the compute capability of your "
              "device at: https://developer.nvidia.com/cuda-gpus. Each capability "
              'can be specified as "x.y" or "compute_xy" to include both virtual and'
              ' binary GPU code, or as "sm_xy" to only include the binary '
              "code.\nPlease note that each additional compute capability "
              "significantly increases your build time and binary size, and that "
              "TensorFlow only supports compute capabilities >= 3.5 [Default is: "
              "%s]: " % default_cuda_compute_capabilities
          )
          tf_cuda_compute_capabilities = (
              get_from_env_or_user_or_default(
                  environ_cp,
                  "TF_CUDA_COMPUTE_CAPABILITIES",
                  ask_cuda_compute_capabilities,
                  default_cuda_compute_capabilities,
              )
          )
          # Check whether all capabilities from the input is valid
          all_valid = True
          # Remove all whitespace characters before splitting the string
          # that users may insert by accident, as this will result in error
          tf_cuda_compute_capabilities = "".join(
              tf_cuda_compute_capabilities.split()
          )
          for compute_capability in tf_cuda_compute_capabilities.split(
              ","
          ):
              m = re.match("[0-9]+.[0-9]+", compute_capability)
              if not m:
                  # We now support sm_35,sm_50,sm_60,compute_70.
                  sm_compute_match = re.match(
                      "(sm|compute)_?([0-9]+[0-9]+)", compute_capability
                  )
                  if not sm_compute_match:
                      print(
                          "Invalid compute capability: %s"
                          % compute_capability
                      )
                      all_valid = False
                  else:
                      ver = int(sm_compute_match.group(2))
                      if ver < 30:
                          print(
                              "ERROR: TensorFlow only supports small CUDA compute"
                              " capabilities of sm_30 and higher. Please re-specify the list"
                              " of compute capabilities excluding version %s."
                              % ver
                          )
                          all_valid = False
                      if ver < 35:
                          print(
                              "WARNING: XLA does not support CUDA compute capabilities "
                              "lower than sm_35. Disable XLA when running on older GPUs."
                          )
              else:
                  ver = float(m.group(0))
                  if ver < 3.0:
                      print(
                          "ERROR: TensorFlow only supports CUDA compute capabilities 3.0 "
                          "and higher. Please re-specify the list of compute "
                          "capabilities excluding version %s." % ver
                      )
                      all_valid = False
                  if ver < 3.5:
                      print(
                          "WARNING: XLA does not support CUDA compute capabilities "
                          "lower than 3.5. Disable XLA when running on older GPUs."
                      )
  
          if all_valid:
              break
  
          # Reset and Retry
          environ_cp["TF_CUDA_COMPUTE_CAPABILITIES"] = ""
  
      # Set TF_CUDA_COMPUTE_CAPABILITIES
      environ_cp[
          "TF_CUDA_COMPUTE_CAPABILITIES"
      ] = tf_cuda_compute_capabilities
      write_action_env_to_bazelrc(
          "TF_CUDA_COMPUTE_CAPABILITIES", tf_cuda_compute_capabilities
      )
  
imports: import argparse
  import errno
  import glob
  import json
  import os
  import platform
  import re
  import subprocess
  import sys
label_desc: Use image node_id 42 for calling a global function with example usage: set_tf_cuda_compute_capabilities(environ_cp) without return types