parameters: (environ_cp)
docstring: Set TF_CUDA_COMPUTE_CAPABILITIES.
docstring_summary: Set TF_CUDA_COMPUTE_CAPABILITIES.
docstring_tokens: Set TF_CUDA_COMPUTE_CAPABILITIES .
function: def set_cuda_compute_capabilities(environ_cp):
      """Set TF_CUDA_COMPUTE_CAPABILITIES."""
      if not _INTERACTIVE_MODE:
          native_cuda_compute_capabilities = get_native_cuda_compute_capabilities(
              environ_cp)
          if native_cuda_compute_capabilities:
              tf_cuda_compute_capabilities = native_cuda_compute_capabilities
          else:
              tf_cuda_compute_capabilities = _DEFAULT_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)
          return
  
      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.\nPlease'
              ' note that each additional compute '
              'capability significantly increases your '
              'build time and binary size, and that '
              'we only supports compute '
              'capabilities >= 3.7 [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:
                  print('Invalid compute capability: %s' % compute_capability)
                  all_valid = False
              else:
                  ver = float(m.group(0))
                  if ver < 3.5:
                      print(
                          'ERROR: We only supports CUDA compute capabilities 3.7 '
                          'and higher. Please re-specify the list of compute '
                          'capabilities excluding version %s.' % ver)
                      all_valid = False
  
          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)
function_tokens: def set_cuda_compute_capabilities ( environ_cp ) : if not _INTERACTIVE_MODE : native_cuda_compute_capabilities = get_native_cuda_compute_capabilities ( environ_cp ) if native_cuda_compute_capabilities : tf_cuda_compute_capabilities = native_cuda_compute_capabilities else : tf_cuda_compute_capabilities = _DEFAULT_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 ) return 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.\nPlease' ' note that each additional compute ' 'capability significantly increases your ' 'build time and binary size, and that ' 'we only supports compute ' 'capabilities >= 3.7 [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 : print ( 'Invalid compute capability: %s' % compute_capability ) all_valid = False else : ver = float ( m . group ( 0 ) ) if ver < 3.5 : print ( 'ERROR: We only supports CUDA compute capabilities 3.7 ' 'and higher. Please re-specify the list of compute ' 'capabilities excluding version %s.' % ver ) all_valid = False 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 )