Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jerrrrry
infinicore
Commits
27ba98d1
Commit
27ba98d1
authored
Feb 17, 2025
by
YdrMaster
Browse files
issue/52: 修改 README.md,添加格式化脚本使用说明
Signed-off-by:
YdrMaster
<
ydrml@hotmail.com
>
parent
e9b6de3a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
31 deletions
+80
-31
README.md
README.md
+80
-31
No files found.
README.md
View file @
27ba98d1
# InfiniCore
# InfiniCore
InfiniCore是一个跨平台统一编程工具集,为不同芯片平台的功能(包括计算、运行时、通信等)提供统一 C 语言接口。目前支持的
芯片包括CPU、英伟达GPU、华为昇腾NPU、寒武纪MLU、摩尔线程GPU、天数智芯GPU、沐曦GPU、曙光DCU、昆仑芯。
InfiniCore
是一个跨平台统一编程工具集,为不同芯片平台的功能(包括计算、运行时、通信等)提供统一 C 语言接口。目前支持的
硬件和后端包括:
## 一、使用说明
-
CPU;
-
CUDA
-
英伟达 GPU;
-
摩尔线程 GPU;
-
天数智芯 GPU;
-
沐曦 GPU;
-
曙光 DCU;
-
华为昇腾 NPU;
-
寒武纪 MLU;
-
昆仑芯 XPU;
##
# 1.
配置
## 配置
和使用
#### 查看当前
配置
1.
项目
配置
```
xmake
-
查看当前配置
xmake f -v
```
#### 配置 CPU (默认配置)
```shell
xmake f -v
```
```
xmake
-
配置 CPU(默认配置)
xmake f -cv
```
#### 配置加速卡
```shell
xmake f -cv
```
```
xmake
-
配置加速卡
# 英伟达
# 可以指定 CUDA 路径, 一般环境变量为 `CUDA_HOME` 或者 `CUDA_ROOT`
xmake f --nv-gpu=true --cuda=$CUDA_HOME -cv
# 寒武纪
```shell
xmake f --cambricon-mlu=true -cv
# 英伟达
# 可以指定 CUDA 路径, 一般环境变量为 `CUDA_HOME` 或者 `CUDA_ROOT`
xmake f --nv-gpu=true --cuda=$CUDA_HOME -cv
# 华为昇腾
# 寒武纪
xmake f --ascend-npu=true -cv
xmake f --cambricon-mlu=true -cv
```
### 2. 编译安装
# 华为昇腾
xmake f --ascend-npu=true -cv
```
```
xmake
2.
编译安装
xmake build && xmake install
# 默认安装路径为 $HOME/.infini
默认安装路径为
`$HOME/.infini`
。
```
```
shell
xmake build
&&
xmake
install
```
3.
设置环境变量
按输出提示设置
`INFINI_ROOT`
和
`LD_LIBRARY_PATH`
环境变量。
4.
运行算子测试
### 3. 设置环境变量
```
shell
python
test
/infiniop/[operator].py
[
--cpu
|
--nvidia
|
--cambricon
|
--ascend
]
```
按输出提示设置
`INFINI_ROOT`
和
`LD_LIBRARY_PATH`
环境变量。
## 开发指南
###
4. 运行算子测试
###
代码格式化
```
bash
本项目使用
[
`scripts/format.py`
](
/scripts/format.py
)
脚本实现代码格式化检查和操作。
python
test
/infiniop/[operator].py
[
--cpu
|
--nvidia
|
--cambricon
|
--ascend
]
使用
```
shell
python scripts/format.py
-h
```
查看脚本帮助信息:
```
plaintext
usage: format.py [-h] [--ref REF] [--path [PATH ...]] [--check] [--c C] [--py PY]
options:
-h, --help show this help message and exit
--ref REF Git reference (commit hash) to compare against.
--path [PATH ...] Files to format or check.
--check Check files without modifying them.
--c C C formatter (default: clang-format-16)
--py PY Python formatter (default: black)
```
```
参数中:
-
`ref`
和
`path`
控制格式化的文件范围
-
若
`ref`
和
`path`
都为空,格式化当前暂存(git added)的文件;
-
否则
-
若
`ref`
非空,将比较指定 commit 和当前代码的差异,只格式化修改过的文件;
-
若
`path`
非空,可传入多个路径(
`--path p0 p1 p2`
),只格式化指定路径及其子目录中的文件;
-
若设置
`--check`
,将检查代码是否需要修改格式,不修改文件内容;
-
通过
`--c`
指定 c/c++ 格式化器,默认为
`clang-format-16`
;
-
通过
`--python`
指定 python 格式化器
`black`
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment