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_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.\nPlease'
          ' note that each additional compute '
          'capability significantly increases your '
          'build time and binary size. [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: ' % compute_capability)
          all_valid = False
        else:
          ver = int(m.group(0).split('.')[0])
          if ver < 3:
            print('Only compute capabilities 3.0 or higher are supported.')
            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_tf_cuda_compute_capabilities ( environ_cp ) : 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. [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: ' % compute_capability ) all_valid = False else : ver = int ( m . group ( 0 ) . split ( '.' ) [ 0 ] ) if ver < 3 : print ( 'Only compute capabilities 3.0 or higher are supported.' ) 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 )