MCPcopy Create free account
hub / github.com/Cambricon/mlu-ops

github.com/Cambricon/mlu-ops @v1.9.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.9.1 ↗ · + Follow
5,489 symbols 12,101 edges 693 files 840 documented · 15% updated 6d agov1.8.1 · 2026-01-06★ 1756 open issues

Browse by type

Functions 4,409 Types & classes 1,080
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

📖 MLU-OPS™用户手册      🌏 寒武纪开发者社区      🛠️ 依赖组件获取

 

ci license python system

  • 如需获取寒武纪SDK或容器镜像等软件资源,请联系官方售后支持团队。

简介

MLU-OPS™提供基于寒武纪人工智能单元(MLU),使用 C 接口开发高性能算子的示例代码。 MLU-OPS™旨在通过提供示例代码,供开发者参考使用,可用于开发自定义算子,实现对应模型的计算。

MLU-OPS™提供了以下功能: - 算子精度标准 - 算子性能标准 - Op List (高质量实现 BANG C 算子) - CNNL基础算子使用 - 测试模块 GTest 支持 内存泄露测试代码覆盖率测试 - Gen-case (运行时测例生成工具) - Perf-Analyse (算子性能分析工具)

依赖条件

  • 操作系统:
  • 支持 x86_64 架构下的 Ubuntu22.04、Centos7.6、Centos8.5、Kylin10、Debian10、Debian12。
  • MLU-OPS™ v1.0.0版本后将不再支持 Ubuntu18.04。
  • MLU-OPS™ v1.4.1版本后将不再支持 Ubuntu20.04。
  • 寒武纪 MLU SDK:
  • 编译和运行时依赖 CNToolkit v4.1.0 或更高版本,CNNL v1.28.0 或者更高版本
  • 寒武纪 MLU 驱动:
  • 运行时依赖驱动 v6.0.3 或更高版本
  • 外部链接库:
  • libxml2-dev、libprotobuf-dev、protobuf-compiler、llvm-6.0-dev、libfmt-dev>=11.0.2、libeigen3-dev>=3.4
  • Python环境:
  • 依赖Python-3版本(默认版本 python 3.8.0,最低要求 python 3.6.0)

依赖环境准备

  • 获取 MLU-OPS™ 代码

以Ubuntu22.04版本为例

sh git clone https://github.com/Cambricon/mlu-ops.git cd mlu-ops git submodule update --init --recursive

  • 准备 CNToolkit、CNNL 环境

sh wget https://sdk.cambricon.com/static/Basis/MLU370_X86_ubuntu22.04/cntoolkit_x.x.x-x.ubuntu22.04_amd64.deb wget https://sdk.cambricon.com/static/Basis/MLU370_X86_ubuntu22.04/cnnl_x.x.x-x.ubuntu22.04_amd64.deb sudo apt-get install ./cntoolkit-x.x.x-x.ubuntu22.04_amd64.deb sudo apt-get update sudo apt-get install cncc cnas cnbin cndrv cndev cnrt cnrtc cngdb cnperf sudo apt-get install ./cnnl_x.x.x-x.ubuntu22.04_amd64.deb

  • 准备 Python-3.8.0 环境

```sh wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz tar -xvf Python-3.8.0.tgz cd Python-3.8.0 make -j24 && make install

  • 准备链接库环境
  • apt-get安装依赖库

sh sudo apt-get update sudo apt-get install protobuf-compiler libxml2-dev libprotobuf-dev llvm-6.0-dev - 源码编译fmtlib sh git clone --branch 11.0.2 https://github.com/fmtlib/fmt.git --depth=1 cd fmt mkdir build && cd build cmake .. make -j32 make install # 验证是否安装成功 pkg-config --modversion fmt # 若输出 11.0.2,表示fmt安装成功

获取关于 BANG 语言基础和开发相关工具介绍的文档

可查看最新版 开发者文档 - BANG C/C++ 编程指南 - BANG C Developer Guide - CNNL Developer Guide - MLU 架构调优指南 - CNRT Developer Guide - CNRTC Developer Guide - CNDrv Developer Guide - CNGDB Developer Guide - Libdevice Developer Guide

目录文件结构

目录/文件 描述
cmake 存放编译相关的 make 文件。
core 存放公共数据类型的操作、运行时管理、日志等公共实现。
docker 存放 docker 打包脚本,提供 CI 构建环境。
docs 存放算子开发、测试、精度验收等说明文档。
kernels 算子代码实现,包含一元、二元算子模板供其他算子调用。
test 存放测试算子用的代码。
mlu_op.h 公共数据类型描述,以及 kernels 目录中的算子对外提供的 C 接口。

编译、开发与测试

提供基于 BANG C 的算子开发教程,涵盖算子入门、算子进阶、算子高级篇,帮助开发者迅速上手算子开发。 具体见 BANG C 算子开发指南

提供基于寒武纪人工智能单元(MLU)开发高性能算子、C 接口封装的示例代码。 MLU-OPS™ 具体的编译、开发与测试介绍见 MLU-OPS™算子编译、开发与测试介绍

更多内容见 docs 目录下文档。

Core symbols most depended-on inside this repo

Shape

Method 2,724
Function 1,685
Class 1,039
Enum 41

Languages

C++95%
Python5%

Modules by API surface

test/mlu_op_gtest/googletest/src/gtest.cc283 symbols
test/mlu_op_gtest/googletest/include/gtest/internal/gtest-param-util-generated.h253 symbols
test/mlu_op_gtest/googletest/include/gtest/internal/gtest-type-util.h214 symbols
test/mlu_op_gtest/pb_gtest/src/gtest/extra_lib/jsoncppDist/jsoncpp.cpp200 symbols
test/mlu_op_gtest/googletest/include/gtest/internal/gtest-port.h155 symbols
test/mlu_op_gtest/pb_gtest/src/executor.cpp104 symbols
test/mlu_op_gtest/googletest/include/gtest/gtest.h103 symbols
test/mlu_op_gtest/pb_gtest/include/executor.h86 symbols
test/mlu_op_gtest/googletest/include/gtest/internal/gtest-internal.h85 symbols
test/mlu_op_gtest/googletest/include/gtest/internal/gtest-tuple.h82 symbols
test/mlu_op_gtest/googletest/src/gtest-port.cc78 symbols
test/mlu_op_gtest/googletest/include/gtest/internal/gtest-param-util.h75 symbols

Datastores touched

(mysql)Database · 1 repos
rainbowDatabase · 1 repos
training_solutionDatabase · 1 repos

For agents

$ claude mcp add mlu-ops \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page