ASCEND_REMAIN_CACHE_SIZE_RATIO
Description
Specifies the percentage of cache space to be reserved when the operator compilation cache function is enabled. When the occupied compilation cache space reaches ASCEND_MAX_OP_CACHE_SIZE and old kernel files need to be purged, the system will reserve a proportion of the cache space as specified by this variable. The default value is 50, measured in percent.
Example
export ASCEND_REMAIN_CACHE_SIZE_RATIO=50
Restrictions
The priority for the system to read the ratio of the reserved cache space is as follows:
Configuration file op_cache.ini in the disk cache directory for operator compilation > Environment variable ASCEND_REMAIN_CACHE_SIZE_RATIO > Default value.
If both the op_cache.ini file and the environment variable are configured, the configuration options in the op_cache.ini file take precedence. If neither the op_cache.ini file nor the environment variable is configured, the system applies the default value: 50% of the cache space will be reserved.
For details about the op_cache.ini configuration file, see op_cache.ini File.
op_cache.ini File
After the operator build cache function is enabled, the op_cache.ini file is automatically generated in the specified disk cache directory for operator build. You can configure the cache disk space in this configuration file. If the op_cache.ini file does not exist, manually create it in the directory.
The method of specifying the disk cache directory for operator build varies depending on the scenario. For example:
- To develop AI applications using AscendCL APIs, set ACL_OP_COMPILER_CACHE_DIR in the aclCompileOpt API.
- During Ascend graph build, set the ge.op_compiler_cache_dir parameter.
- During model conversion with ATC, set the --op_compiler_cache_dir parameter.
- In PyTorch scenarios, set ACL_OP_COMPILER_CACHE_DIR. For details about ACL_OP_COMPILER_CACHE_DIR, see Ascend Extension for PyTorch Environment Variable Reference .
- In the TensorFlow framework scenario, set the op_compiler_cache_dir parameter.
For details about the TF Adapter configuration parameter op_compiler_cache_dir, see:
- Session Configuration > Session Configuration Parameters in TF Adapter API (1.x).
- Session Configuration > Session Configuration Parameters in TF Adapter API (1.x).
The preceding scenarios are only examples. For details, see the user manual of the corresponding scenario.
Add the following information to the op_cache.ini file:
# Configure the file format (required). The automatically generated file contains the following information by default. When manually creating a file, enter the following information: [op_compiler_cache] # Limit the drive space of the cache folder on a chip (unit: MB). ascend_max_op_cache_size=500 # Set the ratio of the cache size to be reserved. The value range is [1,100], in percentage. For example, 80 indicates that when the cache space is insufficient, 80% of the cache space is reserved and the rest is cleared up. ascend_remain_cache_size_ratio=80
Applicable Models
All processors