Commit 70f4c494 authored by limm's avatar limm
Browse files

update README.md

parent c21cd909
...@@ -3,48 +3,80 @@ ...@@ -3,48 +3,80 @@
PyTorch Scatter由一个小型扩展库组成,专为PyTorch设计,提供了一系列高度优化的稀疏更新(scatter和segment)操作,这些操作在主包中是缺失的。Scatter和segment操作可以大致描述为基于给定“组索引”张量的归约操作。Segment操作要求“组索引”张量是有序的,而scatter操作则不受此要求限制。DAS软件栈中的PyTorch Scatter版本,不仅保证了该组件 核心功能在DCU加速卡的可用性,还针对DCU特有的硬件架构进行了深度定制优化,这使得开发者能够以极低的成本,轻松实现应用程序在DCU加速卡上的快速迁移和性能提升。目前已适配支持Pytorch1.13,Pyotrch2.1,Pytorch2.4.1. Pytorch2.5.1 PyTorch Scatter由一个小型扩展库组成,专为PyTorch设计,提供了一系列高度优化的稀疏更新(scatter和segment)操作,这些操作在主包中是缺失的。Scatter和segment操作可以大致描述为基于给定“组索引”张量的归约操作。Segment操作要求“组索引”张量是有序的,而scatter操作则不受此要求限制。DAS软件栈中的PyTorch Scatter版本,不仅保证了该组件 核心功能在DCU加速卡的可用性,还针对DCU特有的硬件架构进行了深度定制优化,这使得开发者能够以极低的成本,轻松实现应用程序在DCU加速卡上的快速迁移和性能提升。目前已适配支持Pytorch1.13,Pyotrch2.1,Pytorch2.4.1. Pytorch2.5.1
## 安装 ## 安装
组件支持组合
### 使用pip方式安装 | PyTorch版本 | fastpt版本 |pytorch_Scatter版本 | DTK版本 | Python版本 | 推荐编译方式 |
pytorch-scatter whl包下载目录:[光合开发者社区](https://das.sourcefind.cn:55011/portal/#/home) | ----------- | ----------- | -------------------- | ------------ | ---------------- | ------------ |
```shell | 2.5.1 | 2.1.0 |2.1.0 | >= 25.04 | 3.8、3.10、3.11 | fastpt不转码 |
pip install torch_scatter* (下载的torch_scatter的whl包) | 2.4.1 | 2.0.1 |2.1.0 | >= 25.04 | 3.8、3.10、3.11 | fastpt不转码 |
``` | 其他 | 其他 | 其他 | 其他 | 3.8、3.10、3.11 | hip转码 |
### 使用源码编译方式安装
+ pytorch版本大于2.4.1 && dtk版本大于25.04 推荐使用fastpt不转码编译。
#### 编译环境准备
- 安装相关依赖 - 安装相关依赖
```shell ```shell
pip install 'urllib3==1.26.14'
pip install pytest
pip install wheel
pip install -r requirements.txt pip install -r requirements.txt
``` ```
- 在首页 | 光合开发者社区下载 dtk25.04 解压至 /opt/ 路径下,并建立软链接
```shell
cd /opt && ln -s dtk-25.04 dtk
``` ### 使用pip方式安装
- 安装pytorch,pytorch whl包下载目录:[光合开发者社区](https://das.sourcefind.cn:55011/portal/#/home),根据python、dtk版本,下载对应pytorch的whl包。安装命令如下: pytorch-scatter whl包下载目录:[光合开发者社区](https://download.sourcefind.cn:65024/4/main/torch_scatter),选择对应的pytorch版本和python版本下载对应torch_cluster的whl包
```shell ```shell
pip install torch* (下载的torch的whl包) pip install torch* (下载torch的whl包)
pip install fastpt* --no-deps (下载fastpt的whl包)
source /usr/local/bin/fastpt -E
pip install torch_scatter* (下载的torch_scatter的whl包)
``` ```
- 安装fastpt,fastpt whl包下载目录:[光合开发者社区](https://das.sourcefind.cn:55011/portal/#/home),根据fastpt、dtk版本,下载对应fastpt的whl包。安装命令如下: ### 使用源码编译方式安装
#### 编译环境准备
提供基于fastpt不转码编译:
1. 基于光源pytorch基础镜像环境:镜像下载地址:[光合开发者社区](https://sourcefind.cn/#/image/dcu/pytorch),根据pytorch、python、dtk及系统下载对应的镜像版本。
2. 基于现有python环境:安装pytorch,fastpt whl包下载目录:[光合开发者社区](https://sourcefind.cn/#/image/dcu/pytorch),根据python、dtk版本,下载对应pytorch的whl包。安装命令如下:
```shell ```shell
pip install fastpt* (下载的fastpt的whl包) pip install torch* (下载torch的whl包)
pip install fastpt* --no-deps (下载fastpt的whl包, 安装顺序,先安装torch,后安装fastpt)
``` ```
#### 源码编译安装 #### 源码编译安装
```shell ```shell
git clone -b 2.1.0-fastpt http://developer.hpccube.com/codes/aicomponent/torch-scatter.git git clone http://developer.sourcefind.cn/codes/OpenDAS/torch-scatter.git
```
- 提供2种源码编译方式(进入torch-cluster目录):
1. 设置不转码编译环境变量
```shell
export FORCE_CUDA=1 export FORCE_CUDA=1
source /usr/local/bin/fastpt -C source /usr/local/bin/fastpt -C
```
2. 编译whl包并安装
```shell
cd torch-scatter cd torch-scatter
python setup.py bdist_wheel python setup.py bdist_wheel
pip install dist/*.whl pip install dist/*.whl
``` ```
3. 源码编译安装
```shell
python3 setup.py install
```
#### 注意事项
+ 若使用pip install下载安装过慢,可添加pypi清华源:-i https://pypi.tuna.tsinghua.edu.cn/simple/
+ ROCM_PATH为dtk的路径,默认为/opt/dtk
## 验证
python -c "import torch_scatter; torch_scatter.\_\_version__",版本号与官方版本同步,查询该软件的版本号,例如2.1.0
## 单测 ## 单测
```shell ```shell
cd torch-scatter cd torch-scatter
pytest pytest
``` ```
## Known Issue ## Known Issue
完成安装进行单测时,会报错ImportError: Could not find module '_version_cpu' ~,在根目录/下查找一下,然后把库文件目录添加一下软链接即可。 完成安装进行单测时,会报错ImportError: Could not find module '_version_cpu' ~,在根目录/下查找一下,然后把库文件目录添加一下软链接即可。
...@@ -55,5 +87,5 @@ ln -s /usr/local/lib/python3.8/site-packages/torch-scatter/* . ...@@ -55,5 +87,5 @@ ln -s /usr/local/lib/python3.8/site-packages/torch-scatter/* .
``` ```
## 参考资料 ## 参考资料
[README_ORIGIN.md](README_ORIGIN.md)
[https://github.com/rusty1s/pytorch_scatter](https://github.com/rusty1s/pytorch_scatter) [https://github.com/rusty1s/pytorch_scatter](https://github.com/rusty1s/pytorch_scatter)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment