# synopic-baseline **Repository Path**: xiao--hai/synopic-baseline ## Basic Information - **Project Name**: synopic-baseline - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2025-12-08 - **Last Updated**: 2025-12-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Synopic Baseline 昇腾部分算子的调用示例。 | 算子 | 路径 | 备注 | | :-: | :-: | :- | | All Gather Matmul | 00_allgather_matmul | 包括直接调用ATB中LCOC通算融合算子(LinearParallel)的示例,以及单独调用ATB中LCCL通信算子(AllGather)的示例 | | Matmul All Reduce | 01_matmul_allreduce | 包括直接调用ATB中LCOC通算融合算子(LinearParallel)的示例,以及单独调用ATB中LCCL通信算子(AllReduce)的示例 | | Matmul Reduce Scatter | 02_matmul_reducescatter | 包括直接调用ATB中LCOC通算融合算子(LinearParallel)的示例,以及单独调用ATB中LCCL通信算子(ReduceScatter)的示例 | | Grouped Matmul All to Allv | 03_grouped_matmul_alltoallv | 直接调用ATB中LCOC通算融合算子(LinearParallel)的示例,以及单独调用ATB中AllToAllVV2算子的示例 | ## 环境准备 - CANN: 8.2.RC1.alpha003 - 需要安装CANN中的toolkit、kernels、nnal三个包,具体安装方法见[官方文档](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/82RC1alpha002/index/index.html)。 - Open MPI - 用于简化多进程写法 ## 示例运行 ### 编译对应目标 应用CANN环境变量 ```shell source /your/cann/path/ascend-toolkit/set_env.sh source /your/cann/path/nnal/atb/set_env.sh --cxx_abi=0 ``` 编译对应目标 ```shell mkdir build cmake -B build -S . cmake --build build --target [target] ``` 这里可以使用help来查看所有可以选择的目标 ```shell cmake --build build --target help ``` ### 运行程序 对于通信算子,需要使用`mpirun`命令来启动多进程程序,以Matmul All Reduce为例: ```shell mpirun -np 2 ./build/bin/01_test_lcoc_matmul_allreduce ``` ## 性能测试 包含通信的算子建议使用msprof进行测试,通过重复多次执行算子,取warm up后的多次执行时间求平均作为性能指标。以Matmul All Reduce为例: ```shell mpirun -np 2 msprof --output=[prof_output_dir] ./build/bin/01_test_lcoc_matmul_allreduce [m] [n] [k] [repeat_times] ``` 例如: ```shell mpirun -np 2 msprof --output=./prof ./build/bin/01_test_lcoc_matmul_allreduce 1024 1024 1024 15 ``` 运行完成后,性能数据会生成在./prof路径下,通过查看mindstudio_profiler_output路径下的文件可以对性能进行分析。 此外,examples/scripts/test_prof.py脚本提供了完整的编译执行以及结果解析的示例,以供参考: ```shell python examples/scripts/test_prof.py [run_type] --rank_size=[rank_size] --problem_shape=[m,n,k] --warmup_times=[warmup_times] --execute_times=[execute_times] ``` 其中,`run_type` 为一个整型枚举值,每个值对应不同的kernel,对应关系如下: | 值 | kernel | | :-: | :-: | | 0 | 00_test_lcoc_allgather_matmul | | 1 | 01_test_lcoc_matmul_allreduce | | 2 | 02_test_lcoc_matmul_reducescatter | | 3 | 03_test_lcoc_grouped_matmul_alltoallv | | 4 | 00_test_lccl_allgather | | 5 | 01_test_lccl_allreduce | | 6 | 02_test_lccl_reducescatter | | 7 | 03_test_lccl_alltoallv | 例如: ```shell python examples/scripts/test_prof.py 1 --rank_size=2 --problem_shape=1024,1024,1024 --warmup_times=10 --execute_times=5 ```