README.md 2.65 KB
Newer Older
zhanggezhong's avatar
zhanggezhong committed
1
--------------------------------------------------------------------------------
zachteed's avatar
zachteed committed
2

zhanggezhong's avatar
zhanggezhong committed
3
## Lietorch简介
zachteed's avatar
zachteed committed
4

zhanggezhong's avatar
zhanggezhong committed
5
LieTorch 库将 PyTorch 扩展应用于三维变换群。就像 torch.Tensor 是一个由标量元素构成的多维矩阵一样,lietorch.SE3 是一个由 SE3 元素构成的多维矩阵。我们支持常见的张量操作,如索引、重塑和广播。群操作可以组合到计算图中,并且会在每个元素的切空间中自动进行反向传播
zachteed's avatar
zachteed committed
6

zhanggezhong's avatar
zhanggezhong committed
7
## 版本约束
zachteed's avatar
zachteed committed
8

zhanggezhong's avatar
zhanggezhong committed
9
1. 暂不支持的官方版本或功能
zachteed's avatar
zachteed committed
10

zhanggezhong's avatar
zhanggezhong committed
11
   **更高版本**:暂不支持lietorch0.2以上版本
zachteed's avatar
zachteed committed
12

zhanggezhong's avatar
zhanggezhong committed
13
2. lietorch软件版本配套关系
Jia Deng's avatar
Jia Deng committed
14

zhanggezhong's avatar
zhanggezhong committed
15
16
17
18
19
   | lietorch版本 | DCU适配版lietorch软件包版本                 | DCU加速卡型号              | DTK版本 |
   | ----------- | ------------------------------------------ | -------------------------- | ------- |
   | o.2       | 0.2+das.dtk24042                         | Z100、Z100L、K100、K100_AI | 24.04.2 |
   
## 前置条件
Jia Deng's avatar
Jia Deng committed
20

zhanggezhong's avatar
zhanggezhong committed
21
使用 DAS PyTorch需要参考[《DCU新手入门教程》](https://developer.hpccube.com/gitbook/dcu_tutorial/index.html)在主机系统安装以下组件:
zachteed's avatar
zachteed committed
22

zhanggezhong's avatar
zhanggezhong committed
23
24
25
- DCU驱动程序
- DTK
- Docker引擎
zachteed's avatar
zachteed committed
26

zhanggezhong's avatar
zhanggezhong committed
27
28
29
## 安装
组件支持
+ Python 3.7、3.8、3.9、3.10
zachteed's avatar
zachteed committed
30

zhanggezhong's avatar
zhanggezhong committed
31
32
33
34
35
36
### 使用源码编译方式安装
基于光源pytorch基础镜像环境:镜像下载地址:[https://sourcefind.cn/#/image/dcu/pytorch](https://sourcefind.cn/#/image/dcu/pytorch),根据pytorch、python、dtk及系统下载对应的镜像版本。
#### 源码编译安装
- 代码下载
```shell
git clonehttps://developer.sourcefind.cn/codes/OpenDAS/lietorch.git # 根据编译需要切换分支
zachteed's avatar
zachteed committed
37
```
zhanggezhong's avatar
zhanggezhong committed
38
- 提供2种源码编译方式:
zhanggezhong's avatar
zhanggezhong committed
39
40
41
42
43
  
```
1. 编译whl包并安装
pip3 install wheel 
pip3 install pytest  
zachteed's avatar
zachteed committed
44
cd lietorch
zhanggezhong's avatar
zhanggezhong committed
45
46
47
python3 setup.py bdist_wheel
cd dist  
pip3 install lietorch-* --no-deps  --force
zachteed's avatar
zachteed committed
48
49
```

zhanggezhong's avatar
zhanggezhong committed
50
## 验证
zachteed's avatar
zachteed committed
51

zhanggezhong's avatar
zhanggezhong committed
52
验证安装:__dcu_version__会返回对应版本的dtk版本号
zachteed's avatar
zachteed committed
53
54

```
zhanggezhong's avatar
zhanggezhong committed
55
56
57
58
59
60
61
62
63
python3
Python 3.10.12 (main, May 26 2024, 00:14:02) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lietorch
>>> lietorch.__version__
'0.2'
>>> lietorch.__dcu_version__
'0.2+das.dtk2404'
>>>
64
65
```

zhanggezhong's avatar
zhanggezhong committed
66
## 单测
67

zachteed's avatar
zachteed committed
68
```
zhanggezhong's avatar
zhanggezhong committed
69
sh run_tests.sh
70
71
```

fengzch-das's avatar
fengzch-das committed
72
73
74
## 注意
针对 eigen 需要做下面几处修改:
+ lietorch/eigen/Eigen/src/Core/arch/Default/Half.h:669 行将 ``return half(::hlog(a)); 修改为 return half(::hlog(float(a)));``
fengzch-das's avatar
fengzch-das committed
75
76
+ lietorch/eigen/Eigen/src/Core/arch/Default/Half.h:776 行将 ``return x + (y-x) * half(float(std::rand()) / float(RAND_MAX));`` 修改为 ``return half(x + (y-x) * half(float(std::rand()) / float(RAND_MAX)));``
+ lietorch/eigen/Eigen/src/Core/MathFunctions.h:578 行将 ``EIGEN_USING_STD(arg);`` 修改为 ``using std::arg;``