选择分支名或 Tag 名,也可以输入一个 commit 的 ID,点击对比按钮。
| ... | @@ -0,0 +1,96 @@ |
| 2 | +Language: Cpp |
| 3 | +AccessModifierOffset: -4 |
| 4 | +AlignConsecutiveAssignments: false |
| 5 | +AlignConsecutiveDeclarations: false |
| 6 | +AlignEscapedNewlines: DontAlign |
| 7 | +AlignOperands: true |
| 8 | +AlignTrailingComments: true |
| 9 | +AllowAllArgumentsOnNextLine: true |
| 10 | +AllowShortLambdasOnASingleLine: Empty |
| 11 | +AllowAllParametersOfDeclarationOnNextLine: false |
| 12 | +AllowShortBlocksOnASingleLine: false |
| 13 | +AllowShortCaseLabelsOnASingleLine: false |
| 14 | +AllowShortFunctionsOnASingleLine: false |
| 15 | +AllowShortIfStatementsOnASingleLine: false |
| 16 | +AllowShortLoopsOnASingleLine: false |
| 17 | +AlwaysBreakAfterDefinitionReturnType: None |
| 18 | +AlwaysBreakBeforeMultilineStrings: false |
| 19 | +AlwaysBreakTemplateDeclarations: MultiLine |
| 20 | +BinPackArguments: true |
| 21 | +BinPackParameters: true |
| 22 | +AlignAfterOpenBracket: DontAlign |
| 23 | + |
| 24 | +BraceWrapping: |
| 25 | + AfterCaseLabel: false |
| 26 | + AfterClass: false |
| 27 | + AfterControlStatement: Never |
| 28 | + AfterEnum: false |
| 29 | + AfterFunction: true |
| 30 | + AfterNamespace: false |
| 31 | + AfterStruct: false |
| 32 | + AfterUnion: false |
| 33 | + AfterExternBlock: false |
| 34 | + BeforeCatch: false |
| 35 | + BeforeElse: false |
| 36 | + IndentBraces: false |
| 37 | + SplitEmptyFunction: true |
| 38 | + SplitEmptyRecord: true |
| 39 | + SplitEmptyNamespace: true |
| 40 | + |
| 41 | +BreakBeforeBinaryOperators: All |
| 42 | +BreakBeforeBraces: Custom |
| 43 | +BreakBeforeTernaryOperators: true |
| 44 | +BreakConstructorInitializersBeforeComma: false |
| 45 | +BreakInheritanceList: AfterColon |
| 46 | +ColumnLimit: 120 |
| 47 | +CommentPragmas: '^ IWYU pragma:' |
| 48 | +PackConstructorInitializers: CurrentLine |
| 49 | +ConstructorInitializerIndentWidth: 4 |
| 50 | +ContinuationIndentWidth: 4 |
| 51 | +Cpp11BracedListStyle: true |
| 52 | +DerivePointerAlignment: false |
| 53 | +DisableFormat: false |
| 54 | +ExperimentalAutoDetectBinPacking: false |
| 55 | +ForEachMacros: [ foreach ] |
| 56 | + |
| 57 | +IncludeCategories: |
| 58 | + - Regex: '^<' |
| 59 | + Priority: 3 |
| 60 | + - Regex: '^"hccl' |
| 61 | + Priority: 2 |
| 62 | + - Regex: '.*' |
| 63 | + Priority: 1 |
| 64 | + |
| 65 | +IndentCaseLabels: true |
| 66 | +IndentWidth: 4 |
| 67 | +IndentWrappedFunctionNames: false |
| 68 | +KeepEmptyLinesAtTheStartOfBlocks: false |
| 69 | +MacroBlockBegin: '' |
| 70 | +MacroBlockEnd: '' |
| 71 | +MaxEmptyLinesToKeep: 1 |
| 72 | +NamespaceIndentation: Inner |
| 73 | + |
| 74 | +PenaltyBreakBeforeFirstCallParameter: 19 |
| 75 | +PenaltyBreakComment: 300 |
| 76 | +PenaltyBreakFirstLessLess: 120 |
| 77 | +PenaltyBreakString: 1000 |
| 78 | +PenaltyExcessCharacter: 1000000 |
| 79 | +PenaltyReturnTypeOnItsOwnLine: 60 |
| 80 | + |
| 81 | +PointerAlignment: Right |
| 82 | +ReflowComments: true |
| 83 | +SortIncludes: false |
| 84 | +SpaceAfterCStyleCast: false |
| 85 | +SpaceBeforeAssignmentOperators: true |
| 86 | +SpaceBeforeParens: ControlStatements |
| 87 | +SpaceInEmptyParentheses: false |
| 88 | +SpacesBeforeTrailingComments: 1 |
| 89 | +SpacesInAngles: false |
| 90 | +SpacesInContainerLiterals: true |
| 91 | +SpacesInCStyleCastParentheses: false |
| 92 | +SpacesInParentheses: false |
| 93 | +SpacesInSquareBrackets: false |
| 94 | +Standard: Latest |
| 95 | +TabWidth: 4 |
| 96 | +UseTab: Never |
| 97 | +UseCRLF: false |
| 98 | \ No newline at end of file |
| 99 |
| ... | @@ -0,0 +1,77 @@ |
| 2 | +name: "Help Wanted|任务认领" |
| 3 | +description: 适用于社区开发者认领的功能开发、Bug修复或性能优化任务 |
| 4 | +title: "[Help Wanted|任务认领]: " |
| 5 | +labels: ["help wanted"] |
| 6 | +body: |
| 7 | + - type: markdown |
| 8 | + attributes: |
| 9 | + value: | |
| 10 | + 感谢您关注本项目! |
| 11 | + 在开始认领任务前,请确保您已经阅读了本项目的[贡献指南](../blob/master/CONTRIBUTING.md)。 |
| 12 | + |
| 13 | + - type: input |
| 14 | + id: task_title |
| 15 | + attributes: |
| 16 | + label: 任务标题 |
| 17 | + description: 用一句话概括这个任务 |
| 18 | + placeholder: 例如:实现建链优化功能 |
| 19 | + validations: |
| 20 | + required: true |
| 21 | + |
| 22 | + - type: textarea |
| 23 | + id: description |
| 24 | + attributes: |
| 25 | + label: 任务背景 |
| 26 | + description: 请说明任务的具体内容、背景和目的 |
| 27 | + placeholder: 描述需要完成的工作,以及为什么它很重要... |
| 28 | + validations: |
| 29 | + required: true |
| 30 | + |
| 31 | + - type: textarea |
| 32 | + id: goal |
| 33 | + attributes: |
| 34 | + label: 任务目标 |
| 35 | + description: 请列出要实现的具体功能点与目标 |
| 36 | + placeholder: "1. 增加XXX功能;2. 实现XXX特性;3. 单元测试" |
| 37 | + validations: |
| 38 | + required: true |
| 39 | + |
| 40 | + - type: textarea |
| 41 | + id: acceptance_criteria |
| 42 | + attributes: |
| 43 | + label: 验收标准 |
| 44 | + description: 任务完成需要满足哪些条件?(建议使用清单格式) |
| 45 | + placeholder: | |
| 46 | + - [ ] 条件 1 |
| 47 | + - [ ] 条件 2 |
| 48 | + - [ ] 条件 3 |
| 49 | + value: "- [ ] \n- [ ] \n- [ ] " |
| 50 | + |
| 51 | + - type: textarea |
| 52 | + id: resources |
| 53 | + attributes: |
| 54 | + label: 参考资料 |
| 55 | + description: 相关的文档、代码位置、设计稿或外部链接 |
| 56 | + placeholder: | |
| 57 | + - 相关代码文件:`src/core/xxx.cc` |
| 58 | + - 参考文档:[项目贡献指南](...) |
| 59 | + |
| 60 | + - type: dropdown |
| 61 | + id: difficulty |
| 62 | + attributes: |
| 63 | + label: 难度级别 |
| 64 | + description: 适合什么样的贡献者? |
| 65 | + options: |
| 66 | + - 新手友好 |
| 67 | + - 中等难度 |
| 68 | + - 高级挑战 |
| 69 | + default: 0 |
| 70 | + validations: |
| 71 | + required: true |
| 72 | + |
| 73 | + - type: input |
| 74 | + id: mentor |
| 75 | + attributes: |
| 76 | + label: 指导者(可选) |
| 77 | + description: 如果指定了指导者,可以在此填写其 GitCode 用户名 |
| 78 | + placeholder: "@username" |
| 79 |
| ... | @@ -1,22 +1,47 @@ |
| 2 | ## 描述 |
| 3 | <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> |
| 4 | |
| 5 | +## 变更类型 |
| 6 | +请选择本次引入的变更类型: |
| 7 | +<!-- [x] 表示选中 --> |
| 8 | +- [ ] 🐛 Bug修复 |
| 9 | +- [ ] ✨ 新特性 |
| 10 | +- [ ] 🚀 性能优化 |
| 11 | +- [ ] 📝 文档更新 |
| 12 | +- [ ] 📋 其他,请描述: |
| 13 | + |
| 14 | ## 关联的Issue |
| 15 | -<!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #123--> |
| 16 | -<!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> |
| 17 | +<!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> |
| 18 | +<!-- 如果这个PR不涉及Issue,可填写"NA"。--> |
| 19 | |
| 20 | ## 测试 |
| 21 | -<!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> |
| 22 | +<!--描述进行了哪些测试来验证你的改动。包括但不限于构造对应xx测试用例、二级冒烟、算子泛化等。--> |
| 23 | +已完成的测试用例和场景: |
| 24 | +1. |
| 25 | +2. |
| 26 | + |
| 27 | +补充的UT用例: |
| 28 | |
| 29 | ## 文档更新 |
| 30 | <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> |
| 31 | |
| 32 | -## 类型标签 |
| 33 | +## 合入检查 |
| 34 | +<!-- 在正式合入前,请做好必要的代码测试,用例补充,软件代码风格检查等。提高合入效率。--> |
| 35 | <!-- [x] 表示选中 --> |
| 36 | -- [ ] Bug修复 |
| 37 | -- [ ] 新特性 |
| 38 | -- [ ] 性能优化 |
| 39 | -- [ ] 文档更新 |
| 40 | -- [ ] 其他,请描述: |
| 41 | - |
| 42 | - |
| 43 | +- [ ] 🧐 已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 |
| 44 | +- [ ] 🔍 邀请 committer评论`/lgtm`前的必要检查 |
| 45 | + - [ ] 🏷️ 标题中使用了合适的类型标签(如:`[feat]`, `[fix]`) |
| 46 | + - [ ] 📄 代码修改内容已简要描述,相关文档已更新 |
| 47 | + - [ ] 📝 代码注释已更新,代码遵循项目整体代码风格 |
| 48 | + - [ ] 🧪 代码UT测试已更新,覆盖率已达标 |
| 49 | + - [ ] 🔬 验证方法已更新到"测试"部分 |
| 50 | + - [ ] 🛠️ 代码已通过静态分析工具检查,无错误 |
| 51 | + - [ ] 👥 代码检视/code review/同行评议和必要的代码串讲,确保代码质量 |
| 52 | + - [ ] ✅ 代码检视意见已处理或答复,无未处理的检视意见 |
| 53 | +- [ ] 🚀 预约 前冒烟 用例前的必要检查 |
| 54 | + - [ ] ✔️ 代码已有committer的`/lgtm` 和 模块committer的`/lgtm`评论 |
| 55 | + - [ ] 🔧 代码已通过compile,编译无错误,无告警 |
| 56 | + - [ ] 🖥️ 代码已通过基本功能本地测试或者在线测试,确保基本功能正常 |
| 57 | +- [ ] 🎯 预约 approver评论`/approve`,正式合入前的必要检查 |
| 58 | + - [ ] 📊 前冒烟 用例已全量通过 |
| 59 | + - [ ] 📦 新增功能已同步补充基本功能测试用例到前冒烟里 |
| 60 | \ No newline at end of file |
| 61 |
| ... | @@ -0,0 +1,18 @@ |
| 2 | +repos: |
| 3 | + - repo: https://github.com/pre-commit/mirrors-clang-format |
| 4 | + rev: v16.0.0 |
| 5 | + hooks: |
| 6 | + - id: clang-format |
| 7 | + types_or: [c++, c] |
| 8 | + |
| 9 | + # OAT compliance check (Open Source Audit Tool) |
| 10 | + - repo: local |
| 11 | + hooks: |
| 12 | + - id: oat-check |
| 13 | + name: OAT Compliance Check |
| 14 | + entry: bash scripts/oat_check.sh |
| 15 | + language: system |
| 16 | + pass_filenames: true |
| 17 | + types: [file] |
| 18 | + stages: [commit] |
| 19 | + verbose: true |
| 20 |
| ... | @@ -13,12 +13,6 @@ message(STATUS "DEVICE_MODE=${DEVICE_MODE}") |
| 2 | message(STATUS "BUILD_OPEN_PROJECT=${BUILD_OPEN_PROJECT}") |
| 3 | message(STATUS "AARCH_MODE=${AARCH_MODE}") |
| 4 | |
| 5 | -find_program(CCACHE_PROGRAM ccache) |
| 6 | -if(CCACHE_PROGRAM) |
| 7 | - set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) |
| 8 | - set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) |
| 9 | -endif() |
| 10 | - |
| 11 | if((BUILD_OPEN_PROJECT AND DEVICE_MODE) OR AARCH_MODE) |
| 12 | # need to switch |
| 13 | set(CMAKE_SYSTEM_NAME Linux) |
| ... | @@ -44,14 +38,19 @@ execute_process( |
| 15 | OUTPUT_STRIP_TRAILING_WHITESPACE |
| 16 | ) |
| 17 | message(STATUS "当前系统架构: ${SYSTEM_ARCH}") |
| 18 | + |
| 19 | +# 引入CANN/cmake库 |
| 20 | +include(cmake/fetch_cann_cmake.cmake) |
| 21 | + |
| 22 | project(hcomm) |
| 23 | |
| 24 | -set(CMAKE_CXX_COMPILE_OBJECT |
| 25 | - "<CMAKE_CXX_COMPILER> <DEFINES> -D__FILE__='\"$(notdir $(abspath <SOURCE>))\"' -Wno-builtin-macro-redefined <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>" |
| 26 | -) |
| 27 | -set(CMAKE_C_COMPILE_OBJECT |
| 28 | - "<CMAKE_C_COMPILER> <DEFINES> -D__FILE__='\"$(notdir $(abspath <SOURCE>))\"' -Wno-builtin-macro-redefined <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>" |
| 29 | -) |
| 30 | +# 引入CANN/cmake库,初始化 |
| 31 | +init_cann_project() |
| 32 | + |
| 33 | +set(CMAKE_CXX_STANDARD 14) |
| 34 | +set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 35 | +set(CMAKE_C_FLAGS_RELEASE "") |
| 36 | +set(CMAKE_CXX_FLAGS_RELEASE "") |
| 37 | |
| 38 | # 获取 CPU 核心数 |
| 39 | if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") |
| ... | @@ -59,7 +58,7 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") |
| 41 | COMMAND nproc |
| 42 | OUTPUT_VARIABLE CPU_CORES |
| 43 | OUTPUT_STRIP_TRAILING_WHITESPACE |
| 44 | - ) |
| 45 | + ) |
| 46 | elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") |
| 47 | execute_process( |
| 48 | COMMAND wmic cpu get NumberOfCores /value |
| ... | @@ -79,21 +78,31 @@ set(CMAKE_JOB_POOL_COMPILE "${JOBS}") |
| 50 | set(CMAKE_JOB_POOL_LINK "${JOBS}") |
| 51 | |
| 52 | if(ENABLE_TEST) |
| 53 | + enable_testing() |
| 54 | include(cmake/config.cmake) |
| 55 | include(cmake/function.cmake) |
| 56 | include(cmake/intf_pub_gccnative.cmake) |
| 57 | - include(cmake/utils.cmake) |
| 58 | + include(cmake/third_party/json.cmake) |
| 59 | + include(cmake/third_party/gtest.cmake) |
| 60 | + include(cmake/third_party/mockcpp.cmake) |
| 61 | + include(cmake/third_party/rdma-core.cmake) |
| 62 | add_subdirectory(test) |
| 63 | return() |
| 64 | -endif() |
| 65 | |
| 66 | -if(BUILD_OPEN_PROJECT) |
| 67 | +elseif(BUILD_OPEN_PROJECT) |
| 68 | include(cmake/third_party/openssl.cmake) |
| 69 | + include(cmake/third_party/ubengine.cmake) |
| 70 | + include(cmake/third_party/rdma-core.cmake) |
| 71 | include(cmake/third_party/json.cmake) |
| 72 | - include(cmake/utils.cmake) |
| 73 | + include(cmake/hcomm_utils.cmake) |
| 74 | include(cmake/config.cmake) |
| 75 | - set(HCOMM_VERSION_FILE ${CMAKE_CURRENT_BINARY_DIR}/version/version.info) |
| 76 | include(cmake/package.cmake) |
| 77 | + include(cmake/func.cmake) |
| 78 | + include(version.cmake) |
| 79 | + if(ENABLE_OPEN_SRC) |
| 80 | + check_pkg_build_deps("hcomm") |
| 81 | + endif() |
| 82 | + add_version_info_targets() |
| 83 | pack_built_in() |
| 84 | add_subdirectory(src) |
| 85 | add_subdirectory(python) |
| ... | @@ -104,7 +113,11 @@ if(BUILD_OPEN_PROJECT) |
| 87 | src/pub_inc/hccn_rping.h |
| 88 | include/hccl/hccl_rank_graph.h |
| 89 | include/hccl/hccl_res.h |
| 90 | - include/hccl/hcomm_primitives.h |
| 91 | + include/hccl/hccl_sym_win.h |
| 92 | + ) |
| 93 | + |
| 94 | + set(HCOMM_HEAD |
| 95 | + include/hcomm_primitives.h |
| 96 | ) |
| 97 | |
| 98 | set(HCCL_JSON |
| ... | @@ -112,7 +125,6 @@ if(BUILD_OPEN_PROJECT) |
| 100 | ) |
| 101 | |
| 102 | if(DEVICE_MODE) |
| 103 | - include(cmake/func.cmake) |
| 104 | set(HCCP_TAR_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build_device/tar_pkg/) |
| 105 | set(CCL_KERNEL_TAR_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build_device/ccl_kernel_tar_pkg/) |
| 106 | set(HCCD_TAR_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build_hccd/hccd_tar_pkg/) |
| ... | @@ -123,11 +135,10 @@ if(BUILD_OPEN_PROJECT) |
| 108 | OUTPUT_TARGET "generate_device_hccp_package" |
| 109 | OUTPUT "cann-hcomm-compat.tar.gz" |
| 110 | TARGETS hccp_service.bin |
| 111 | - FILES ${HCCP_TAR_DIR}/librs.so ${HCCP_TAR_DIR}/libra_adp.so ${HCCP_TAR_DIR}/libtls_adp.so ${HCCP_TAR_DIR}/libascend_kms.so |
| 112 | + FILES ${HCCP_TAR_DIR}/librs.so ${HCCP_TAR_DIR}/libra_adp.so ${HCCP_TAR_DIR}/libtls_adp.so ${HCCP_TAR_DIR}/libascend_kms.so ${HCCP_TAR_DIR}/libnet_co.so |
| 113 | MANIFEST "hccp_compat_bin_hash.cfg" |
| 114 | ) |
| 115 | add_dependencies(generate_device_hccp_package hccp_service.bin) |
| 116 | - |
| 117 | sign_file( |
| 118 | INPUT "cann-hcomm-compat.tar.gz" |
| 119 | CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/scripts/sign/hcomm_check_cfg.xml" |
| ... | @@ -136,13 +147,23 @@ if(BUILD_OPEN_PROJECT) |
| 121 | ) |
| 122 | add_dependencies(sign_cann_hcomm_compat generate_device_hccp_package) |
| 123 | |
| 124 | - add_custom_target(generate_device_hccd_package |
| 125 | - COMMAND cd ${HCCD_TAR_DIR} && ls && tar czf ../cann-hccd-compat.tar.gz lib64 |
| 126 | - DEPENDS hccd |
| 127 | - COMMENT "Creating cann-hccd-compat.tar.gz" |
| 128 | + set(HCCD_TAR_LIBS |
| 129 | + ${HCCD_TAR_DIR}/lib64/libascend_kms.so |
| 130 | + ${HCCD_TAR_DIR}/lib64/libhccd.so |
| 131 | + ${HCCD_TAR_DIR}/lib64/libra_hdc.so |
| 132 | + ${HCCD_TAR_DIR}/lib64/libra_peer.so |
| 133 | + ${HCCD_TAR_DIR}/lib64/libra.so |
| 134 | + ${HCCD_TAR_DIR}/lib64/librs.so |
| 135 | + ${HCCD_TAR_DIR}/lib64/libtls_adp.so |
| 136 | + ) |
| 137 | + pack_targets_and_files( |
| 138 | + OUTPUT_TARGET "generate_device_hccd_package" |
| 139 | + OUTPUT "cann-hccd-compat.tar.gz" |
| 140 | + FILES ${HCCD_TAR_LIBS} |
| 141 | + MANIFEST "bin_hash.cfg" |
| 142 | + TAR_ROOT_DIR "lib64" |
| 143 | ) |
| 144 | add_dependencies(generate_device_hccd_package hccd) |
| 145 | - |
| 146 | sign_file( |
| 147 | INPUT "cann-hccd-compat.tar.gz" |
| 148 | CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/scripts/sign/hcomm_check_cfg.xml" |
| ... | @@ -152,10 +173,16 @@ if(BUILD_OPEN_PROJECT) |
| 150 | add_dependencies(sign_cann_hccd_compat generate_device_hccd_package) |
| 151 | |
| 152 | if(KERNEL_MODE) |
| 153 | - add_custom_target(generate_device_aicpu_package |
| 154 | - COMMAND cd ${CCL_KERNEL_TAR_DIR} && ls && tar czf ../aicpu_hcomm.tar.gz aicpu_kernels_device |
| 155 | - DEPENDS ccl_kernel |
| 156 | - COMMENT "Creating aicpu_hcomm.tar.gz" |
| 157 | + set(CCL_KERNEL_TAR_LIBS |
| 158 | + ${CCL_KERNEL_TAR_DIR}/aicpu_kernels_device/libccl_kernel_plf.so |
| 159 | + ${CCL_KERNEL_TAR_DIR}/aicpu_kernels_device/libccl_kernel.so |
| 160 | + ) |
| 161 | + pack_targets_and_files( |
| 162 | + OUTPUT_TARGET "generate_device_aicpu_package" |
| 163 | + OUTPUT "aicpu_hcomm.tar.gz" |
| 164 | + FILES ${CCL_KERNEL_TAR_LIBS} |
| 165 | + MANIFEST "bin_hash.cfg" |
| 166 | + TAR_ROOT_DIR "aicpu_kernels_device" |
| 167 | ) |
| 168 | add_dependencies(generate_device_aicpu_package ccl_kernel) |
| 169 | sign_file( |
| ... | @@ -177,37 +204,37 @@ if(BUILD_OPEN_PROJECT) |
| 171 | ${BUILD_DEVICE_DIR}/signatures/cann-hcomm-compat.tar.gz |
| 172 | ${BUILD_DEVICE_DIR}/signatures/aicpu_hcomm.tar.gz |
| 173 | ${BUILD_HCCD_DIR}/signatures/cann-hccd-compat.tar.gz |
| 174 | - ${BUILD_DEVICE_DIR}/aicpu_custom/libaicpu_custom.so |
| 175 | + ${BUILD_DEVICE_DIR}/src/framework/libaicpu_custom.so |
| 176 | + ${BUILD_DEVICE_DIR}/src/framework/libaicpu_custom.json |
| 177 | ) |
| 178 | install(FILES ${BUILD_DEVICE_DIR}/signatures/cann-hcomm-compat.tar.gz |
| 179 | DESTINATION ${INSTALL_DEVICE_TAR_DIR} OPTIONAL |
| 180 | + PERMISSIONS OWNER_READ GROUP_READ |
| 181 | + OPTIONAL |
| 182 | ) |
| 183 | install(FILES ${BUILD_DEVICE_DIR}/signatures/aicpu_hcomm.tar.gz |
| 184 | - DESTINATION ${INSTALL_DEVICE_TAR_DIR} OPTIONAL |
| 185 | + DESTINATION ${INSTALL_CCL_KERNEL_JSON_DIR}/kernel OPTIONAL |
| 186 | ) |
| 187 | install(FILES ${BUILD_HCCD_DIR}/signatures/cann-hccd-compat.tar.gz |
| 188 | DESTINATION ${INSTALL_DEVICE_TAR_DIR} OPTIONAL |
| 189 | + PERMISSIONS OWNER_READ GROUP_READ |
| 190 | + OPTIONAL |
| 191 | ) |
| 192 | - install(FILES ${BUILD_DEVICE_DIR}/aicpu_custom/libaicpu_custom.so |
| 193 | - DESTINATION ${INSTALL_CCL_KERNEL_JSON_DIR} OPTIONAL |
| 194 | + install(FILES ${BUILD_DEVICE_DIR}/src/framework/libaicpu_custom.so |
| 195 | + DESTINATION ${INSTALL_CCL_KERNEL_JSON_DIR}/kernel OPTIONAL |
| 196 | + ) |
| 197 | + install(FILES ${BUILD_DEVICE_DIR}/src/framework/libaicpu_custom.json |
| 198 | + DESTINATION ${INSTALL_CCL_KERNEL_JSON_DIR}/kernel OPTIONAL |
| 199 | + ) |
| 200 | + |
| 201 | + add_custom_target(install_ccl_kernel DEPENDS |
| 202 | + ${BUILD_DEVICE_DIR}/src/framework/libccl_kernel.so |
| 203 | + ) |
| 204 | + install(FILES ${BUILD_DEVICE_DIR}/src/framework/libccl_kernel.so |
| 205 | + DESTINATION ${CMAKE_SYSTEM_PROCESSOR}-linux/devlib/device OPTIONAL |
| 206 | ) |
| 207 | add_dependencies(install_tar hcomm) |
| 208 | - |
| 209 | - set(HCOMM_VERSION_FILE ${CMAKE_CURRENT_BINARY_DIR}/version/version.info) |
| 210 | - add_custom_command( |
| 211 | - OUTPUT ${HCOMM_VERSION_FILE} |
| 212 | - COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/scripts/update_version_info/update_version_info.sh |
| 213 | - ${CMAKE_CURRENT_SOURCE_DIR}/version.info |
| 214 | - ${HCOMM_VERSION_FILE} |
| 215 | - DEPENDS |
| 216 | - ${CMAKE_CURRENT_SOURCE_DIR}/version.info |
| 217 | - VERBATIM |
| 218 | - ) |
| 219 | - |
| 220 | - add_custom_target(generate_hcomm_version_file |
| 221 | - DEPENDS ${HCOMM_VERSION_FILE} |
| 222 | - ) |
| 223 | - add_dependencies(hcomm generate_hcomm_version_file) |
| 224 | + add_dependencies(install_ccl_kernel hcomm) |
| 225 | endif() |
| 226 | |
| 227 | install(FILES |
| ... | @@ -215,12 +242,29 @@ if(BUILD_OPEN_PROJECT) |
| 229 | ${HCCL_JSON} |
| 230 | DESTINATION ${INSTALL_INCLUDE_DIR}/hccl/ OPTIONAL |
| 231 | ) |
| 232 | + if(NOT BUILD_OPEN_PROJECT) |
| 233 | + install(FILES |
| 234 | + ${HCOMM_HEAD} |
| 235 | + DESTINATION ${INSTALL_INCLUDE_DIR}/ OPTIONAL |
| 236 | + ) |
| 237 | + endif() |
| 238 | + install(FILES |
| 239 | + include/hcomm_primitives.h |
| 240 | + DESTINATION ${INSTALL_INCLUDE_DIR}/hcomm/ OPTIONAL |
| 241 | + ) |
| 242 | + install(FILES |
| 243 | + include/hcomm_res.h |
| 244 | + include/hcomm_res_defs.h |
| 245 | + DESTINATION ${INSTALL_INCLUDE_DIR}/hcomm/ OPTIONAL |
| 246 | + ) |
| 247 | |
| 248 | set(HCCL_PKG_HEAD |
| 249 | pkg_inc/hccl/base.h |
| 250 | pkg_inc/hccl/hccl_ex.h |
| 251 | pkg_inc/hccl/hccl_one_sided_services.h |
| 252 | + pkg_inc/hccl/hccl_res_expt.h |
| 253 | pkg_inc/hccl/hcom.h |
| 254 | + pkg_inc/hccl/hccl_diag.h |
| 255 | pkg_inc/hccl/hcomm_diag.h |
| 256 | pkg_inc/hccl/dtype_common.h |
| 257 | pkg_inc/hccl/workflow.h |
| ... | @@ -231,4 +275,50 @@ if(BUILD_OPEN_PROJECT) |
| 259 | ${HCCL_PKG_HEAD} |
| 260 | DESTINATION ${INSTALL_PKG_INCLUDE_DIR}/hccl/ OPTIONAL |
| 261 | ) |
| 262 | + set(HCCL_PKG_CCU_HEAD |
| 263 | + pkg_inc/hcomm/ccu/ccu_assist_pub.h |
| 264 | + pkg_inc/hcomm/ccu/ccu_common.h |
| 265 | + pkg_inc/hcomm/ccu/ccu_condition_v1.h |
| 266 | + pkg_inc/hcomm/ccu/ccu_kernel_resource.h |
| 267 | + pkg_inc/hcomm/ccu/ccu_datatype_v1.h |
| 268 | + pkg_inc/hcomm/ccu/ccu_funccall_v1.h |
| 269 | + pkg_inc/hcomm/ccu/ccu_instr_info_v1.h |
| 270 | + pkg_inc/hcomm/ccu/ccu_interface_assist_v1.h |
| 271 | + pkg_inc/hcomm/ccu/ccu_kernel_arg.h |
| 272 | + pkg_inc/hcomm/ccu/ccu_kernel_signature.h |
| 273 | + pkg_inc/hcomm/ccu/ccu_kernel.h |
| 274 | + pkg_inc/hcomm/ccu/ccu_loopblock_v1.h |
| 275 | + pkg_inc/hcomm/ccu/ccu_loopcall_v1.h |
| 276 | + pkg_inc/hcomm/ccu/ccu_loopgroupcall_v1.h |
| 277 | + pkg_inc/hcomm/ccu/ccu_microcode_v1.h |
| 278 | + pkg_inc/hcomm/ccu/ccu_operator_v1.h |
| 279 | + pkg_inc/hcomm/ccu/ccu_rep_arg_v1.h |
| 280 | + pkg_inc/hcomm/ccu/ccu_rep_base_v1.h |
| 281 | + pkg_inc/hcomm/ccu/ccu_rep_block_v1.h |
| 282 | + pkg_inc/hcomm/ccu/ccu_rep_context_v1.h |
| 283 | + pkg_inc/hcomm/ccu/ccu_rep_funcblock_v1.h |
| 284 | + pkg_inc/hcomm/ccu/ccu_rep_funccall_v1.h |
| 285 | + pkg_inc/hcomm/ccu/ccu_rep_jump_v1.h |
| 286 | + pkg_inc/hcomm/ccu/ccu_rep_jumplabel_v1.h |
| 287 | + pkg_inc/hcomm/ccu/ccu_rep_loopblock_v1.h |
| 288 | + pkg_inc/hcomm/ccu/ccu_rep_loopcall_v1.h |
| 289 | + pkg_inc/hcomm/ccu/ccu_rep_reference_manager_v1.h |
| 290 | + pkg_inc/hcomm/ccu/ccu_rep_type_v1.h |
| 291 | + pkg_inc/hcomm/ccu/ccu_repeat_v1.h |
| 292 | + pkg_inc/hcomm/ccu/ccu_res_repo.h |
| 293 | + pkg_inc/hcomm/ccu/ccu_task_arg_v1.h |
| 294 | + pkg_inc/hcomm/ccu/ccu_task_param_v1.h |
| 295 | + pkg_inc/hcomm/ccu/hccl_ccu_res.h |
| 296 | + ) |
| 297 | + install(FILES |
| 298 | + ${HCCL_PKG_CCU_HEAD} |
| 299 | + DESTINATION ${INSTALL_PKG_INCLUDE_DIR}/hcomm/ccu/ OPTIONAL |
| 300 | + ) |
| 301 | + set(HCOMM_PKG_HEAD |
| 302 | + pkg_inc/hcomm/hcomm_primitives_expt.h |
| 303 | + ) |
| 304 | + install(FILES |
| 305 | + ${HCOMM_PKG_HEAD} |
| 306 | + DESTINATION ${INSTALL_PKG_INCLUDE_DIR}/hcomm/ OPTIONAL |
| 307 | + ) |
| 308 | endif() |
| 309 |
| ... | @@ -1,22 +1,124 @@ |
| 2 | # 贡献指南 |
| 3 | |
| 4 | -本项目欢迎广大开发者体验并参与贡献,在参与社区贡献之前。请参见[cann-community](https://gitcode.com/cann/community)了解行为准则,进行 CLA 协议签署,了解源码仓的贡献流程。 |
| 5 | +感谢您对HCCL的关注,本项目欢迎广大开发者体验并参与贡献。在参与社区贡献之前,请参见[cann-community](https://gitcode.com/cann/community)了解行为准则,进行 CLA 协议签署,了解源码仓的贡献流程。 |
| 6 | |
| 7 | -开发者准备本地代码与提交 PR 时需要重点关注如下几点: |
| 8 | +## 期望的贡献 |
| 9 | |
| 10 | -1. 提交 PR 时,请按照 PR 模板仔细填写本次 PR 的业务背景、目的、方案等信息。 |
| 11 | -2. 若您的修改不是简单的 bug 修复,而是涉及到新增特性、新增接口、新增配置参数或者修改代码流程等,请务必先通过 Issue 进行方案讨论,以避免您的代码被拒绝合入。若您不确定本次修改是否可被归为“简单的 bug 修复”,亦可通过提交 Issue 进行方案讨论。 |
| 12 | +- 问题修复:修复自己发现的或在Issue列表中的Bug,比如代码中的逻辑错误、内存泄漏或崩溃等问题; |
| 13 | +- 社区任务:领取HCCL社区公布的任务; |
| 14 | +- 性能优化:针对特定算子或特定架构的性能优化; |
| 15 | +- 新功能支持:增加平台功能、新算子或新业务场景的支持; |
| 16 | +- 文档优化:改进文档、注释或使用用例。 |
| 17 | |
| 18 | -## 贡献场景 |
| 19 | +## 预备知识 |
| 20 | |
| 21 | -开发者贡献场景主要包括: |
| 22 | +### 编码规范 |
| 23 | |
| 24 | -- 反馈 BUG |
| 25 | -- 建议特性 |
| 26 | -- 改进文档 |
| 27 | -- 修复问题 |
| 28 | -- 新增样例 |
| 29 | +请遵从[CANN 社区编码规范](https://gitcode.com/cann/community/tree/master/contributor/coding-standards)。 |
| 30 | |
| 31 | -## 编码规范 |
| 32 | +### PR规范 |
| 33 | |
| 34 | -若您需要贡献代码,请遵从[CANN 社区编码规范](https://gitcode.com/cann/community/tree/master/contributor/coding-standards)。 |
| 35 | +1. 提交 PR 时,请按照 PR 模板仔细填写本次 PR 的业务背景、目的、方案等信息; |
| 36 | +2. **所有PR都必须关联Issue**,请在PR描述中引用对应的Issue编号; |
| 37 | +3. 使用 Git 提交代码前,请参考 [pre-commit工具使用指导](./docs/dev_guide/pre-commit-guide.md),以保持代码风格一致且符合合规规范。 |
| 38 | +4. 若您的修改不是简单的 bug 修复,而是涉及到新增特性、新增接口、新增配置参数或者修改代码流程等,请务必先通过 Issue 进行方案讨论,以避免您的代码被拒绝合入。若您不确定本次修改是否可被归为"简单的 bug 修复",亦可通过提交 Issue 进行方案讨论。 |
| 39 | + |
| 40 | +## 贡献流程 |
| 41 | + |
| 42 | +贡献可以分为两类: |
| 43 | + |
| 44 | +- 简单问题处理:Bug修复、简单代码修改、文档修改等; |
| 45 | +- 新功能或新特性:增加新功能、新特性、新接口,或者支持新业务场景的贡献。 |
| 46 | + |
| 47 | +**整体流程** |
| 48 | + |
| 49 | +```mermaid |
| 50 | +flowchart TD |
| 51 | + A1[开始贡献] --> A2{类型?} |
| 52 | + A2 -->|简单问题| A3[查询Issue列表] |
| 53 | + A2 -->|新功能/特性| A4[提交Requirement类型Issue] |
| 54 | + |
| 55 | + A3 --> A5{已有Issue?} |
| 56 | + A5 -->|有| A6[认领该Issue] |
| 57 | + A5 -->|无| A7[创建Issue并认领] |
| 58 | + A7 --> A6 |
| 59 | + A6 --> A19 |
| 60 | + |
| 61 | + A4 --> A10{SIG组决策} |
| 62 | + A10 -->|拒绝| A11[关闭Issue] |
| 63 | + A10 -->|接纳| A12[添加accepted标签] |
| 64 | + A12 --> A13[设计系统方案] |
| 65 | + A13 --> A14[编写/修改RFC] |
| 66 | + A14 --> A15[提交包含RFC的PR] |
| 67 | + A15 --> A16{Maintainer评审} |
| 68 | + A16 -->|提出意见| A14 |
| 69 | + A16 -->|通过| A17[合入RFC] |
| 70 | + A17 --> A19[修改/实现代码,提交PR] |
| 71 | + |
| 72 | + A19 --> A20{Committer检视} |
| 73 | + A20 -->|检视意见| A21[修改] |
| 74 | + A21 --> A20 |
| 75 | + A20 -->|通过| A24[合入PR] |
| 76 | +``` |
| 77 | + |
| 78 | +### 简单问题处理 |
| 79 | + |
| 80 | +1. 查询并认领Issue |
| 81 | + |
| 82 | + - 现在Issue列表中查询该问题是否有对应的Issue; |
| 83 | + - **如有对应Issue**:直接认领该Issue; |
| 84 | + - **如无对应Issue**:创建新的Issue并认领。 |
| 85 | + |
| 86 | +2. 修改代码并提交PR |
| 87 | + |
| 88 | + - 需要满足编码规范与PR规范; |
| 89 | + - 确保包含触发Bug的回归测试。 |
| 90 | + |
| 91 | +3. 代码评审与合入 |
| 92 | + |
| 93 | + - 负责对应模块或组件的Committer检视代码并反馈检视意见,请根据意见修改;没有问题后,添加`/lgtm`和`/approve`标签并合入。 |
| 94 | + |
| 95 | + |
| 96 | +### 增加新功能或新特性 |
| 97 | + |
| 98 | + |
| 99 | +1. 提交Requirement类型Issue |
| 100 | + |
| 101 | + - 在代码仓提交Requirement类型的Issue; |
| 102 | + - 详细描述:使用场景、业务价值、大致技术方案; |
| 103 | + - 在社区发起讨论,SIG组决策是否接纳该需求;如果接纳,添加`accepted`标签。 |
| 104 | + |
| 105 | +2. 系统方案设计 |
| 106 | + |
| 107 | + - 需求被接纳后,设计详细的系统方案; |
| 108 | + - 在 `docs/rfcs` 目录下创建markdown格式的RFC文件,并按RFC模板撰写系统方案; |
| 109 | + - 提交PR。 |
| 110 | + |
| 111 | +3. 系统方案评审 |
| 112 | + |
| 113 | + - 详细设计方案通过包含RFC的PR进行评审; |
| 114 | + - 过程中请针对评审意见进行方案修改; |
| 115 | + |
| 116 | + |
| 117 | +4. RFC合入 |
| 118 | + |
| 119 | + - 所有Maintainer对方案均无异议后,由Maintainer添加`/lgtm`和`/approve`标签合入; |
| 120 | + - 合入的RFC方案作为后续代码实施的合约,代码实现需要遵循RFC方案。 |
| 121 | + |
| 122 | +5. 软件实现 |
| 123 | + |
| 124 | + - 按照RFC方案实现代码,并提交PR; |
| 125 | + - 必须包含对应的测试代码(包含单元测试与系统测试)。 |
| 126 | + |
| 127 | +6. 代码评审与合入 |
| 128 | + |
| 129 | + - 负责对应模块或组件的Committer检视代码并反馈检视意见,请根据意见修改;没有问题后,添加`/lgtm`和`/approve`标签并合入。 |
| 130 | + |
| 131 | +--- |
| 132 | + |
| 133 | +## 争议处理 |
| 134 | + |
| 135 | +存在争议的Issue、PR或RFC可以在[SIG工作会议](https://etherpad-cann.meeting.osinfra.cn/p/sig-hccl)上申报议题,由SIG组决策。 |
| 136 | + |
| 137 | + |
| 138 | +*本文档由社区维护,如有变更建议,请在Issue中提出。* |
| 139 |
| ... | @@ -14,7 +14,7 @@ |
| 2 | <policylist> |
| 3 | <policy name="projectPolicy" desc=""> |
| 4 | <!--policyitem type="compatibility" name="GPL-2.0+" path="abc/.*" desc="Process that runs independently, invoked by the X process."/--> |
| 5 | - <policyitem type="license" name="cann License" path=".*" desc="Dynamically linked by module X"/> |
| 6 | + <policyitem type="license" name="CANN-2.0" path=".*" desc="Dynamically linked by module X"/> |
| 7 | <!--policyitem type="copyright" name="xxx" path="abc/.*" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc="Developed by X Company"/--> |
| 8 | </policy> |
| 9 | </policylist> |
| ... | @@ -59,7 +59,6 @@ |
| 11 | <licensematcherlist> |
| 12 | <licensematcher name="cann License" desc="If the scanning result is InvalidLicense, you can define matching rules here. Note that quotation marks must be escaped."> |
| 13 | <licensetext name=" |
| 14 | - Copyright (c) 2025 Huawei Technologies Co., Ltd. |
| 15 | This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 16 | CANN Open Software License Agreement Version 2.0 (the "License"). |
| 17 | Please refer to the License for details. You may not use this file except in compliance with the License. |
| 18 |
| ... | @@ -18,26 +18,74 @@ HCOMM提供了标准化通信编程接口,具备以下关键特性: |
| 2 | |
| 3 | HCOMM通信基础库采用分层解耦的设计思路,将通信能力划分为控制面和数据面两部分。 |
| 4 | |
| 5 | -- 控制面:负责分布式节点间的协同、资源创建和管理。 |
| 6 | -- 数据面:支持多种通信引擎,负责内存、Notify等资源管理。 |
| 7 | +- 控制面:提供拓扑信息查询与通信资源管理功能。 |
| 8 | +- 数据面:提供本地操作、算子间同步、通信操作等数据搬运和计算功能。 |
| 9 | |
| 10 | + 控制面提供通信资源,数据面提供操作资源的方法,所提供的通信编程接口可以让通信算子开发人员聚焦于业务创新,而无需关注芯片底层复杂的实现细节。 |
| 11 | |
| 12 | ## 🔍 目录结构说明 |
| 13 | |
| 14 | 本项目关键目录如下所示: |
| 15 | |
| 16 | ``` |
| 17 | -├── src # HCCL源码目录 |
| 18 | -│ ├── algorithm # 通信算法源码目录 |
| 19 | -│ ├── framework # 通信框架源码目录 |
| 20 | -│ └── platform # 通信平台源码目录 |
| 21 | -├── build.sh # 源码编译脚本 |
| 22 | -├── python # Python 包 |
| 23 | -├── inc # 集合通信对外头文件 |
| 24 | -├── docs # 资料文档目录 |
| 25 | -└── test # 测试代码目录 |
| 26 | +├── src # HCCL源码目录 |
| 27 | +│ ├── algorithm # 通信算法源码目录 |
| 28 | +| │ ├── base # 通信算法模板 |
| 29 | +| │ ├── impl # 通信算法实现 |
| 30 | +| │ └── pub_inc # 通信算法模块头文件 |
| 31 | +│ ├── commom # 公共基础功能目录 |
| 32 | +| │ ├── debug # 调试配置管理 |
| 33 | +| │ ├── error_code # 错误码管理 |
| 34 | +| │ ├── health # 健康检查与一致性校验 |
| 35 | +| │ ├── launch_device # kernel加载处理 |
| 36 | +| │ └── stream # 流管理工具 |
| 37 | +│ ├── framework # 通信框架源码目录 |
| 38 | +| │ ├── cluster_maintenance # 集群维护,包括:快照、心跳、算子重执行等 |
| 39 | +| │ ├── common # 通信框架通用逻辑 |
| 40 | +| │ ├── communicator # 通信域管理 |
| 41 | +| │ ├── device # AI CPU实现 |
| 42 | +| │ ├── hcom # hcomm接口实现 |
| 43 | +| │ ├── inc # 通信框架模块头文件 |
| 44 | +| │ ├── nslbdp # 数据面网络负载均衡 |
| 45 | +| │ └── op_base # 通信域、单算子接口入口 |
| 46 | +│ ├── hccd # 提供进程间点对点通信能力 |
| 47 | +│ ├── legacy # 历史版本兼容目录 |
| 48 | +| │ ├── common # 公共基础组件 |
| 49 | +| │ ├── framework # 框架核心实现 |
| 50 | +| │ ├── include # 公共接口头文件 |
| 51 | +| │ ├── interface # 接口适配层 |
| 52 | +| │ ├── local_build # 本地构建工具 |
| 53 | +| │ ├── service # 服务层 |
| 54 | +| │ └── unified_platform # 统一平台层 |
| 55 | +│ └── platform # 通信平台源码目录 |
| 56 | +| │ ├── comm_primitive # 通信原语 |
| 57 | +| │ ├── common # 通信平台通用逻辑 |
| 58 | +| │ ├── debug # 维测 |
| 59 | +| │ ├── hccp # HCCP集合通信协议栈 |
| 60 | +| │ ├── inc # 通信平台模块头文件 |
| 61 | +| │ ├── ping_mesh # 网络探测功能 |
| 62 | +| │ ├── resource # 通信资源管理 |
| 63 | +| │ └── task # 下发任务管理 |
| 64 | +│ ├── pub_inc # 公共接口头文件目录 |
| 65 | +| │ ├── aicpu # AICPU 专用接口 |
| 66 | +| │ ├── inner # 内部实现专用接口 |
| 67 | +| │ └── new # 新架构下的公共接口 |
| 68 | +├── python # Python 包 |
| 69 | +├── include # 对外头文件 |
| 70 | +├── pkg_inc # 包间接口头文件 |
| 71 | +├── test # 测试代码目录 |
| 72 | +| ├── ut # 单元测试代码目录 |
| 73 | +| └── st # 系统测试代码目录 |
| 74 | +├── docs # 资料文档目录 |
| 75 | +├── examples # 样例代码目录 |
| 76 | +└── build.sh # 编译构建脚本 |
| 77 | ``` |
| 78 | |
| 79 | +## 📝版本配套 |
| 80 | + |
| 81 | +本项目源码会跟随CANN软件版本发布,关于CANN软件版本与本项目标签的对应关系请参阅[release仓库](https://gitcode.com/cann/release-management)中的相应版本说明。 |
| 82 | +请注意,为确保您的源码定制开发顺利进行,请选择配套的CANN版本与GitCode标签源码,使用master分支可能存在版本不匹配的风险。 |
| 83 | + |
| 84 | ## ⚡️ 快速开始 |
| 85 | |
| 86 | 若您希望快速构建并体验本项目,请访问如下简易指南。 |
| ... | @@ -48,6 +96,7 @@ HCOMM通信基础库采用分层解耦的设计思路,将通信能力划分为 |
| 88 | ## 📖 学习教程 |
| 89 | |
| 90 | HCCL提供了使用指南、通信算子开发指南、技术文章、培训视频,详细可参见 [HCCL 参考资料](./docs/README.md)。 |
| 91 | +此外,HCCL还提供了QuickStart指南、常见FAQ等wiki,详细可参见 [WIKI](https://gitcode.com/cann/hcomm/wiki)。 |
| 92 | |
| 93 | ## 📝 相关信息 |
| 94 | |
| 95 |
| ... | @@ -26,14 +26,17 @@ |
| 2 | | :--: | :----------: | :------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------- | |
| 3 | | 依赖 | 不涉及 | cmake/third_party/makeself-fetch.cmake | https://gitcode.com/cann-src-third-party/makeself/releases/download/release-2.5.0-patch1.0/makeself-release-2.5.0-patch1.tar.gz | 从 gitcode 下载 makeself 源码,作为编译依赖 | |
| 4 | | 依赖 | 不涉及 | cmake/third_party/json.cmake | https://gitcode.com/cann-src-third-party/json/releases/download/v3.11.3/include.zip | 从 gitcode 下载 json 源码,作为编译依赖 | |
| 5 | +| 依赖 | 不涉及 | cmake/third_party/openssl.cmake | https://gitcode.com/cann-src-third-party/openssl/releases/download/openssl-3.0.9/openssl-openssl-3.0.9.tar.gz | 从 gitcode 下载 openssl 源码,作为编译依赖 | |
| 6 | | 依赖 | 不涉及 | cmake/third_party/gtest.cmake | https://gitcode.com/cann-src-third-party/googletest/releases/download/v1.14.0/googletest-1.14.0.tar.gz | 从 gitcode 下载 googletest 源码,作为编译依赖 | |
| 7 | -| 依赖 | 不涉及 | cmake/third_party/pybind11.cmake | https://gitcode.com/cann-src-third-party/pybind11/releases/download/v2.13.6/pybind11-2.13.6.tar.gz | 从 gitcode 下载 pybind11 源码,作为编译依赖 | |
| 8 | - |
| 9 | +| 依赖 | 不涉及 | cmake/third_party/mockcpp.cmake | https://gitcode.com/cann-src-third-party/mockcpp/releases/download/v2.7-h4/mockcpp-2.7.tar.gz | 从 gitcode 下载 mockcpp 源码,作为编译依赖 | |
| 10 | +| 依赖 | 不涉及 | cmake/third_party/protobuf.cmake | https://gitcode.com/cann-src-third-party/protobuf/releases/download/v25.1/protobuf-25.1.tar.gz | 从 gitcode 下载 protobuf 源码,作为编译依赖 | |
| 11 | +| 依赖 | 不涉及 | rdma-core | https://gitcode.com/cann-src-third-party/rdma-core/releases/download/v42.7-h1/rdma-core-42.7.tar.gz.gz | 从 gitcode 下载 rdma-core 源码,作为编译依赖 | | |
| 12 | +| 依赖 | 不涉及 | rdma-core-patch | https://gitcode.com/cann-src-third-party/rdma-core/releases/download/v42.7-h1/rdma-core-42.7.patch.gz | 从 gitcode 下载 rdma-core-patch 源码,作为编译依赖 | |
| 13 | --- |
| 14 | |
| 15 | ## 端口声明 |
| 16 | |
| 17 | -HCCL 开放的端口、端口使用的传输层协议、认证方式以及用途等信息可参见[《CANN通信矩阵》](https://hiascend.com/document/redirect/CannCommunityCommMatrix)。 |
| 18 | +HCCL 开放的端口、端口使用的传输层协议、认证方式以及用途等信息可参见[《CANN通信矩阵》](https://hiascend.com/document/redirect/CannCommunityCommMatrix)中的“HCCL”页签。 |
| 19 | |
| 20 | ## 漏洞机制说明 |
| 21 | |
| 22 |
| ... | @@ -0,0 +1,35 @@ |
| 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 | +json: |
| 11 | + version: v3.11.3 |
| 12 | + type: build |
| 13 | +makeself: |
| 14 | + version: release-2.5.0-patch1.0 |
| 15 | + type: build |
| 16 | +openssl: |
| 17 | + version: v3.0.9 |
| 18 | + type: build |
| 19 | +boost: |
| 20 | + version: v1.87.0 |
| 21 | + type: test |
| 22 | +mockcpp: |
| 23 | + version: v2.7-h4 |
| 24 | + type: test |
| 25 | +googletest: |
| 26 | + version: v1.14.0 |
| 27 | + type: test |
| 28 | +protobuf: |
| 29 | + version: v25.1 |
| 30 | + type: test |
| 31 | +abseil-cpp: |
| 32 | + version: 20250127.0 |
| 33 | + type: test |
| 34 | +rdma-core: |
| 35 | + version: v42.7-h1 |
| 36 | + type: build |
| 37 | \ No newline at end of file |
| 38 |
| ... | @@ -147,12 +147,6 @@ test/ut/depends/include/acl/acl_prof.h |
| 2 | test/ut/depends/pkg_inc/runtime/runtime/mem.h |
| 3 | test/ut/depends/include/acl/acl_tdt.h |
| 4 | test/ut/depends/include/driver/ascend_hal_external.h |
| 5 | -src/platform/hccp/external_depends/inc/driver/hwts_task_info.h |
| 6 | -src/platform/hccp/external_depends/inc/driver/ascend_inpackage_hal.h |
| 7 | -src/platform/hccp/external_depends/inc/driver/ascend_hal_base.h |
| 8 | -src/platform/hccp/external_depends/inc/driver/ascend_hal_external.h |
| 9 | -src/platform/hccp/external_depends/inc/driver/ascend_hal_error.h |
| 10 | -src/platform/hccp/external_depends/inc/driver/ascend_hal.h |
| 11 | |
| 12 | Copyright notice(s): |
| 13 | Copyright 2019-2020 Huawei Technologies Co., Ltd |
| ... | @@ -166,7 +160,7 @@ Copyright (c) 2025 Huawei Technologies Co., Ltd. |
| 15 | Copyright (c) Huawei Technologies Co., Ltd. 2012-2019. All rights reserved. |
| 16 | Copyright (c) Huawei Technologies Co., Ltd. 2012-2020. All rights reserved. |
| 17 | License: Apache License V2.0 |
| 18 | -Full Lisence Text: |
| 19 | +Full Licence Text: |
| 20 | Apache License |
| 21 | Version 2.0, January 2004 |
| 22 | http://www.apache.org/licenses/ |
| ... | @@ -393,7 +387,7 @@ Copyright (c) 2017 Facebook Inc. |
| 24 | Copyright (c) 2017 Georgia Institute of Technology |
| 25 | Copyright 2019 Google LLC |
| 26 | License: The MIT License (MIT) |
| 27 | -Full Lisence Text: |
| 28 | +Full Licence Text: |
| 29 | Permission is hereby granted, free of charge, |
| 30 | to any person obtaining a copy of this software and associated documentation files (the "Software"), |
| 31 | to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, |
| ... | @@ -430,11 +424,15 @@ Software: libboundscheck v1.1.11 |
| 33 | Official Repository: https://gitee.com/openeuler/libboundscheck |
| 34 | Usage: |
| 35 | test/ut/depends/include/securectype.h |
| 36 | +test/ut/platform/hccp/rdma_agent/stub/sec.c |
| 37 | +test/ut/platform/hccp/hccp_service/stub/mm.c |
| 38 | +test/ut/platform/hccp/rdma_service_normal/stub/mm.c |
| 39 | +test/ut/platform/hccp/rdma_service_abnormal/stub/mm.c |
| 40 | |
| 41 | Copyright notice(s): |
| 42 | Copyright (c) Huawei Technologies Co., Ltd. 2014-2021. All rights reserved. |
| 43 | License: Mulan PSL v2 |
| 44 | -Full Lisence Text: |
| 45 | +Full Licence Text: |
| 46 | http://license.coscl.org.cn/MulanPSL2 |
| 47 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, |
| 48 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, |
| ... | @@ -627,6 +625,12 @@ src/platform/hccp/external_depends/rdma-core/include/ccan/str.h |
| 50 | src/platform/hccp/external_depends/rdma-core/include/ccan/check_type.h |
| 51 | src/platform/hccp/external_depends/rdma-core/include/ccan/container_of.h |
| 52 | src/platform/hccp/external_depends/rdma-core/include/rdma/rdma_user_ioctl_cmds.h |
| 53 | +test/ut/platform/hccp/rdma_service_abnormal/stub/cmd.c |
| 54 | +test/ut/platform/hccp/rdma_service_abnormal/stub/device.c |
| 55 | +test/ut/platform/hccp/rdma_service_abnormal/stub/init.c |
| 56 | +test/ut/platform/hccp/rdma_service_normal/stub/cmd.c |
| 57 | +test/ut/platform/hccp/rdma_service_normal/stub/device.c |
| 58 | +test/ut/platform/hccp/rdma_service_normal/stub/init.c |
| 59 | |
| 60 | Copyright notice(s): |
| 61 | Copyright (c) 2016-2017 Hisilicon Limited. |
| ... | @@ -650,7 +654,7 @@ Copyright (c) 1996-2003 Intel Corporation. All rights reserved. |
| 63 | Copyright (c) 2009 HNR Consulting. All rights reserved. |
| 64 | Copyright (c) 2011 Lawrence Livermore National Security. All rights reserved. |
| 65 | License: CC0 (Public domain) |
| 66 | -Full Lisence Text: |
| 67 | +Full Licence Text: |
| 68 | |
| 69 | Statement of Purpose |
| 70 | |
| ... | @@ -751,7 +755,7 @@ Full Lisence Text: |
| 72 | obligation with respect to this CC0 or use of the Work. |
| 73 | |
| 74 | License: OpenIB.org BSD License (MIT variant) |
| 75 | -Full Lisence Text: |
| 76 | +Full Licence Text: |
| 77 | |
| 78 | OpenIB.org BSD license (MIT variant) |
| 79 | |
| ... | @@ -771,4 +775,33 @@ Full Lisence Text: |
| 81 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 82 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 83 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 84 | - SOFTWARE. |
| 85 | \ No newline at end of file |
| 86 | + SOFTWARE. |
| 87 | + |
| 88 | +Software: umdk |
| 89 | +Official Repository: https://gitcode.com/openeuler/umdk |
| 90 | +Usage: |
| 91 | +test/ut/platform/hccp/rdma_service_abnormal/stub/ub_api.c |
| 92 | +test/ut/platform/hccp/rdma_service_normal/stub/ub_api.c |
| 93 | + |
| 94 | +Copyright notice(s): |
| 95 | +Copyright (c) Huawei Technologies Co., Ltd. 2021-2025. All rights reserved. |
| 96 | +License: The MIT License (MIT) |
| 97 | +Full Licence Text: |
| 98 | +The MIT License |
| 99 | + Permission is hereby granted, free of charge, to any person obtaining a copy |
| 100 | + of this software and associated documentation files (the "Software"), to deal |
| 101 | + in the Software without restriction, including without limitation the rights |
| 102 | + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 103 | + copies of the Software, and to permit persons to whom the Software is |
| 104 | + furnished to do so, subject to the following conditions: |
| 105 | + |
| 106 | + The above copyright notice and this permission notice shall be included in |
| 107 | + all copies or substantial portions of the Software. |
| 108 | + |
| 109 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 110 | + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 111 | + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 112 | + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 113 | + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 114 | + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 115 | + THE SOFTWARE. |
| 116 | \ No newline at end of file |
| 117 |
| ... | @@ -0,0 +1,27 @@ |
| 2 | +src/framework/device/framework/aicpu_communicator.cc |
| 3 | +src/framework/device/framework/aicpu_cache_manager.cc |
| 4 | +src/framework/communicator/impl/independent_op/data_api/sync_data_aicpu_ts.cc |
| 5 | +src/framework/communicator/impl/hccl_communicator_device.cc |
| 6 | +src/framework/communicator/hccl_comm_device.cc |
| 7 | +src/framework/communicator/impl/independent_op/data_api/hccl_api_data_aicpu_ts.cc |
| 8 | +src/framework/communicator/impl/independent_op/data_api/hccl_api_data_cpu.cc |
| 9 | +src/framework/next/coll_comms/communicator/aicpu/aicpu_indop_process.cc |
| 10 | +src/framework/next/coll_comms/dfx/hcclCommOp.cc |
| 11 | +src/framework/device/debug/dfx/taskexception/task_exception.cc |
| 12 | +src/framework/next/coll_comms/api_c_adpt/coll_comm_res_c_adpt.cc |
| 13 | +src/framework/device/framework/aicpu_communicator.cc |
| 14 | +src/framework/device/framework/aicpu_communicator.h |
| 15 | +src/framework/next/coll_comms/communicator/aicpu/coll_comm_aicpu.cc |
| 16 | +src/framework/next/comms/endpoint_pairs/channels/channel_process.cc |
| 17 | +src/framework/next/comms/endpoint_pairs/channels/aicpu/device/aicpu_channel_process.cc |
| 18 | +src/legacy/framework/dfx/aicpu/profiling/profiling_command_handle_lite.cc |
| 19 | +src/framework/next/coll_comms/api_c_adpt/dev/dev_coll_comm_c_adpt.cc |
| 20 | +src/legacy/unified_platform/resource/transport/aicpu/p2p_transport_lite_impl.cc |
| 21 | +src/legacy/unified_platform/resource/transport/aicpu/ub_transport_lite_impl.cc |
| 22 | +src/legacy/unified_platform/resource/transport/p2p_transport.cc |
| 23 | +src/legacy/unified_platform/resource/stream/stream.cc |
| 24 | +src/legacy/unified_platform/resource/notify/ipc_remote_notify.cc |
| 25 | +src/legacy/interface/rank_graph_interface.cc |
| 26 | +src/framework/next/comms/endpoint_pairs/channels/aicpu/aicpu_ts_p2p_channel.cc |
| 27 | +src/framework/next/comms/endpoint_pairs/channels/channel.cc |
| 28 | +src/framework/next/comms/common/orion_adpt_utils.cc |
| 29 |
| ... | @@ -20,7 +20,7 @@ JOB_NUM="-j${CPU_NUM}" |
| 2 | ASAN="false" |
| 3 | COV="false" |
| 4 | CUSTOM_OPTION="-DCMAKE_INSTALL_PREFIX=${BUILD_OUTPUT_DIR}" |
| 5 | -FULL_MODE="true" # 新增变量,用于控制是否全量构建 |
| 6 | +FULL_MODE="false" # 新增变量,用于控制是否全量构建 |
| 7 | KERNEL="false" # 新增变量,用于控制是否只编译 ccl_kernel.so |
| 8 | DO_NOT_CLEAN="false" # 是否清理 |
| 9 | CANN_3RD_LIB_PATH="${CURRENT_DIR}/third_party" |
| ... | @@ -37,8 +37,10 @@ BUILD_CB_TEST="false" |
| 11 | |
| 12 | ENABLE_UT="off" |
| 13 | ENABLE_ST="off" |
| 14 | +ST_TASKS=() |
| 15 | +ENABLE_GCOV="off" |
| 16 | +ENABLE_NO_EXEC="off" |
| 17 | CMAKE_BUILD_TYPE="Debug" |
| 18 | -ASCEND_3RD_LIB_PATH="${CURRENT_DIR}/output/third_party" |
| 19 | |
| 20 | if [ "${USER_ID}" != "0" ]; then |
| 21 | DEFAULT_TOOLKIT_INSTALL_DIR="${HOME}/Ascend/ascend-toolkit/latest" |
| ... | @@ -73,11 +75,17 @@ function clean() |
| 23 | mkdir -p ${BUILD_DIR} |
| 24 | } |
| 25 | |
| 26 | +function rmdir() |
| 27 | +{ |
| 28 | + if [ "${DO_NOT_CLEAN}" = "false" ] && [ $# -gt 0 ]; then |
| 29 | + rm -rf "$@" |
| 30 | + fi |
| 31 | +} |
| 32 | + |
| 33 | function cmake_config() |
| 34 | { |
| 35 | - local extra_option="$1" |
| 36 | - log "Info: cmake config ${CUSTOM_OPTION} ${extra_option} ." |
| 37 | - cmake .. ${CUSTOM_OPTION} ${extra_option} |
| 38 | + log "Info: cmake config ${CUSTOM_OPTION} $*" |
| 39 | + cmake .. ${CUSTOM_OPTION} "$@" |
| 40 | } |
| 41 | |
| 42 | function build() |
| ... | @@ -95,7 +103,7 @@ function build_package(){ |
| 44 | function build_device(){ |
| 45 | cmake_config |
| 46 | log "Info: build_device" |
| 47 | - TARGET_LIST="hccp_service.bin rs ccl_kernel_plf ccl_kernel_plf_a ccl_kernel" |
| 48 | + TARGET_LIST="hccp_service.bin rs net_co ccl_kernel_plf ccl_kernel_plf_a ccl_kernel aicpu_custom_json aicpu_custom" |
| 49 | echo "TARGET_LIST=${TARGET_LIST}" |
| 50 | PKG_TARGET_LIST="generate_device_hccp_package generate_device_aicpu_package" |
| 51 | echo "PKG_TARGET_LIST=${PKG_TARGET_LIST}" |
| ... | @@ -121,64 +129,80 @@ function build_cb_test_verify(){ |
| 53 | bash build.sh |
| 54 | } |
| 55 | |
| 56 | -function build_test() { |
| 57 | - ENABLE_ST="on" |
| 58 | - cmake_config -DENABLE_ST=${ENABLE_ST} |
| 59 | - |
| 60 | - LIBRARY_DIR="${BUILD_DIR}/test:${ASCEND_HOME_PATH}/lib64:" |
| 61 | - # 每日构建sdk包安装路径 |
| 62 | - if [ -d "${ASCEND_HOME_PATH}/opensdk" ];then |
| 63 | - LIBRARY_DIR="${LIBRARY_DIR}${ASCEND_HOME_PATH}/opensdk/opensdk/gtest_shared/lib64:" |
| 64 | +function run_ctest() { |
| 65 | + # 设置 --noexec 选项,则跳过执行测试用例 |
| 66 | + if [[ "$ENABLE_NO_EXEC" = "on" ]]; then |
| 67 | + log "Info: Skip executing tests" |
| 68 | + return 0 |
| 69 | fi |
| 70 | |
| 71 | - # 社区sdk包安装路径 |
| 72 | - if [ -d "${ASCEND_HOME_PATH}/../../latest/opensdk" ];then |
| 73 | - LIBRARY_DIR="${LIBRARY_DIR}${ASCEND_HOME_PATH}/../../latest/opensdk/opensdk/gtest_shared/lib64:" |
| 74 | + local suite_name="$1" # "ut" or "st" |
| 75 | + local log_dir="${OUTPUT_PATH}/logs/${suite_name}" |
| 76 | + local ctest_log="${log_dir}/ctest_output.log" |
| 77 | + local ctest_summary="${log_dir}/ctest_summary.log" |
| 78 | + |
| 79 | + # 创建日志目录 |
| 80 | + mk_dir "${log_dir}" |
| 81 | + |
| 82 | + # CTest 执行用例 |
| 83 | + ctest ${JOB_NUM} \ |
| 84 | + --build-nocmake \ |
| 85 | + --timeout 200 \ |
| 86 | + --output-on-failure \ |
| 87 | + --stop-on-failure \ |
| 88 | + --test-output-size-failed 10000000 \ |
| 89 | + -O "${ctest_log}" \ |
| 90 | + 2>&1 | tee "${ctest_summary}" |
| 91 | + |
| 92 | + # 超时时间:200s |
| 93 | + local ctest_ret=${PIPESTATUS[0]} |
| 94 | + if [ "${ctest_ret}" -eq 137 ]; then |
| 95 | + log "Error: ctest timeout: execute more than 200s killed" |
| 96 | + exit 1 |
| 97 | fi |
| 98 | |
| 99 | - GCC_MAJOR=`gcc -dumpversion | cut -d. -f1` |
| 100 | - if [ "${ASAN}" == "true" ];then |
| 101 | - ARCH=$(uname -m) |
| 102 | - if [[ $ARCH == "x86_64" || $ARCH == "i386" || $ARCH == "i686" ]]; then |
| 103 | - PRELOAD="/usr/lib/gcc/x86_64-linux-gnu/${GCC_MAJOR}/libasan.so:/usr/lib/gcc/x86_64-linux-gnu/${GCC_MAJOR}/libstdc++.so" |
| 104 | - elif [[ $ARCH == "aarch64" || $ARCH == "armv8l" || $ARCH == "armv7l" ]]; then |
| 105 | - PRELOAD="/usr/lib/gcc/aarch64-linux-gnu/${GCC_MAJOR}/libasan.so:/usr/lib/gcc/aarch64-linux-gnu/${GCC_MAJOR}/libstdc++.so" |
| 106 | - else |
| 107 | - echo "未知架构: $ARCH" |
| 108 | - fi |
| 109 | - echo "PRELOAD is ${PRELOAD}" |
| 110 | - ASAN_OPT="detect_leaks=0" |
| 111 | + return ${ctest_ret} |
| 112 | +} |
| 113 | + |
| 114 | +function build_st() { |
| 115 | + log "Info: build_st" |
| 116 | + mk_dir "${BUILD_DIR}" |
| 117 | + cd "${BUILD_DIR}" |
| 118 | + |
| 119 | + # 配置 ST 用例代码 |
| 120 | + local st_tasks=$(printf '%s;' "${ST_TASKS[@]}" | sed 's/;$//') |
| 121 | + log "Info: build_st: ST_TASKS=${st_tasks}" |
| 122 | + cmake_config -DPRODUCT_SIDE=host \ |
| 123 | + -DENABLE_GCOV=${ENABLE_GCOV} \ |
| 124 | + -DENABLE_TEST=${ENABLE_TEST} \ |
| 125 | + -DENABLE_ST=${ENABLE_ST} \ |
| 126 | + -DST_TASKS=${st_tasks} |
| 127 | + if [ $? -ne 0 ]; then |
| 128 | + log "Error: build_st: cmake config failed" |
| 129 | + exit 1 |
| 130 | fi |
| 131 | |
| 132 | - if [ "${TEST_TASK_NAME}" == "open_hccl_test" ] || [ "$TEST" = "all" ];then |
| 133 | - build open_hccl_test |
| 134 | - export LD_LIBRARY_PATH=${LIBRARY_DIR}${LD_LIBRARY_PATH} && export LD_PRELOAD=${PRELOAD} && export ASAN_OPTIONS=${ASAN_OPT} \ |
| 135 | - && ${BUILD_DIR}/test/st/algorithm/testcase/testcase/open_hccl_test |
| 136 | + # 编译 ST 用例代码 |
| 137 | + cmake --build . ${JOB_NUM} |
| 138 | + if [ $? -ne 0 ]; then |
| 139 | + log "Error: build_st: cmake build failed" |
| 140 | + exit 1 |
| 141 | fi |
| 142 | |
| 143 | - if [ "${TEST_TASK_NAME}" == "executor_hccl_test" ] || [ "$TEST" = "all" ];then |
| 144 | - build executor_hccl_test |
| 145 | - export LD_LIBRARY_PATH=${LIBRARY_DIR}${LD_LIBRARY_PATH} && export LD_PRELOAD=${PRELOAD} && export ASAN_OPTIONS=${ASAN_OPT} \ |
| 146 | - && ${BUILD_DIR}/test/st/algorithm/testcase/executor_testcase_generalization/executor_hccl_test |
| 147 | + # CTest 运行用例 |
| 148 | + run_ctest "st" |
| 149 | + if [ $? -ne 0 ]; then |
| 150 | + log "Error: build_st: ctest execution failed" |
| 151 | + exit 1 |
| 152 | fi |
| 153 | |
| 154 | - if [ "${TEST_TASK_NAME}" == "executor_reduce_hccl_test" ] || [ "$TEST" = "all" ];then |
| 155 | - build executor_reduce_hccl_test |
| 156 | - export LD_LIBRARY_PATH=${LIBRARY_DIR}${LD_LIBRARY_PATH} && export LD_PRELOAD=${PRELOAD} && export ASAN_OPTIONS=${ASAN_OPT} \ |
| 157 | - && ${BUILD_DIR}/test/st/algorithm/testcase/executor_reduce_testcase_generalization/executor_reduce_hccl_test |
| 158 | - fi |
| 159 | - |
| 160 | - if [ "${TEST_TASK_NAME}" == "executor_pipeline_hccl_test" ] || [ "$TEST" = "all" ];then |
| 161 | - build executor_pipeline_hccl_test |
| 162 | - export LD_LIBRARY_PATH=${LIBRARY_DIR}${LD_LIBRARY_PATH} && export LD_PRELOAD=${PRELOAD} && export ASAN_OPTIONS=${ASAN_OPT} \ |
| 163 | - && ${BUILD_DIR}/test/st/algorithm/testcase/executor_alltoall_A3_pipeline_testcase/executor_pipeline_hccl_test |
| 164 | - fi |
| 165 | + log "Info: Build and tests completed successfully!" |
| 166 | } |
| 167 | |
| 168 | function build_kernel() { |
| 169 | cmake_config |
| 170 | log "Info: build_kernel" |
| 171 | - build ccl_kernel_plf ccl_kernel_plf_a ccl_kernel aicpu_custom_json |
| 172 | + build ccl_kernel_plf ccl_kernel_plf_a ccl_kernel aicpu_custom_json aicpu_custom |
| 173 | } |
| 174 | |
| 175 | function mk_dir() { |
| ... | @@ -187,78 +211,56 @@ function mk_dir() { |
| 177 | echo "created ${create_dir}" |
| 178 | } |
| 179 | |
| 180 | -# create build path |
| 181 | function build_ut() { |
| 182 | - echo "create build directory and build"; |
| 183 | - mk_dir ${OUTPUT_PATH} |
| 184 | - mk_dir "${BUILD_DIR}" |
| 185 | - local report_dir="${OUTPUT_PATH}/report/ut" && mk_dir "${report_dir}" |
| 186 | - cd "${BUILD_DIR}" |
| 187 | + log "Info: build_ut" |
| 188 | + mk_dir "${BUILD_DIR}" |
| 189 | + cd "${BUILD_DIR}" |
| 190 | |
| 191 | - local LLT_KILL_TIME=1200 |
| 192 | - CMAKE_ARGS="-DPRODUCT_SIDE=host \ |
| 193 | - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ |
| 194 | - -DCMAKE_INSTALL_PREFIX=${BUILD_OUTPUT_DIR} \ |
| 195 | - -DASCEND_INSTALL_PATH=${ASCEND_INSTALL_PATH} \ |
| 196 | - -DASCEND_3RD_LIB_PATH=${ASCEND_3RD_LIB_PATH} \ |
| 197 | - -DENABLE_COV=${ENABLE_COV} \ |
| 198 | - -DENABLE_TEST=${ENABLE_TEST} \ |
| 199 | - -DENABLE_UT=${ENABLE_UT} \ |
| 200 | - -DOUTPUT_PATH=${OUTPUT_PATH} \ |
| 201 | - -DLLT_KILL_TIME=${LLT_KILL_TIME}" |
| 202 | + # 避免加载系统库 |
| 203 | + unset LD_LIBRARY_PATH |
| 204 | |
| 205 | - echo "CMAKE_ARGS=${CMAKE_ARGS}" |
| 206 | - cmake ${CMAKE_ARGS} .. |
| 207 | - if [ $? -ne 0 ]; then |
| 208 | - echo "execute command: cmake ${CMAKE_ARGS} .. failed." |
| 209 | - return 1 |
| 210 | - fi |
| 211 | + # 配置 UT 用例代码 |
| 212 | + cmake_config -DPRODUCT_SIDE=host \ |
| 213 | + -DENABLE_TEST=${ENABLE_TEST} \ |
| 214 | + -DENABLE_UT=${ENABLE_UT} \ |
| 215 | + -DENABLE_GCOV=${ENABLE_GCOV} |
| 216 | + if [ $? -ne 0 ]; then |
| 217 | + log "Error: build_ut: cmake config failed" |
| 218 | + exit 1 |
| 219 | + fi |
| 220 | |
| 221 | - # make all |
| 222 | - cmake --build . -j${CPU_NUM} |
| 223 | - run_ret=${PIPESTATUS[0]} |
| 224 | - echo "exit code: ${run_ret}" |
| 225 | - if [ "${run_ret}" -eq 137 ] |
| 226 | - then |
| 227 | - echo "timeout: execute more than ${LLT_KILL_TIME}s killed" |
| 228 | - exit 1 |
| 229 | - fi |
| 230 | - if [ $? -ne 0 ]; then |
| 231 | - echo "execute command: make -j${THREAD_NUM} failed." |
| 232 | - return 1 |
| 233 | - fi |
| 234 | - echo "build success!" |
| 235 | + # 编译 UT 用例代码 |
| 236 | + cmake --build . ${JOB_NUM} |
| 237 | + if [ $? -ne 0 ]; then |
| 238 | + log "Error: build_ut: cmake build failed" |
| 239 | + exit 1 |
| 240 | + fi |
| 241 | + |
| 242 | + # CTest 运行用例 |
| 243 | + run_ctest "ut" |
| 244 | + if [ $? -ne 0 ]; then |
| 245 | + log "Error: build_ut: ctest execution failed" |
| 246 | + exit 1 |
| 247 | + fi |
| 248 | + |
| 249 | + log "Info: Build and tests completed successfully!" |
| 250 | } |
| 251 | |
| 252 | function make_ut_gov() { |
| 253 | - if [[ "X$ENABLE_UT" = "Xon" || "X$ENABLE_COV" = "Xon" ]]; then |
| 254 | + if [[ "X$ENABLE_UT" = "Xon" && "X$ENABLE_GCOV" = "Xon" ]]; then |
| 255 | echo "Generated coverage statistics, please wait..." |
| 256 | cd ${CURRENT_DIR} |
| 257 | rm -rf ${CURRENT_DIR}/cov |
| 258 | mkdir -p ${CURRENT_DIR}/cov |
| 259 | - lcov -c -d ${BUILD_DIR}/test/ut/ -o cov/tmp.info |
| 260 | - LCOV_COMMAND="lcov -r cov/tmp.info ${CURRENT_DIR}src/* -o cov/coverage.info" && ${LCOV_COMMAND} |
| 261 | - # lcov -r cov/tmp.info "/usr/*" "${OUTPUT_PATH}/*" "${BASEPATH}/test/*" "${ASCEND_INSTALL_PATH}/*" "${ASCEND_3RD_LIB_PATH}/*" -o cov/coverage.info |
| 262 | + lcov -c -d ${BUILD_DIR}/test/ut/ -d ${BUILD_DIR}/test/legacy/ut/ -o cov/coverage.info |
| 263 | + lcov -r cov/coverage.info */src/platform/hccp/external_depends/* -o cov/coverage.info |
| 264 | + lcov -e cov/coverage.info */src/algorithm/* */src/common/* */src/hccd/* */src/legacy/* */src/framework/* */src/platform/* */src/pub_inc/* -o cov/coverage.info |
| 265 | |
| 266 | cd ${CURRENT_DIR}/cov |
| 267 | genhtml coverage.info |
| 268 | fi |
| 269 | } |
| 270 | |
| 271 | -function run_ut() { |
| 272 | - if [[ "X$ENABLE_UT" = "Xon" ]]; then |
| 273 | - local ut_dir="${BUILD_DIR}/test" |
| 274 | - echo "ut_dir = ${ut_dir}" |
| 275 | - find "$ut_dir" -type f -executable | while read -r ut_exec; do |
| 276 | - filename=$(basename "$ut_exec") |
| 277 | - echo "Executing: $filename" |
| 278 | - ${ut_exec} |
| 279 | - done |
| 280 | - else |
| 281 | - echo "Unit tests is not enabled, sh build.sh with parameter -u or --ut to enable it" |
| 282 | - fi |
| 283 | -} |
| 284 | - |
| 285 | # print usage message |
| 286 | function usage() { |
| 287 | echo "Usage:" |
| ... | @@ -270,12 +272,12 @@ function usage() { |
| 289 | echo "Options:" |
| 290 | echo " -h, --help Print usage" |
| 291 | echo " --asan Enable AddressSanitizer" |
| 292 | - echo " -build-type=<TYPE>" |
| 293 | + echo " --build-type=<TYPE>" |
| 294 | echo " Specify build type (TYPE options: Release/Debug), Default: Release" |
| 295 | echo " -j<N> Set the number of threads used for building, default is 8" |
| 296 | echo " --cann_3rd_lib_path=<PATH>" |
| 297 | echo " Set ascend third_party package install path, default ./output/third_party" |
| 298 | - echo " -p|--package-path <PATH>" |
| 299 | + echo " -p, --package-path <PATH>" |
| 300 | echo " Set ascend package install path, default /usr/local/Ascend/cann" |
| 301 | echo " --sign-script <PATH>" |
| 302 | echo " Set sign-script's path to <PATH>" |
| ... | @@ -283,6 +285,9 @@ function usage() { |
| 304 | echo " Enable to sign" |
| 305 | echo " --version <VERSION>" |
| 306 | echo " Set sign version to <VERSION>" |
| 307 | + echo " -u, --ut Run all unit tests (UT)" |
| 308 | + echo " -s, --st Run all system tests (ST)" |
| 309 | + echo " --noexec Run build and skip executing tests" |
| 310 | echo "" |
| 311 | } |
| 312 | |
| ... | @@ -322,33 +327,97 @@ while [[ $# -gt 0 ]]; do |
| 314 | CANN_3RD_LIB_PATH="$(realpath ${OPTARG#*=})" |
| 315 | shift |
| 316 | ;; |
| 317 | + --noexec) |
| 318 | + ENABLE_NO_EXEC="on" |
| 319 | + shift |
| 320 | + ;; |
| 321 | -u|--ut) |
| 322 | ENABLE_TEST="on" |
| 323 | ENABLE_UT="on" |
| 324 | shift |
| 325 | ;; |
| 326 | -s|--st) |
| 327 | - TEST="all" |
| 328 | + ENABLE_TEST="on" |
| 329 | + ENABLE_ST="on" |
| 330 | + ST_TASKS+=("all") |
| 331 | shift |
| 332 | ;; |
| 333 | --open_hccl_test) |
| 334 | - TEST="partial" |
| 335 | - TEST_TASK_NAME="open_hccl_test" |
| 336 | + ENABLE_TEST="on" |
| 337 | + ENABLE_ST="on" |
| 338 | + ST_TASKS+=("open_hccl_test") |
| 339 | shift |
| 340 | ;; |
| 341 | --executor_hccl_test) |
| 342 | - TEST="partial" |
| 343 | - TEST_TASK_NAME="executor_hccl_test" |
| 344 | + ENABLE_TEST="on" |
| 345 | + ENABLE_ST="on" |
| 346 | + ST_TASKS+=("executor_hccl_test") |
| 347 | shift |
| 348 | ;; |
| 349 | --executor_reduce_hccl_test) |
| 350 | - TEST="partial" |
| 351 | - TEST_TASK_NAME="executor_reduce_hccl_test" |
| 352 | + ENABLE_TEST="on" |
| 353 | + ENABLE_ST="on" |
| 354 | + ST_TASKS+=("executor_reduce_hccl_test") |
| 355 | shift |
| 356 | ;; |
| 357 | --executor_pipeline_hccl_test) |
| 358 | - TEST="partial" |
| 359 | - TEST_TASK_NAME="executor_pipeline_hccl_test" |
| 360 | + ENABLE_TEST="on" |
| 361 | + ENABLE_ST="on" |
| 362 | + ST_TASKS+=("executor_pipeline_hccl_test") |
| 363 | + shift |
| 364 | + ;; |
| 365 | + --legacy_all_testcase) |
| 366 | + ENABLE_TEST="on" |
| 367 | + ENABLE_ST="on" |
| 368 | + ST_TASKS+=("legacy_all_testcase") |
| 369 | + shift |
| 370 | + ;; |
| 371 | + --legacy_aicpu_2d_testcase) |
| 372 | + ENABLE_TEST="on" |
| 373 | + ENABLE_ST="on" |
| 374 | + ST_TASKS+=("legacy_aicpu_2d_testcase") |
| 375 | + shift |
| 376 | + ;; |
| 377 | + --legacy_ccu_2d_testcase) |
| 378 | + ENABLE_TEST="on" |
| 379 | + ENABLE_ST="on" |
| 380 | + ST_TASKS+=("legacy_ccu_2d_testcase") |
| 381 | + shift |
| 382 | + ;; |
| 383 | + --legacy_ccu_1d_hf16p_testcase) |
| 384 | + ENABLE_TEST="on" |
| 385 | + ENABLE_ST="on" |
| 386 | + ST_TASKS+=("legacy_ccu_1d_hf16p_testcase") |
| 387 | + shift |
| 388 | + ;; |
| 389 | + --legacy_ccu_1d_testcase_part1) |
| 390 | + ENABLE_TEST="on" |
| 391 | + ENABLE_ST="on" |
| 392 | + ST_TASKS+=("legacy_ccu_1d_testcase_part1") |
| 393 | + shift |
| 394 | + ;; |
| 395 | + --legacy_ccu_1d_testcase_part2) |
| 396 | + ENABLE_TEST="on" |
| 397 | + ENABLE_ST="on" |
| 398 | + ST_TASKS+=("legacy_ccu_1d_testcase_part2") |
| 399 | + shift |
| 400 | + ;; |
| 401 | + --legacy_alg_ccu_reduce) |
| 402 | + ENABLE_TEST="on" |
| 403 | + ENABLE_ST="on" |
| 404 | + ST_TASKS+=("legacy_alg_ccu_reduce") |
| 405 | + shift |
| 406 | + ;; |
| 407 | + --legacy_function_ut_testcase) |
| 408 | + ENABLE_TEST="on" |
| 409 | + ENABLE_ST="on" |
| 410 | + ST_TASKS+=("legacy_function_ut_testcase") |
| 411 | + shift |
| 412 | + ;; |
| 413 | + --legacy_alg_testcase) |
| 414 | + ENABLE_TEST="on" |
| 415 | + ENABLE_ST="on" |
| 416 | + ST_TASKS+=("legacy_alg_testcase") |
| 417 | shift |
| 418 | ;; |
| 419 | --aicpu) # 新增选项,用于只编译 ccl_kernel.so |
| ... | @@ -368,6 +437,7 @@ while [[ $# -gt 0 ]]; do |
| 421 | shift |
| 422 | ;; |
| 423 | --cov) |
| 424 | + ENABLE_GCOV="on" |
| 425 | COV="true" |
| 426 | shift |
| 427 | ;; |
| ... | @@ -409,30 +479,32 @@ while [[ $# -gt 0 ]]; do |
| 429 | esac |
| 430 | done |
| 431 | |
| 432 | -if [ -n "${TEST}" ];then |
| 433 | - CUSTOM_OPTION="${CUSTOM_OPTION} -DENABLE_TEST=ON" |
| 434 | -fi |
| 435 | - |
| 436 | if [ "${KERNEL}" == "true" ];then |
| 437 | CUSTOM_OPTION="${CUSTOM_OPTION} -DKERNEL_MODE=ON -DDEVICE_MODE=ON -DPRODUCT=ascend -DPRODUCT_SIDE=device" |
| 438 | fi |
| 439 | |
| 440 | if [ "${FULL_MODE}" == "true" ];then |
| 441 | CUSTOM_OPTION="${CUSTOM_OPTION} -DFULL_MODE=ON" |
| 442 | +else |
| 443 | + CUSTOM_OPTION="${CUSTOM_OPTION} -DFULL_MODE=OFF" |
| 444 | fi |
| 445 | |
| 446 | if [ "${BUILD_AARCH}" == "true" ];then |
| 447 | CUSTOM_OPTION="${CUSTOM_OPTION} -DAARCH_MODE=ON" |
| 448 | +else |
| 449 | + CUSTOM_OPTION="${CUSTOM_OPTION} -DAARCH_MODE=OFF" |
| 450 | fi |
| 451 | |
| 452 | if [ "${ASAN}" == "true" ];then |
| 453 | - CUSTOM_OPTION="${CUSTOM_OPTION} -DENABLE_ASAN=true" |
| 454 | + CUSTOM_OPTION="${CUSTOM_OPTION} -DENABLE_ASAN=ON" |
| 455 | fi |
| 456 | |
| 457 | if [ "${COV}" == "true" ];then |
| 458 | - CUSTOM_OPTION="${CUSTOM_OPTION} -DENABLE_GCOV=true" |
| 459 | + CUSTOM_OPTION="${CUSTOM_OPTION} -DENABLE_GCOV=ON" |
| 460 | fi |
| 461 | |
| 462 | +CUSTOM_OPTION="${CUSTOM_OPTION} -DASCENDC_DUMP=0" # AIV算子调测阶段可配置为1以打开AscendC打印功能 |
| 463 | + |
| 464 | if [ -n "${ascend_package_path}" ];then |
| 465 | ASCEND_CANN_PACKAGE_PATH=${ascend_package_path} |
| 466 | elif [ -n "${ASCEND_HOME_PATH}" ];then |
| ... | @@ -453,6 +525,7 @@ if [ -n "${third_party_nlohmann_path}" ];then |
| 468 | fi |
| 469 | |
| 470 | CUSTOM_OPTION="${CUSTOM_OPTION} -DCUSTOM_ASCEND_CANN_PACKAGE_PATH=${ASCEND_CANN_PACKAGE_PATH}" |
| 471 | +CUSTOM_OPTION="${CUSTOM_OPTION} -DASCEND_INSTALL_PATH=${ASCEND_CANN_PACKAGE_PATH}" |
| 472 | # CUSTOM_OPTION="${CUSTOM_OPTION} -DCANN_3RD_LIB_PATH=${cann_3rd_lib_path}" |
| 473 | CUSTOM_OPTION="$CUSTOM_OPTION -DCANN_3RD_LIB_PATH=${CANN_3RD_LIB_PATH} -DCANN_UTILS_LIB_PATH=${CANN_UTILS_LIB_PATH}" |
| 474 | |
| ... | @@ -471,8 +544,8 @@ cd ${BUILD_DIR} |
| 476 | if [ "${ENABLE_UT}" == "on" ]; then |
| 477 | build_ut |
| 478 | make_ut_gov |
| 479 | -elif [ -n "${TEST}" ];then |
| 480 | - build_test |
| 481 | +elif [ "${ENABLE_ST}" == "on" ]; then |
| 482 | + build_st |
| 483 | elif [ "${KERNEL}" == "true" ]; then |
| 484 | build_kernel |
| 485 | elif [ "${BUILD_FWK_HLT}" == "true" ]; then |
| ... | @@ -505,8 +578,16 @@ elif [ "${FULL_MODE}" == "true" ]; then |
| 487 | cd .. & cd ${BUILD_DIR} |
| 488 | CUSTOM_OPTION="${CURRENT_CUSTOM_OPTION} -DDEVICE_MODE=OFF -DPRODUCT=ascend -DPRODUCT_SIDE=host -DUSE_ALOG=1" |
| 489 | build_package |
| 490 | - rm -rf ${BUILD_DEVICE_DIR} ${BUILD_HCCD_DIR} |
| 491 | + rmdir ${BUILD_DEVICE_DIR} ${BUILD_HCCD_DIR} |
| 492 | else |
| 493 | - CUSTOM_OPTION="${CUSTOM_OPTION} -DDEVICE_MODE=OFF -DPRODUCT=ascend -DPRODUCT_SIDE=host -DUSE_ALOG=1" |
| 494 | + cd .. |
| 495 | + mkdir -p ${BUILD_DEVICE_DIR} |
| 496 | + cd ${BUILD_DEVICE_DIR} |
| 497 | + CURRENT_CUSTOM_OPTION="${CUSTOM_OPTION}" |
| 498 | + CUSTOM_OPTION="${CURRENT_CUSTOM_OPTION} -DDEVICE_MODE=ON -DKERNEL_MODE=ON -DPRODUCT=ascend -DPRODUCT_SIDE=device -DUSE_ALOG=0 -DCUSTOM_SIGN_SCRIPT=${CUSTOM_SIGN_SCRIPT} -DENABLE_SIGN=${ENABLE_SIGN} -DVERSION_INFO=${VERSION_INFO}" |
| 499 | + build_kernel |
| 500 | + cd .. & cd ${BUILD_DIR} |
| 501 | + CUSTOM_OPTION="${CURRENT_CUSTOM_OPTION} -DDEVICE_MODE=OFF -DPRODUCT=ascend -DPRODUCT_SIDE=host -DUSE_ALOG=1" |
| 502 | build_package |
| 503 | -fi |
| 504 | \ No newline at end of file |
| 505 | + rmdir ${BUILD_DEVICE_DIR} |
| 506 | +fi |
| 507 |
| ... | @@ -1,212 +0,0 @@ |
| 2 | -# ----------------------------------------------------------------------------------------------------------- |
| 3 | -# Copyright (c) 2025 Huawei Technologies Co., Ltd. |
| 4 | -# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | -# Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | -# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | -# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| 9 | -# See LICENSE in the root of the software repository for the full text of the License. |
| 10 | -# ----------------------------------------------------------------------------------------------------------- |
| 11 | -#!/bin/bash |
| 12 | - |
| 13 | -set -e |
| 14 | -BASEPATH=$(cd "$(dirname $0)"; pwd) |
| 15 | -OUTPUT_PATH="${BASEPATH}/output/third_party" |
| 16 | - |
| 17 | -# print usage message |
| 18 | -usage() { |
| 19 | - echo "Usage:" |
| 20 | - echo " sh build_third_party.sh [-h | --help]" |
| 21 | - echo " [--output_path=<PATH>]" |
| 22 | - echo "" |
| 23 | - echo "Options:" |
| 24 | - echo " -h, --help Print usage" |
| 25 | - echo " --output_path=<PATH>" |
| 26 | - echo " Set the output path for third-party libraries, default ./output/third_party" |
| 27 | - echo "" |
| 28 | -} |
| 29 | - |
| 30 | -# parse and set options |
| 31 | -checkopts() { |
| 32 | - while [[ $# -gt 0 ]]; do |
| 33 | - case "$1" in |
| 34 | - -h | --help) |
| 35 | - usage |
| 36 | - exit 0 |
| 37 | - ;; |
| 38 | - --output_path=*) |
| 39 | - OUTPUT_PATH="$(realpath "${1#*=}")" |
| 40 | - shift |
| 41 | - ;; |
| 42 | - *) |
| 43 | - echo "Undefined option: $1" |
| 44 | - usage |
| 45 | - exit 1 |
| 46 | - ;; |
| 47 | - esac |
| 48 | - done |
| 49 | -} |
| 50 | - |
| 51 | -mk_dir() { |
| 52 | - local create_dir="$1" |
| 53 | - mkdir -pv "${create_dir}" |
| 54 | - echo "created ${create_dir}" |
| 55 | -} |
| 56 | - |
| 57 | -download_and_compile() { |
| 58 | - echo "Downloading files to ${OUTPUT_PATH}..." |
| 59 | - |
| 60 | - mk_dir "${OUTPUT_PATH}/pkg" |
| 61 | - mk_dir "${OUTPUT_PATH}/json" |
| 62 | - mk_dir "${OUTPUT_PATH}/gtest_shared" |
| 63 | - mk_dir "${OUTPUT_PATH}/mpich_shared" |
| 64 | - cpu_cores=$(lscpu | grep 'CPU(s):' | awk '{print$2}') |
| 65 | - |
| 66 | - # Downloading json |
| 67 | - wget --no-check-certificate -O "${OUTPUT_PATH}/pkg/json_include.zip" https://gitcode.com/cann-src-third-party/json/releases/download/v3.11.3/include.zip |
| 68 | - if [ $? -ne 0 ]; then |
| 69 | - echo "Failed to download json files" |
| 70 | - exit 1; |
| 71 | - fi |
| 72 | - |
| 73 | - unzip "${OUTPUT_PATH}/pkg/json_include.zip" -d "${OUTPUT_PATH}/json" |
| 74 | - if [ $? -ne 0 ]; then |
| 75 | - echo "Failed to extract json files" |
| 76 | - exit 1; |
| 77 | - fi |
| 78 | - |
| 79 | - # Downloading gtest |
| 80 | - wget --no-check-certificate -O "${OUTPUT_PATH}/pkg/googletest-1.14.0.tar.gz" https://gitcode.com/cann-src-third-party/googletest/releases/download/v1.14.0/googletest-1.14.0.tar.gz |
| 81 | - if [ $? -ne 0 ]; then |
| 82 | - echo "Failed to download gtest files" |
| 83 | - exit 1; |
| 84 | - fi |
| 85 | - |
| 86 | - tar -zxvf "${OUTPUT_PATH}/pkg/googletest-1.14.0.tar.gz" -C "${OUTPUT_PATH}/gtest_shared" |
| 87 | - if [ $? -ne 0 ]; then |
| 88 | - echo "Failed to extract gtest files" |
| 89 | - exit 1; |
| 90 | - fi |
| 91 | - |
| 92 | - cd "${OUTPUT_PATH}/gtest_shared/googletest-1.14.0" |
| 93 | - cmake -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -O2 -D_FORTIFY_SOURCE=2 -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack" \ |
| 94 | - -DCMAKE_C_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -O2 -D_FORTIFY_SOURCE=2 -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack" \ |
| 95 | - -DCMAKE_INSTALL_PREFIX=${OUTPUT_PATH}/gtest_shared \ |
| 96 | - -DCMAKE_INSTALL_LIBDIR=lib64 \ |
| 97 | - -DBUILD_TESTING=OFF \ |
| 98 | - -DBUILD_SHARED_LIBS=ON |
| 99 | - if [ $? -ne 0 ]; then |
| 100 | - echo "Failed to configure googletest with cmake" |
| 101 | - exit 1; |
| 102 | - fi |
| 103 | - |
| 104 | - make && make install |
| 105 | - if [ $? -ne 0 ]; then |
| 106 | - echo "Failed to install googletest" |
| 107 | - exit 1; |
| 108 | - fi |
| 109 | - |
| 110 | - cd "${OUTPUT_PATH}/gtest_shared" |
| 111 | - ln -s lib64 lib |
| 112 | - |
| 113 | - echo "All operations completed successfully!" |
| 114 | -} |
| 115 | - |
| 116 | -download_mockcpp() { |
| 117 | - MOCKCPP_PKG_URL="https://gitcode.com/cann-src-third-party/mockcpp/releases/download/v2.7-h2/mockcpp-2.7.zip" |
| 118 | - MOCKCPP_PATCH_URL="https://gitcode.com/cann-src-third-party/mockcpp/releases/download/v2.7-h2/mockcpp-2.7_py3.patch" |
| 119 | - |
| 120 | - # 下载 |
| 121 | - wget --no-check-certificate -O "${OUTPUT_PATH}/pkg/mockcpp-2.7.zip" ${MOCKCPP_PKG_URL} |
| 122 | - wget --no-check-certificate -O "${OUTPUT_PATH}/pkg/mockcpp-2.7.patch" ${MOCKCPP_PATCH_URL} |
| 123 | - |
| 124 | - # 解压 |
| 125 | - unzip "${OUTPUT_PATH}/pkg/mockcpp-2.7.zip" -d "${OUTPUT_PATH}/mockcpp_shared" |
| 126 | - |
| 127 | - # 补丁 |
| 128 | - cd ${OUTPUT_PATH}/mockcpp_shared/mockcpp-2.7 |
| 129 | - patch -p1 < ${OUTPUT_PATH}/pkg/mockcpp-2.7.patch |
| 130 | -} |
| 131 | - |
| 132 | -build_mockcpp() { |
| 133 | - apt-get install libboost-dev -y |
| 134 | - |
| 135 | - cd "${OUTPUT_PATH}/mockcpp_shared/mockcpp-2.7/" |
| 136 | - |
| 137 | - cmake -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -O2 -D_FORTIFY_SOURCE=2 -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack" \ |
| 138 | - -DCMAKE_C_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -O2 -D_FORTIFY_SOURCE=2 -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack" \ |
| 139 | - -DBUILD_32_BIT_TARGET_BY_64_BIT_COMPILER=OFF \ |
| 140 | - -DCMAKE_INSTALL_PREFIX=${OUTPUT_PATH}/mockcpp_shared \ |
| 141 | - -DCMAKE_INSTALL_LIBDIR=lib64 \ |
| 142 | - -DBUILD_TESTING=OFF \ |
| 143 | - -DBUILD_SHARED_LIBS=ON |
| 144 | - |
| 145 | - make && make install |
| 146 | - |
| 147 | - cd "${OUTPUT_PATH}/mockcpp_shared" |
| 148 | - ln -s lib64 lib |
| 149 | -} |
| 150 | - |
| 151 | -download_and_compile_protobuf() { |
| 152 | - mk_dir "${OUTPUT_PATH}/protobuf" |
| 153 | - mk_dir "${OUTPUT_PATH}/abseil-cpp" |
| 154 | - |
| 155 | - # 下载 |
| 156 | - PROTOBUF_URL="https://gitcode.com/cann-src-third-party/protobuf/releases/download/v25.1/protobuf-25.1.zip" |
| 157 | - wget --no-check-certificate -O "${OUTPUT_PATH}/pkg/protobuf-25.1.zip" ${PROTOBUF_URL} |
| 158 | - |
| 159 | - # 下载abseil子模块 |
| 160 | - ABSEIL_URL="https://gitcode.com/cann-src-third-party/abseil-cpp/releases/download/20250127.0/abseil-cpp-20250127.0.zip" |
| 161 | - wget --no-check-certificate -O "${OUTPUT_PATH}/pkg/abseil-cpp-20250127.0.zip" ${ABSEIL_URL} |
| 162 | - |
| 163 | - # 解压 |
| 164 | - unzip "${OUTPUT_PATH}/pkg/protobuf-25.1.zip" -d "${OUTPUT_PATH}/protobuf" |
| 165 | - unzip "${OUTPUT_PATH}/pkg/abseil-cpp-20250127.0.zip" -d "${OUTPUT_PATH}/protobuf/protobuf-25.1/third_party" |
| 166 | - |
| 167 | - # 下载abseil子模块 |
| 168 | - cd "${OUTPUT_PATH}/protobuf/protobuf-25.1/third_party" |
| 169 | - mv abseil-cpp-20250127.0/* abseil-cpp |
| 170 | - |
| 171 | - # 编译 |
| 172 | - mk_dir "${OUTPUT_PATH}/protobuf/protobuf-25.1" |
| 173 | - cd "${OUTPUT_PATH}/protobuf/protobuf-25.1" |
| 174 | - |
| 175 | - cmake -G "Unix Makefiles" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" \ |
| 176 | - -DCMAKE_BUILD_TYPE=Release \ |
| 177 | - -DCMAKE_INSTALL_PREFIX=${OUTPUT_PATH}/protobuf \ |
| 178 | - -DCMAKE_INSTALL_LIBDIR=lib64 \ |
| 179 | - -DBUILD_SHARED_LIBS=ON \ |
| 180 | - -Dprotobuf_WITH_ZLIB=OFF \ |
| 181 | - -Dprotobuf_BUILD_TESTS=OFF |
| 182 | - |
| 183 | - make -j8 && make install |
| 184 | - ln -s lib64 lib |
| 185 | -} |
| 186 | - |
| 187 | -main() { |
| 188 | - checkopts "$@" |
| 189 | - |
| 190 | - echo "---------------- script start ----------------" |
| 191 | - whoami |
| 192 | - id |
| 193 | - echo $USER |
| 194 | - |
| 195 | - download_and_compile |
| 196 | - if [[ "$?" -ne 0 ]]; then |
| 197 | - echo "script failed."; |
| 198 | - exit 1; |
| 199 | - fi |
| 200 | - echo "---------------- download_and_compile pass ----------------" |
| 201 | - # 下载、编译 mockcpp |
| 202 | - download_mockcpp |
| 203 | - echo "---------------- download_mockcpp pass ----------------" |
| 204 | - build_mockcpp |
| 205 | - echo "---------------- build_mockcpp pass ----------------" |
| 206 | - |
| 207 | - # 下载、编译 protobuf |
| 208 | - download_and_compile_protobuf |
| 209 | - |
| 210 | - echo "---------------- script finished ----------------" |
| 211 | -} |
| 212 | - |
| 213 | -main "$@" |
| 214 |
| ... | @@ -0,0 +1,24 @@ |
| 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 | +hcomm: |
| 11 | + commiter: |
| 12 | + "yanyefeng" |
| 13 | + team: "hcomm" |
| 14 | + src: |
| 15 | + release: |
| 16 | + - src |
| 17 | + - include |
| 18 | + unrelease: |
| 19 | + - src/legacy/framework/ccu/ccu_ins/ccu_ins.h |
| 20 | + - src/legacy/service/ |
| 21 | + - src/algorithm/ |
| 22 | + - src/platform/hccp/ |
| 23 | + llt: |
| 24 | + ut_check: true |
| 25 | + st_check: false |
| 26 |
| ... | @@ -1,13 +1,12 @@ |
| 2 | -# ---------------------------------------------------------------------------- |
| 3 | -# This program is free software, you can redistribute it and/or modify it. |
| 4 | +# ----------------------------------------------------------------------------------------------------------- |
| 5 | # Copyright (c) 2025 Huawei Technologies Co., Ltd. |
| 6 | -# This file is a part of the CANN Open Software. |
| 7 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). |
| 8 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 9 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 10 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 11 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 12 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| 13 | # See LICENSE in the root of the software repository for the full text of the License. |
| 14 | -# ---------------------------------------------------------------------------- |
| 15 | +# ----------------------------------------------------------------------------------------------------------- |
| 16 | |
| 17 | # _pack_stage.cmake |
| 18 | # Unified staging script: copies files + optionally generates SHA256 manifest. |
| 19 |
| ... | @@ -1,4 +1,12 @@ |
| 2 | - |
| 3 | +# ----------------------------------------------------------------------------------------------------------- |
| 4 | +# Copyright (c) 2025 Huawei Technologies Co., Ltd. |
| 5 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 6 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 7 | +# Please refer to the License for details. You may not use this file except in compliance with the License. |
| 8 | +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 9 | +# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| 10 | +# See LICENSE in the root of the software repository for the full text of the License. |
| 11 | +# ----------------------------------------------------------------------------------------------------------- |
| 12 | set(DEFAULT_BUILD_TYPE "Release") |
| 13 | |
| 14 | if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) |
| ... | @@ -75,6 +83,7 @@ set(HOST_STUBS |
| 16 | unified_dlog |
| 17 | mmpa |
| 18 | ascendcl |
| 19 | + tsdclient |
| 20 | ) |
| 21 | endif() |
| 22 | |
| ... | @@ -125,12 +134,6 @@ set(ASCEND_MOCKCPP_PACKAGE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) |
| 24 | # message(FATAL_ERROR "${THIRD_PARTY_NLOHMANN_PATH} does not exist, please check the setting of THIRD_PARTY_NLOHMANN_PATH.") |
| 25 | # endif() |
| 26 | |
| 27 | -set(ASCEND_SDK_PACKAGE_PATH "${ASCEND_CANN_PACKAGE_PATH}") |
| 28 | -if (NOT EXISTS "${ASCEND_CANN_PACKAGE_PATH}/opensdk") |
| 29 | - # 设置社区包sdk安装位置 |
| 30 | - set(ASCEND_SDK_PACKAGE_PATH "${ASCEND_CANN_PACKAGE_PATH}/../latest") |
| 31 | -endif() |
| 32 | - |
| 33 | #execute_process(COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/check_version_compatiable.sh |
| 34 | # ${ASCEND_CANN_PACKAGE_PATH} |
| 35 | # hccl |
| ... | @@ -155,10 +158,11 @@ set(HI_PYTHON "python3" CACHE STRING |
| 37 | message(STATUS "config.cmake KERNEL_MODE=${KERNEL_MODE} BUILD_OPEN_PROJECT=${BUILD_OPEN_PROJECT}") |
| 38 | message(STATUS "config.cmake PRODUCT=${PRODUCT} PRODUCT_SIDE=${PRODUCT_SIDE}") |
| 39 | |
| 40 | -set(INSTALL_LIBRARY_DIR hcomm/lib64) |
| 41 | -set(INSTALL_INCLUDE_DIR hcomm/include) |
| 42 | -set(INSTALL_PKG_INCLUDE_DIR hcomm/pkg_inc) |
| 43 | -set(INSTALL_CCL_KERNEL_JSON_DIR hcomm/built-in/data/op/aicpu) |
| 44 | -set(INSTALL_DEVICE_TAR_DIR hcomm/Ascend/aicpu) |
| 45 | +set(INSTALL_LIBRARY_DIR ${CMAKE_SYSTEM_PROCESSOR}-linux/lib64) |
| 46 | +set(INSTALL_INCLUDE_DIR ${CMAKE_SYSTEM_PROCESSOR}-linux/include) |
| 47 | +set(INSTALL_PKG_INCLUDE_DIR ${CMAKE_SYSTEM_PROCESSOR}-linux/pkg_inc) |
| 48 | +set(INSTALL_CCL_KERNEL_JSON_DIR opp/built-in/op_impl/aicpu) |
| 49 | +set(INSTALL_DPU_KERNEL_JSON_DIR opp/built-in/op_impl/dpu) |
| 50 | +set(INSTALL_DEVICE_TAR_DIR compat) |
| 51 | |
| 52 | -set(CMAKE_SKIP_RPATH TRUE) |
| 53 | \ No newline at end of file |
| 54 | +set(CMAKE_SKIP_RPATH TRUE) |
| 55 |
| ... | @@ -0,0 +1,38 @@ |
| 2 | +# ----------------------------------------------------------------------------------------------------------- |
| 3 | +# Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | +# Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | +# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| 9 | +# See LICENSE in the root of the software repository for the full text of the License. |
| 10 | +# ----------------------------------------------------------------------------------------------------------- |
| 11 | +# 引入CANN/cmake库 |
| 12 | + |
| 13 | +if(NOT PROJECT_SOURCE_DIR) |
| 14 | + if(CANN_3RD_LIB_PATH AND IS_DIRECTORY "${CANN_3RD_LIB_PATH}/cann-cmake") |
| 15 | + include("${CANN_3RD_LIB_PATH}/cann-cmake/function/prepare.cmake") |
| 16 | + else() |
| 17 | + include(FetchContent) |
| 18 | + |
| 19 | + set(CANN_CMAKE_TAG "master-001") |
| 20 | + if(CANN_3RD_LIB_PATH AND EXISTS "${CANN_3RD_LIB_PATH}/cmake-${CANN_CMAKE_TAG}.tar.gz") |
| 21 | + FetchContent_Declare( |
| 22 | + cann-cmake |
| 23 | + URL "${CANN_3RD_LIB_PATH}/cmake-${CANN_CMAKE_TAG}.tar.gz" |
| 24 | + ) |
| 25 | + else() |
| 26 | + FetchContent_Declare( |
| 27 | + cann-cmake |
| 28 | + GIT_REPOSITORY https://gitcode.com/cann/cmake.git |
| 29 | + GIT_TAG ${CANN_CMAKE_TAG} |
| 30 | + GIT_SHALLOW TRUE |
| 31 | + ) |
| 32 | + endif() |
| 33 | + FetchContent_GetProperties(cann-cmake) |
| 34 | + if(NOT cann-cmake_POPULATED) |
| 35 | + FetchContent_Populate(cann-cmake) |
| 36 | + endif() |
| 37 | + include("${cann-cmake_SOURCE_DIR}/function/prepare.cmake") |
| 38 | + endif() |
| 39 | +endif() |
| 40 | \ No newline at end of file |
| 41 |
| ... | @@ -1,13 +1,12 @@ |
| 2 | -# ---------------------------------------------------------------------------- |
| 3 | -# This program is free software, you can redistribute it and/or modify it. |
| 4 | +# ----------------------------------------------------------------------------------------------------------- |
| 5 | # Copyright (c) 2025 Huawei Technologies Co., Ltd. |
| 6 | -# This file is a part of the CANN Open Software. |
| 7 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). |
| 8 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 9 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 10 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 11 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 12 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| 13 | # See LICENSE in the root of the software repository for the full text of the License. |
| 14 | -# ---------------------------------------------------------------------------- |
| 15 | +# ----------------------------------------------------------------------------------------------------------- |
| 16 | |
| 17 | # ============================================================================= |
| 18 | # Function: pack_targets_and_files |
| ... | @@ -21,6 +20,7 @@ |
| 20 | # [TARGETS target1 [target2 ...]] |
| 21 | # [FILES file1 [file2 ...]] |
| 22 | # [MANIFEST <manifest_filename>] # e.g., "aicpu_compat_bin_hash.cfg" |
| 23 | +# [TAR_ROOT_DIR <directory>] # e.g., "aicpu_kernels_device" (optional, default: ".") |
| 24 | # ) |
| 25 | # |
| 26 | # Examples: |
| ... | @@ -38,12 +38,21 @@ |
| 28 | # TARGETS app |
| 29 | # FILES "README.md" |
| 30 | # ) |
| 31 | +# |
| 32 | +# # With custom tar root directory |
| 33 | +# pack_targets_and_files( |
| 34 | +# OUTPUT aicpu_hcomm.tar.gz |
| 35 | +# TARGETS ccl_kernel |
| 36 | +# FILES ${CCL_KERNEL_TAR_LIBS} |
| 37 | +# MANIFEST "bin_hash.cfg" |
| 38 | +# TAR_ROOT_DIR "aicpu_kernels_device" |
| 39 | +# ) |
| 40 | # ============================================================================= |
| 41 | set(_FUNC_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}") |
| 42 | function(pack_targets_and_files) |
| 43 | cmake_parse_arguments(ARG |
| 44 | "" |
| 45 | - "OUTPUT;MANIFEST;OUTPUT_TARGET" |
| 46 | + "OUTPUT;MANIFEST;OUTPUT_TARGET;TAR_ROOT_DIR" |
| 47 | "TARGETS;FILES" |
| 48 | ${ARGN} |
| 49 | ) |
| ... | @@ -80,6 +89,14 @@ function(pack_targets_and_files) |
| 51 | message(FATAL_ERROR "[pack_targets_and_files] No targets or files specified to pack") |
| 52 | endif() |
| 53 | |
| 54 | + if(ARG_TAR_ROOT_DIR) |
| 55 | + set(staging_subdir "${staging_dir}/${ARG_TAR_ROOT_DIR}") |
| 56 | + set(tar_src ${ARG_TAR_ROOT_DIR}) |
| 57 | + else() |
| 58 | + set(staging_subdir "${staging_dir}") |
| 59 | + set(tar_src ".") |
| 60 | + endif() |
| 61 | + |
| 62 | set(manifest_arg "") |
| 63 | if(ARG_MANIFEST) |
| 64 | if("${ARG_MANIFEST}" STREQUAL "") |
| ... | @@ -88,25 +105,25 @@ function(pack_targets_and_files) |
| 66 | if(IS_ABSOLUTE "${ARG_MANIFEST}") |
| 67 | message(FATAL_ERROR "[pack] MANIFEST must be relative (e.g., 'sha256sums.cfg')") |
| 68 | endif() |
| 69 | - set(manifest_arg -D_MANIFEST_FILE=${staging_dir}/${ARG_MANIFEST}) |
| 70 | + set(manifest_arg -D_MANIFEST_FILE=${staging_subdir}/${ARG_MANIFEST}) |
| 71 | endif() |
| 72 | |
| 73 | add_custom_command( |
| 74 | - OUTPUT ${staging_dir} |
| 75 | - COMMAND ${CMAKE_COMMAND} -E make_directory "${staging_dir}" |
| 76 | + OUTPUT ${staging_subdir} |
| 77 | + COMMAND ${CMAKE_COMMAND} -E make_directory "${staging_subdir}" |
| 78 | VERBATIM |
| 79 | ) |
| 80 | |
| 81 | add_custom_command( |
| 82 | OUTPUT "${ARG_OUTPUT}" |
| 83 | COMMAND ${CMAKE_COMMAND} |
| 84 | - -D _STAGING_DIR=${staging_dir} |
| 85 | + -D _STAGING_DIR=${staging_subdir} |
| 86 | ${manifest_arg} |
| 87 | -D "_ITEMS=$<JOIN:${src_items},;>" |
| 88 | -P "${_FUNC_CMAKE_DIR}/_pack_stage.cmake" |
| 89 | - COMMAND ${CMAKE_COMMAND} -E tar "czf" "${ARG_OUTPUT}" . |
| 90 | + COMMAND ${CMAKE_COMMAND} -E tar "czf" "${ARG_OUTPUT}" ${tar_src} |
| 91 | WORKING_DIRECTORY ${staging_dir} |
| 92 | - DEPENDS ${ARG_TARGETS} ${staging_dir} |
| 93 | + DEPENDS ${ARG_TARGETS} ${staging_subdir} |
| 94 | COMMENT "Packing with ${ARG_OUTPUT}" |
| 95 | VERBATIM |
| 96 | ) |
| ... | @@ -177,7 +194,6 @@ function(sign_file) |
| 98 | set(sign_cmd bash ${SIGN_SCRIPT} ${output_sig} ${ARG_CONFIG} ${sign_flag}) |
| 99 | elseif(${EXT} STREQUAL ".py") |
| 100 | set(root_dir ${CMAKE_SOURCE_DIR}) |
| 101 | - set(SIGN_SCRIPT "${root_dir}/scripts/sign/community_sign_build.py") |
| 102 | message(STATUS "Detected +++VERSION_INFO: ${VERSION_INFO}") |
| 103 | set(sign_cmd python3 ${root_dir}/scripts/sign/add_header_sign.py ${signatures_dir} ${sign_flag} --bios_check_cfg=${ARG_CONFIG} --sign_script=${SIGN_SCRIPT} --version=${VERSION_INFO}) |
| 104 | endif() |
| ... | @@ -209,4 +225,35 @@ function(sign_file) |
| 106 | if(ARG_RESULT_VAR) |
| 107 | set(${ARG_RESULT_VAR} "${output_sig}" PARENT_SCOPE) |
| 108 | endif() |
| 109 | +endfunction() |
| 110 | + |
| 111 | +# 检查构建依赖 |
| 112 | +function(check_pkg_build_deps pkg_name) |
| 113 | + execute_process( |
| 114 | + COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/scripts/check_build_dependencies.py "$ENV{ASCEND_HOME_PATH}" ${CANN_VERSION_${pkg_name}_BUILD_DEPS} |
| 115 | + RESULT_VARIABLE result |
| 116 | + ) |
| 117 | + if(result) |
| 118 | + message(FATAL_ERROR "Check ${pkg_name} build dependencies failed!") |
| 119 | + endif() |
| 120 | +endfunction() |
| 121 | + |
| 122 | +set(HOST_ONLY "false") |
| 123 | +if (NOT FULL_MODE) |
| 124 | +set(HOST_ONLY "true") |
| 125 | +endif() |
| 126 | + |
| 127 | +# 添加生成version.info的目标 |
| 128 | +# 目标名格式为:version_${包名}_info |
| 129 | +function(add_version_info_targets) |
| 130 | + foreach(pkg_name ${CANN_VERSION_PACKAGES}) |
| 131 | + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/version.${pkg_name}.info |
| 132 | + COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_version_info.py --output ${CMAKE_BINARY_DIR}/version.${pkg_name}.info |
| 133 | + "${CANN_VERSION_${pkg_name}_VERSION}" ${CANN_VERSION_${pkg_name}_RUN_DEPS} |
| 134 | + COMMAND ${CMAKE_COMMAND} -E echo "host_only=${HOST_ONLY}" >> ${CMAKE_BINARY_DIR}/version.${pkg_name}.info |
| 135 | + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/version.cmake ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_version_info.py |
| 136 | + VERBATIM |
| 137 | + ) |
| 138 | + add_custom_target(version_${pkg_name}_info ALL DEPENDS ${CMAKE_BINARY_DIR}/version.${pkg_name}.info) |
| 139 | + endforeach() |
| 140 | endfunction() |
| 141 | \ No newline at end of file |
| 142 |
| ... | @@ -1,10 +1,26 @@ |
| 2 | +# ----------------------------------------------------------------------------------------------------------- |
| 3 | +# Copyright (c) 2025 Huawei Technologies Co., Ltd. |
| 4 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | +# Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | +# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| 9 | +# See LICENSE in the root of the software repository for the full text of the License. |
| 10 | +# ----------------------------------------------------------------------------------------------------------- |
| 11 | +if(NOT DEFINED OUTPUT_PATH OR "${OUTPUT_PATH}" STREQUAL "") |
| 12 | + set(OUTPUT_PATH "${CMAKE_BINARY_DIR}") |
| 13 | +endif() |
| 14 | set(report_dir "${OUTPUT_PATH}/report/ut") |
| 15 | +if(NOT DEFINED LLT_KILL_TIME OR "${LLT_KILL_TIME}" STREQUAL "") |
| 16 | + set(LLT_KILL_TIME 1200) |
| 17 | +endif() |
| 18 | # 定义add_run_command函数 |
| 19 | function(add_run_command TARGET_NAME TASK_NUM) |
| 20 | add_custom_command( |
| 21 | TARGET ${TARGET_NAME} |
| 22 | POST_BUILD |
| 23 | - COMMAND ${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${ASCEND_3RD_LIB_PATH}/gtest_shared/lib/ ASAN_OPTIONS=detect_leaks=0 timeout -s SIGKILL ${LLT_KILL_TIME}s ./${TARGET_NAME} --gtest_output=xml:${report_dir}/${TARGET_NAME}.xml |
| 24 | + COMMAND ${CMAKE_COMMAND} -E make_directory ${report_dir} |
| 25 | + COMMAND ${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CANN_3RD_LIB_PATH}/gtest/lib64/ ASAN_OPTIONS=detect_leaks=0 timeout -s SIGKILL ${LLT_KILL_TIME}s ./${TARGET_NAME} --gtest_output=xml:${report_dir}/${TARGET_NAME}.xml |
| 26 | COMMAND echo "Task number: ${TASK_NUM} timeout=${LLT_KILL_TIME}" |
| 27 | COMMENT "Run ops${TARGET_NAME} with task number ${TASK_NUM} ASAN(${ENABLE_ASAN})" |
| 28 | DEPENDS ${TARGET_NAME} |
| ... | @@ -19,4 +35,4 @@ function(run_llt_test) |
| 30 | if(RUN_LLT_TEST_TARGET AND RUN_LLT_TEST_TASK_NUM) |
| 31 | add_run_command(${RUN_LLT_TEST_TARGET} ${RUN_LLT_TEST_TASK_NUM}) |
| 32 | endif() |
| 33 | -endfunction() |
| 34 | \ No newline at end of file |
| 35 | +endfunction() |
| 36 |