---
title: 函数：mem_flush
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/runtimeapi/aclpythondevg_01_0112.html
sourcePath: /source/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0112.html
indexId: fa6f79c31d8dff4760aea543f630fdced04e24da47ec6d570045c6fa2c7d05f071
---
# 函数：mem_flush

#### 产品支持情况

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


#### 功能说明

将cache中的数据刷新到DDR中并将cache中的内容设置成无效。

该版本用户无需处理CPU与NPU之间的cache一致性，无需调用该接口。


#### 函数原型

- C函数原型
  1 aclError aclrtMemFlush(void *devPtr, size_t size)

- python函数
  1 ret = acl.rt.mem_flush(dev_ptr, size)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| dev\_ptr | int，待flush的DDR内存起始地址。 |
| size | int，待flush的DDR内存大小，单位Byte。“size”不能为0。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| ret | int，错误码，返回0表示成功，返回其它值表示失败。 |
