def _EnforceProcessMemoryLimit ( self , memory_limit ) : # Resource is not supported on Windows. if resource : if memory_limit is None : memory_limit = 4 * 1024 * 1024 * 1024 elif memory_limit == 0 : memory_limit = resource . RLIM_INFINITY resource . setrlimit ( resource . RLIMIT_DATA , ( memory_limit , memory_limit ) )
python increase the upper limit of gpu memory
Enforces a process memory limit .
def _EnforceProcessMemoryLimit(self, memory_limit):
    """Enforces a process memory limit.

    Args:
      memory_limit (int): maximum number of bytes the process is allowed
          to allocate, where 0 represents no limit and None a default of
          4 GiB.
    """
    # Resource is not supported on Windows.
    if resource:
      if memory_limit is None:
        memory_limit = 4 * 1024 * 1024 * 1024
      elif memory_limit == 0:
        memory_limit = resource.RLIM_INFINITY

      resource.setrlimit(resource.RLIMIT_DATA, (memory_limit, memory_limit))