---
title: create_cpu_cache
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/others/llmdatadistdev/llmpr_42_0053.html
sourcePath: /source/zh/canncommercial/900/others/llmdatadistdev/llmpr_42_0053.html
indexId: e75a173cc3e69eee6d6f6b25ded57219c112f6efec6b6308c25b8d6364c4858470
---
# create_cpu_cache

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | x |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | x |
| Atlas 推理系列产品 | x |
| Atlas 训练系列产品 | x |


说明：针对 Atlas A2 训练系列产品 / Atlas A2 推理系列产品 ，仅支持Atlas 800I A2 推理服务器、A200I A2 Box 异构组件。


#### 函数功能

创建cpu cache。


#### 函数原型

```
create_cpu_cache(cache_desc: CacheDesc, addrs: Union[List[int], List[List[int]]])
```


#### 参数说明

| 参数名称 | 数据类型 | 取值说明 |
| --- | --- | --- |
| cache\_desc | CacheDesc | cache的描述。 |
| addrs | Union[List[int], List[List[int]]] | cpu cache的地址。 |


#### 调用示例

```
from llm_datadist import KvCache
cpu_addrs = []
# 单进程多卡模式下，配置多卡的地址。
# cpu_addrs = [[]]
cpu_cache = KvCache.create_cpu_cache(cpu_cache_desc, cpu_addrs) # cpu_addrs来自创建的cpu tensors
```


#### 返回值

正常情况返回类型为KvCache的cpu_cache。

传入数据类型错误情况下会抛出TypeError或ValueError异常。

传入参数为None，会抛出AttributeError异常。


#### 约束说明

无
