Skip to content
/ mlu-ops Public
forked from Cambricon/mlu-ops

Efficient operation implementation based on the Cambricon Machine Learning Unit (MLU) .

License

Notifications You must be signed in to change notification settings

chqy99/mlu-ops

This branch is 6 commits behind Cambricon/mlu-ops:master.

Folders and files

NameName
Last commit message
Last commit date
Mar 6, 2025
Mar 28, 2024
Mar 7, 2025
Jan 9, 2024
Mar 7, 2025
Mar 4, 2025
Mar 24, 2025
Dec 23, 2024
Feb 10, 2025
Mar 17, 2025
Feb 20, 2025
Aug 15, 2023
Jan 17, 2025
Jan 9, 2024
Dec 18, 2024
Jan 22, 2024
Nov 22, 2022
Aug 5, 2022
Feb 5, 2025
Jan 17, 2025
Jan 23, 2025
Mar 26, 2025
Jan 9, 2024
Jan 9, 2024
Jan 9, 2024
Jan 9, 2024
Mar 6, 2025
Sep 27, 2024
Mar 7, 2025
Sep 21, 2022
Jan 15, 2024
Jan 9, 2024
Sep 25, 2024

Repository files navigation

  • 为了提供更好的开发体验,我们为您提供包含寒武纪完整软件栈的容器镜像,帮助您跳过环境部署环节
  • 如需获取该容器镜像,可提 ISSUE 留下您的联系方式

简介

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

MLU-OPS™提供了以下功能:

依赖条件

  • 操作系统:
    • 支持 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.0.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版本为例

git clone https://github.com/Cambricon/mlu-ops.git
cd mlu-ops
git submodule update --init --recursive
  • 准备 CNToolkit、CNNL 环境

    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 环境

    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安装依赖库
    sudo apt-get update
    sudo apt-get install protobuf-compiler libxml2-dev libprotobuf-dev llvm-6.0-dev
    • 源码编译fmtlib
    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 语言基础和开发相关工具介绍的文档

可查看最新版 开发者文档

目录文件结构

目录/文件 描述
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 目录下文档。

About

Efficient operation implementation based on the Cambricon Machine Learning Unit (MLU) .

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 88.5%
  • C 7.8%
  • Python 3.0%
  • Shell 0.4%
  • CMake 0.3%
  • Smarty 0.0%