---
title: aclrtMemSetAccess
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/runtimeapi/aclcppdevg_03_2044.html
sourcePath: /source/zh/canncommercial/900/API/runtimeapi/aclcppdevg_03_2044.html
indexId: 85a66117179460154f6da34111429704c4c79ccc3f2e183fe0a2af5c2df2e51768
---
# aclrtMemSetAccess

#### 产品支持情况

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


#### 功能说明

设置内存的访问权限。


#### 函数原型

```
aclError aclrtMemSetAccess(void* virPtr, size_t size, aclrtMemAccessDesc* desc, size_t count)
```


#### 参数说明

| 参数名 | 输入/输出 | 说明 |
| --- | --- | --- |
| virPtr | 输入 | 虚拟内存的起始地址。 必须与aclrtMapMem接口的virPtr地址相同。 |
| size | 输入 | 虚拟内存的长度。 必须与aclrtMapMem接口的size相同。 |
| desc | 输入 | 内存访问的配置信息，包含内存访问保护标志、内存所在位置等。类型定义请参见aclrtMemAccessDesc。 |
| count | 输入 | desc数组长度。 |


#### 返回值说明

返回0表示成功，返回其他值表示失败，请参见aclError。


#### 接口调用示例

接口调用示例，参见进程间通信(https://www.hiascend.com/document/detail/zh/canncommercial/900/programug/acldevg/runtime_doc_dev_0038.html)。
