ASCEND_MAX_OP_CACHE_SIZE
Description
- If the size of the build cache file exceeds the value of this environment variable and the cache file is not accessed for more than half an hour, the cache file is aged.
- To disable the build cache aging function, set the environment variable ASCEND_MAX_OP_CACHE_SIZE to -1. In this case, the access time is not updated when the operator cache is accessed, the operator build cache is not aged, and the default drive space is 500 MB.
Operator build is not interrupted when the size of the build cache file exceeds the configured value. If the value of this environment variable is configured too small, the actual size of the build cache file may exceed the configured value.
Example
export ASCEND_MAX_OP_CACHE_SIZE=500
Restrictions
The priorities for the system to read the size of the cache space are as follows:
Configuration file op_cache.ini in the disk cache directory for operator compilation > Environment variable ASCEND_MAX_OP_CACHE_SIZE > Default value.
If both the op_cache.ini file and the environment variable are configured, the configuration options in the op_cache.ini file are read first. If neither the op_cache.ini file nor the environment variable is configured, the default system value is read. The default drive space is 500 MB.
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 the PyTorch scenario, set ACL_OP_COMPILER_CACHE_DIR. For details about ACL_OP_COMPILER_CACHE_DIR.
- In the TensorFlow scenario, set the op_compiler_cache_dir parameter.
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 disk space of the cache folder on the Ascend AI Processor (unit: MB).
max_op_cache_size=500
# When the disk space is insufficient, set the ratio of the cache space to be reserved. The value ranges from 1 to 100, in percentage. For example, 80 indicates that 80% of the cache files are reserved and other files are deleted when the disk space is insufficient.
remain_cache_size_ratio=80