GPU memory limit best practices

Updated at:

Overview

Cloud Phone does not limit the GPU memory that a container can use. If an application consumes excessive GPU memory, other applications may fail to allocate memory and become abnormal. To address this issue, Cloud Phone provides custom GPU memory limit capabilities, allowing you to control GPU memory usage at two levels:

  • Process level: Limit the maximum GPU memory that each process in a container can use.

  • Application level: Limit the maximum GPU memory that a specific application can use.

This feature is available only for Cloud Phone Matrix Edition on the cpm.gx7.10xlarge instance type.

Supported Scope

  • This feature is only available for the Matrix Edition of Cloud Phone. The Instance Edition is not supported.

    Note

    The Matrix Edition is in invitational preview. To request access, submit a ticket.

  • This feature is supported only on Cloud Phone matrices that use the cpm.gx7.10xlarge instance type. Other instance types are not supported.

Customize GPU memory limits for processes in a container

Command and parameters

You can use the following command to set the GPU memory limit for each process in a container.

setprop sys.wuying.vidmem.limit $LimitationVidmem

The command takes effect immediately. No restart is required.

$LimitationVidmem specifies the maximum amount of GPU memory, in MiB, that each process in a container can use. The minimum value is 200.

Example:

setprop sys.wuying.vidmem.limit 300

This command sets the GPU memory limit for each process in the container to 300 MiB.

Note

If the combined GPU memory limits for all processes on the matrix exceed the server's total GPU memory, memory contention can still occur. Ensure that the memory allocation is reasonable.

Allocate GPU memory evenly to cloud phones

To set a limit based on an even distribution of GPU memory across all instances, set $LimitationVidmem to -2.

Example:

setprop sys.wuying.vidmem.limit -2

Cancel the GPU memory limit

To cancel the GPU memory limit, set the value of $LimitationVidmem to 0.

Example:

setprop sys.wuying.vidmem.limit 0

Customize GPU memory limits for applications

If you use an OS image or a custom image created from an OS image, you can use the following command to customize the GPU memory limit for an application:

wya config -e vidmem [pkgName]=[vidmemSize]

Parameters:

  • [pkgName]: The package name of the application whose GPU memory usage you want to limit.

  • [vidmemSize]: The amount of GPU memory, in MB, that the application can use.

    If this value is greater than the per-process GPU memory limit, the application-level limit takes precedence. If this value is left empty, the GPU memory limit for the application is removed.

Priority of GPU memory limit definitions

  • For image versions earlier than 25.07.1, the custom application-level GPU memory limit has a lower priority than the process-level limit.

  • For image versions 25.07.1 and later, the custom application-level GPU memory limit has a higher priority than the process-level limit.