Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 :
11 : #include "remote_access.h"
12 : #include <algorithm>
13 : #include "remote_access_impl.h"
14 :
15 : namespace hccl {
16 : using namespace std;
17 :
18 0 : RemoteAccess::RemoteAccess() {}
19 :
20 0 : RemoteAccess::~RemoteAccess() { impl_ = nullptr; }
21 :
22 0 : HcclResult RemoteAccess::Init(u32 rank, const vector<MemRegisterAddr>& addrInfos, const RmaRankTable& rankTable)
23 : {
24 0 : impl_.reset(new (std::nothrow) RemoteAccessImpl());
25 0 : CHK_PTR_NULL(impl_);
26 0 : CHK_RET(impl_->Init(rank, addrInfos, rankTable));
27 0 : return HCCL_SUCCESS;
28 : }
29 :
30 0 : HcclResult RemoteAccess::RemoteRead(const vector<HcomRemoteAccessAddrInfo>& addrInfos, HcclRtStream stream)
31 : {
32 0 : CHK_PTR_NULL(impl_);
33 0 : CHK_PTR_NULL(stream);
34 0 : CHK_RET(impl_->RemoteRead(addrInfos, stream));
35 0 : return HCCL_SUCCESS;
36 : }
37 :
38 0 : HcclResult RemoteAccess::RemoteWrite(const vector<HcomRemoteAccessAddrInfo>& addrInfos, HcclRtStream stream)
39 : {
40 0 : CHK_PTR_NULL(impl_);
41 0 : CHK_PTR_NULL(stream);
42 0 : CHK_RET(impl_->RemoteWrite(addrInfos, stream));
43 0 : return HCCL_SUCCESS;
44 : }
45 : } // namespace hccl
|