README.md 3.31 KB
Newer Older
xiabo's avatar
xiabo committed
1
# <div align="center"><strong>MMCV</strong></div>
xiabo's avatar
xiabo committed
2
## 简介
limm's avatar
limm committed
3
MMCV是计算机视觉研究的基础库,主要提供以下功能:图像处理、图像和标注结果可视化、图像转换、多种CNN网络结构、高质量实现的常见CUDA算子。DAS软件栈中的MMCV版本,不仅保证了组件核心功能在DCU加速卡的可用性,还针对DCU特有的硬件架构进行了深度定制优化。这使得开发者能够以极低的成本,轻松实现应用程序在DCU加速卡上的快速迁移和性能提升。
xiabo's avatar
xiabo committed
4
5

## 安装
limm's avatar
limm committed
6
7
8
9
10
11
12
13
14
15
组件支持组合

   | PyTorch版本 | MMCV版本    | DTK版本                  | Python版本           | 推荐编译方式 |
   | ----------- | ----------- | ------------------------ | -------------------- | ------------ |
   | 2.4.1       | 2.2.0       | 25.04_rc4                | 3.7、3.8、3.9、3.10  | fastpt不转码 |
   | 2.4.1       | 2.2.0       | 24.04.1                  | 3.7、3.8、3.9、3.10  | hip转码      |
   | 2.1.0       | 2.2.0       | 25.04_rc4                | 3.7、3.8、3.9、3.10  | hip转码      |
   | 2.1.0       | 2.2.0       | 24.04.1                  | 3.7、3.8、3.9、3.10  | hip转码      |

+ pytorch版本大于2.4.1 && dtk版本大于25.04 推荐使用fastpt不转码编译。
xiabo's avatar
xiabo committed
16

dcuai's avatar
dcuai committed
17
### 1、使用pip方式安装
limm's avatar
limm committed
18
mmcv whl包下载目录:[http://10.6.10.68:8000/debug/mmcv/dtk-24.04.1/](http://10.6.10.68:8000/debug/mmcv/dtk-24.04.1/),选择对应的pytorch版本和python版本下载对应mmcv的whl包
xiabo's avatar
xiabo committed
19
20
```shell
pip install mmcv* (下载的mmcv的whl包)
21
```
dcuai's avatar
dcuai committed
22
### 2、使用源码编译方式安装
23

xiabo's avatar
xiabo committed
24
#### 编译环境准备
limm's avatar
limm committed
25
提供基于fastpt不转码编译:
xiabo's avatar
xiabo committed
26

27
1. 基于光源pytorch基础镜像环境:镜像下载地址:[光合开发者社区](https://sourcefind.cn/#/image/dcu/pytorch),根据pytorch、python、dtk及系统下载对应的镜像版本。
xiabo's avatar
xiabo committed
28

29
2. 基于现有python环境:安装pytorch,fastpt whl包下载目录:[http://10.16.4.1:8000/debug/pytorch/dtk25.04/](http://10.16.4.1:8000/debug/pytorch/dtk25.04/),根据python、dtk版本,下载对应pytorch的whl包。安装命令如下:
xiabo's avatar
xiabo committed
30
31
```shell
pip install torch* (下载的torch的whl包)
limm's avatar
limm committed
32
pip install fastpt* (下载的fastpt的whl包, 安装顺序, 先安装torch,后安装fastpt)
xiabo's avatar
xiabo committed
33
pip install setuptools==59.5.0 wheel
Zaida Zhou's avatar
Zaida Zhou committed
34
35
```

xiabo's avatar
xiabo committed
36
37
#### 源码编译安装
- 代码下载
xiabo's avatar
xiabo committed
38
```shell
xiabo's avatar
xiabo committed
39
git clone https://developer.hpccube.com/codes/aicomponent/mmcv # 根据编译需要切换分支
xiabo's avatar
xiabo committed
40
```
huchen's avatar
huchen committed
41
- 提供2种源码编译方式(进入mmcv目录):
xiabo's avatar
xiabo committed
42
```
limm's avatar
limm committed
43
1. 设置不转码编译环境变量
44
45
export FORCE_CUDA=1
source /usr/local/bin/fastpt -C
limm's avatar
limm committed
46
47

2. 编译whl包并安装
limm's avatar
limm committed
48
MMCV_WITH_OPS=1 python3 setup.py -v bdist_wheel
xiabo's avatar
xiabo committed
49
pip install dist/mmcv*
xiabo's avatar
xiabo committed
50

limm's avatar
limm committed
51
3. 源码编译安装
limm's avatar
limm committed
52
MMCV_WITH_OPS=1 python3 setup.py install
Zaida Zhou's avatar
Zaida Zhou committed
53
```
dcuai's avatar
dcuai committed
54
#### 注意事项
dcuai's avatar
dcuai committed
55
56
+ 若使用pip install下载安装过慢,可添加pypi清华源:-i https://pypi.tuna.tsinghua.edu.cn/simple/
+ ROCM_PATH为dtk的路径,默认为/opt/dtk
57
+ 在pytorch2.5.1环境下编译需要支持c++17语法,打开setup.py文件,把文件中的 -std=c++14 修改为 -std=c++17
xiabo's avatar
xiabo committed
58

dcuai's avatar
dcuai committed
59
## 验证
limm's avatar
limm committed
60
- python -c "import mmcv; mmcv.\_\_version__",版本号与官方版本同步,查询该软件的版本号,例如2.1.0;
Zaida Zhou's avatar
Zaida Zhou committed
61

huchen's avatar
huchen committed
62
63
## Known Issue
-
xiabo's avatar
xiabo committed
64

dcuai's avatar
dcuai committed
65
## 参考资料
xiabo's avatar
xiabo committed
66
- [README_ORIGIN](README_ORIGIN.md)
huchen's avatar
huchen committed
67
- [README_zh-CN](README_zh-CN.md)
dcuai's avatar
dcuai committed
68
- [https://github.com/open-mmlab/mmcv](https://github.com/open-mmlab/mmcv)