!966 sync code 0116 h
From: @changzherui Reviewed-by: @liujunzhu,@ljl0711 Signed-off-by: @ljl0711pull/966/MERGE
commit
687d5f2ab1
@ -0,0 +1,73 @@
|
||||
/**
|
||||
* Copyright 2019-2020 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef INC_EXTERNAL_ACL_ACL_H_
|
||||
#define INC_EXTERNAL_ACL_ACL_H_
|
||||
|
||||
#include "acl_rt.h"
|
||||
#include "acl_op.h"
|
||||
#include "acl_mdl.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Current version is 1.0.0
|
||||
#define ACL_MAJOR_VERSION 1
|
||||
#define ACL_MINOR_VERSION 0
|
||||
#define ACL_PATCH_VERSION 0
|
||||
|
||||
/**
|
||||
* @ingroup AscendCL
|
||||
* @brief acl initialize
|
||||
*
|
||||
* @par Restriction
|
||||
* The aclInit interface can be called only once in a process
|
||||
* @param configPath [IN] the config path,it can be NULL
|
||||
* @retval ACL_SUCCESS The function is successfully executed.
|
||||
* @retval OtherValues Failure
|
||||
*/
|
||||
ACL_FUNC_VISIBILITY aclError aclInit(const char *configPath);
|
||||
|
||||
/**
|
||||
* @ingroup AscendCL
|
||||
* @brief acl finalize
|
||||
*
|
||||
* @par Restriction
|
||||
* Need to call aclFinalize before the process exits.
|
||||
* After calling aclFinalize,the services cannot continue to be used normally.
|
||||
* @retval ACL_SUCCESS The function is successfully executed.
|
||||
* @retval OtherValues Failure
|
||||
*/
|
||||
ACL_FUNC_VISIBILITY aclError aclFinalize();
|
||||
|
||||
/**
|
||||
* @ingroup AscendCL
|
||||
* @brief query ACL interface version
|
||||
*
|
||||
* @param majorVersion[OUT] ACL interface major version
|
||||
* @param minorVersion[OUT] ACL interface minor version
|
||||
* @param patchVersion[OUT] ACL interface patch version
|
||||
* @retval ACL_SUCCESS The function is successfully executed.
|
||||
* @retval OtherValues Failure
|
||||
*/
|
||||
ACL_FUNC_VISIBILITY aclError aclrtGetVersion(int32_t *majorVersion, int32_t *minorVersion, int32_t *patchVersion);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // INC_EXTERNAL_ACL_ACL_H_
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,134 @@
|
||||
/**
|
||||
* Copyright 2019-2020 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file hccl.h
|
||||
* @brief HCCL API
|
||||
*/
|
||||
|
||||
#ifndef HCCL_H_
|
||||
#define HCCL_H_
|
||||
|
||||
#include <hccl/hccl_types.h>
|
||||
#include <acl/acl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/**
|
||||
* @brief Initialize HCCL.
|
||||
*
|
||||
* @param clusterInfo A string identifying the cluster info file path, include file name.
|
||||
* @param rank A integer identifying the identify for the rank.
|
||||
* @param comm A pointer identifying the initialized communication resource.
|
||||
* @return HcclResult
|
||||
* @see HcclCommDestroy()
|
||||
*/
|
||||
extern HcclResult HcclCommInitClusterInfo(const char *clusterInfo, uint32_t rank, HcclComm *comm);
|
||||
|
||||
/**
|
||||
* @brief Get hccl root info.
|
||||
*
|
||||
* @param rootInfo A pointer identifying the hccl root info.
|
||||
* @return HcclResult
|
||||
*/
|
||||
extern HcclResult HcclGetRootInfo(HcclRootInfo *rootInfo);
|
||||
|
||||
/**
|
||||
* @brief Initialize HCCL with root info.
|
||||
*
|
||||
* @param nRanks A integer identifying the rank size of the cluster.
|
||||
* @param rootInfo A struct identifying the hccl root info.
|
||||
* @param rank A integer identifying the identify for the rank.
|
||||
* @param comm A pointer identifying the initialized communication resource.
|
||||
* @return HcclResult
|
||||
* @see HcclCommDestroy()
|
||||
*/
|
||||
extern HcclResult HcclCommInitRootInfo(uint32_t nRanks, const HcclRootInfo *rootInfo, uint32_t rank, HcclComm *comm);
|
||||
|
||||
/**
|
||||
* @brief AllReduce operator.
|
||||
*
|
||||
* @param sendBuf A pointer identifying the input data address of the operator.
|
||||
* @param recvBuf A pointer identifying the output data address of the operator.
|
||||
* @param count An integer(u64) identifying the number of the output data.
|
||||
* @param dataType The data type of the operator, must be one of the following types: int8, int16, int32, float16,
|
||||
* float32.
|
||||
* @param op The reduction type of the operator, must be one of the following types: sum, min, max, prod.
|
||||
* @param comm A pointer identifying the communication resource based on.
|
||||
* @param stream A pointer identifying the stream information.
|
||||
* @return HcclResult
|
||||
*/
|
||||
extern HcclResult HcclAllReduce(void *sendBuf, void *recvBuf, uint64_t count, HcclDataType dataType, HcclReduceOp op,
|
||||
HcclComm comm, aclrtStream stream);
|
||||
|
||||
/**
|
||||
* @brief Broadcast operator.
|
||||
*
|
||||
* @param buf A pointer identifying the data address of the operator.
|
||||
* @param count An integer(u64) identifying the number of the data.
|
||||
* @param dataType The data type of the operator, must be one of the following types: int8, int32, float16, float32.
|
||||
* @param root An integer(u32) identifying the the root rank in the operator.
|
||||
* @param comm A pointer identifying the communication resource based on
|
||||
* @param stream A pointer identifying the stream information.
|
||||
* @return HcclResult
|
||||
*/
|
||||
extern HcclResult HcclBroadcast(void *buf, uint64_t count, HcclDataType dataType, uint32_t root, HcclComm comm,
|
||||
aclrtStream stream);
|
||||
|
||||
/**
|
||||
* @brief ReduceScatter operator.
|
||||
*
|
||||
* @param sendBuf A pointer identifying the input data address of the operator.
|
||||
* @param recvBuf A pointer identifying the output data address of the operator.
|
||||
* @param recvCount An integer(u64) identifying the number of the output data.
|
||||
* @param dataType The data type of the operator, must be one of the following types: int8, int32, float16, float32.
|
||||
* @param op The reduction type of the operator, must be one of the following types: sum, min, max, prod.
|
||||
* @param comm A pointer identifying the communication resource based on.
|
||||
* @param stream A pointer identifying the stream information.
|
||||
* @return HcclResult
|
||||
*/
|
||||
extern HcclResult HcclReduceScatter(void *sendBuf, void *recvBuf, uint64_t recvCount, HcclDataType dataType,
|
||||
HcclReduceOp op, HcclComm comm, aclrtStream stream);
|
||||
|
||||
/**
|
||||
* @brief AllGather operator.
|
||||
*
|
||||
* @param sendBuf A pointer identifying the input data address of the operator.
|
||||
* @param recvBuf A pointer identifying the output data address of the operator.
|
||||
* @param sendCount An integer(u64) identifying the number of the input data.
|
||||
* @param dataType The data type of the operator, must be one of the following types: int8, int32, float16, float32.
|
||||
* @param comm A pointer identifying the communication resource based on.
|
||||
* @param stream A pointer identifying the stream information.
|
||||
* @return HcclResult
|
||||
*/
|
||||
extern HcclResult HcclAllGather(void *sendBuf, void *recvBuf, uint64_t sendCount, HcclDataType dataType, HcclComm comm,
|
||||
aclrtStream stream);
|
||||
|
||||
/**
|
||||
* @brief Destroy HCCL comm
|
||||
*
|
||||
* @param comm A pointer identifying the communication resource targetting
|
||||
* @return HcclResult
|
||||
* @see HcclCommInitClusterInfo()
|
||||
*/
|
||||
extern HcclResult HcclCommDestroy(HcclComm comm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
#endif // HCCL_H_
|
@ -0,0 +1,101 @@
|
||||
/**
|
||||
* Copyright 2019-2020 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file hccl_types.h
|
||||
* @brief HCCL data type definition
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HCCL_TYPES_H_
|
||||
#define HCCL_TYPES_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/**
|
||||
* @brief HCCL functions return value definition
|
||||
*/
|
||||
typedef enum {
|
||||
HCCL_SUCCESS = 0, /**< success */
|
||||
HCCL_E_PARA = 1, /**< parameter error */
|
||||
HCCL_E_PTR = 2, /**< empty pointer */
|
||||
HCCL_E_MEMORY = 3, /**< memory error */
|
||||
HCCL_E_INTERNAL = 4, /**< internal error */
|
||||
HCCL_E_NOT_SUPPORT = 5, /**< not support feature */
|
||||
HCCL_E_NOT_FOUND = 6, /**< not found specific resource */
|
||||
HCCL_E_UNAVAIL = 7, /**< resource unavailable */
|
||||
HCCL_E_SYSCALL = 8, /**< call system interface error */
|
||||
HCCL_E_TIMEOUT = 9, /**< timeout */
|
||||
HCCL_E_OPEN_FILE_FAILURE = 10, /**< open file fail */
|
||||
HCCL_E_TCP_CONNECT = 11, /**< tcp connect fail */
|
||||
HCCL_E_ROCE_CONNECT = 12, /**< roce connect fail */
|
||||
HCCL_E_TCP_TRANSFER = 13, /**< tcp transfer fail */
|
||||
HCCL_E_ROCE_TRANSFER = 14, /**< roce transfer fail */
|
||||
HCCL_E_RUNTIME = 15, /**< call runtime api fail */
|
||||
HCCL_E_DRV = 16, /**< call driver api fail */
|
||||
HCCL_E_PROFILING = 17, /**< call profiling api fail */
|
||||
HCCL_E_CCE = 18, /**< call cce api fail */
|
||||
HCCL_E_NETWORK = 19, /**< call network api fail */
|
||||
HCCL_E_RESERVED /**< reserved */
|
||||
} HcclResult;
|
||||
|
||||
/**
|
||||
* @brief handle to HCCL communicator
|
||||
*/
|
||||
typedef void *HcclComm;
|
||||
|
||||
/**
|
||||
* @brief HCCL Reduction opperation
|
||||
*/
|
||||
typedef enum {
|
||||
HCCL_REDUCE_SUM = 0, /**< sum */
|
||||
HCCL_REDUCE_PROD = 1, /**< prod */
|
||||
HCCL_REDUCE_MAX = 2, /**< max */
|
||||
HCCL_REDUCE_MIN = 3, /**< min */
|
||||
HCCL_REDUCE_RESERVED /**< reserved */
|
||||
} HcclReduceOp;
|
||||
|
||||
/**
|
||||
* @brief HCCL data type
|
||||
*/
|
||||
typedef enum {
|
||||
HCCL_DATA_TYPE_INT8 = 0, /**< int8 */
|
||||
HCCL_DATA_TYPE_INT16 = 1, /**< int16 */
|
||||
HCCL_DATA_TYPE_INT32 = 2, /**< int32 */
|
||||
HCCL_DATA_TYPE_FP16 = 3, /**< fp16 */
|
||||
HCCL_DATA_TYPE_FP32 = 4, /**< fp32 */
|
||||
HCCL_DATA_TYPE_INT64 = 5, /**< int64 */
|
||||
HCCL_DATA_TYPE_UINT64 = 6, /**< uint64 */
|
||||
HCCL_DATA_TYPE_RESERVED /**< reserved */
|
||||
} HcclDataType;
|
||||
|
||||
const uint32_t HCCL_ROOT_INFO_BYTES = 4108; // 4108: root info length
|
||||
|
||||
/**
|
||||
* @brief HCCL root info
|
||||
*/
|
||||
typedef struct HcclRootInfoDef {
|
||||
char internal[HCCL_ROOT_INFO_BYTES];
|
||||
} HcclRootInfo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
#endif // HCCL_TYPES_H_
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue