---
title: aclrtDeviceEnablePeerAccess
description: "使能当前Device与指定Device之间的内存复制，同步接口。使能内存复制是Device级的。"
url: https://www.hiascend.com/document/detail/zh/Atlas200IDKA2DeveloperKit/latest/Application%20Development%20Guide/aadgc/aclcppdevg_03_0110.html
sourcePath: /source/zh/Atlas200IDKA2DeveloperKit/23.0.RC2/Application Development Guide/aadgc/aclcppdevg_03_0110.html
indexId: 94faedff7db574a6ad5f4a5c1c4c7897bc68ea9e9425bf3cb415e79f783622c2105
---
# aclrtDeviceEnablePeerAccess

#### 函数功能

使能当前Device与指定Device之间的内存复制，同步接口。使能内存复制是Device级的。

Atlas 200/500 A2推理产品，不支持该接口。


#### 约束说明

可提前调用aclrtDeviceCanAccessPeer接口显查询当前Device与指定Device之间能否进行内存复制。使能Device间的内存复制功能后，若想关闭该功能，可调用aclrtDeviceDisablePeerAccess接口。


#### 函数原型

aclError aclrtDeviceEnablePeerAccess(int32_t peerDeviceId, uint32_t flags)


#### 参数说明

| 参数名 | 输入/输出 | 说明 |
| --- | --- | --- |
| peerDeviceId | 输入 | Device ID，该ID不能与当前Device的ID相同。 用户调用aclrtGetDeviceCount接口获取可用的Device数量后，这个Device ID的取值范围：[0, (可用的Device数量\-1)] |
| flags | 输入 | 保留参数，当前必须设置为0。 |


#### 返回值说明

返回0表示成功，返回其它值表示失败。
