README.md 2.59 KB
Newer Older
1
## 简介
facebook-github-bot's avatar
facebook-github-bot committed
2

3
**PyTorch3D** 是一个用于深度学习中处理**3D数据**的库。它提供了一系列功能,方便处理和操作三维数据,
facebook-github-bot's avatar
facebook-github-bot committed
4

5
## 环境依赖
facebook-github-bot's avatar
facebook-github-bot committed
6

7
环境以及版本依赖:
facebook-github-bot's avatar
facebook-github-bot committed
8

9
* Python 3.8,3.9 or 3.10
facebook-github-bot's avatar
facebook-github-bot committed
10

11
12
- dtk-23.10
- pytorch-2.1
facebook-github-bot's avatar
facebook-github-bot committed
13

14
## 安装
facebook-github-bot's avatar
facebook-github-bot committed
15

16
###  环境准备
facebook-github-bot's avatar
facebook-github-bot committed
17

18
*[开发者社区](https://developer.hpccube.com/tool/#sdk) DCU Toolkit 中下载 DTK-23.10 解压至 /opt/ 路径下,并建立软链接
facebook-github-bot's avatar
facebook-github-bot committed
19

20
21
22
  ```plaintext
  cd /opt && ln -s dtk-23.10 dtk
  ```
23

24
* 在光合[光合开发者社区](https://developer.hpccube.com/tool/#sdk) AI 生态包中获取对应的 pytorch Release 版本(需对应 DCU Toolkit 版本与 python 版本)
facebook-github-bot's avatar
facebook-github-bot committed
25

26
27
28
29
30
  ```shell
  wget https://cancon.hpccube.com:65024/directlink/4/pytorch/dtk23.10/torch-2.1.0a0+git793d2b5.abi0.dtk2310-cp38-cp38-manylinux2014_x86_64.whl
  
  python3 -m pip install torch-2.1xxxx.whl
  ```
facebook-github-bot's avatar
facebook-github-bot committed
31

32
* 导入环境变量以及安装必要依赖库
facebook-github-bot's avatar
facebook-github-bot committed
33

34
35
36
37
38
  ```shell
  source /opt/dtk/env.sh
  
  pip3 install wheel -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
  ```
facebook-github-bot's avatar
facebook-github-bot committed
39

40
### pip安装
facebook-github-bot's avatar
facebook-github-bot committed
41

42
可以在光合[光合开发者社区](https://developer.hpccube.com/tool/#sdk) AI 生态包中获取最新的  `pytorch3d` Release 版本.
facebook-github-bot's avatar
facebook-github-bot committed
43

44
45
46
```shell
wget http://10.6.10.68:8000/customized/pytorch3d/23.10/pytorch3d-0.7.6-cp38-cp38-linux_x86_64.whl
python -m pip install pytorch3d-0.7.6-cp38-cp38-linux_x86_64.whl.whl
facebook-github-bot's avatar
facebook-github-bot committed
47
```
Nikhila Ravi's avatar
Nikhila Ravi committed
48

49

Jeremy Reizenstein's avatar
Jeremy Reizenstein committed
50

51
### 编译安装
Jeremy Reizenstein's avatar
Jeremy Reizenstein committed
52

53
* 拉取代码
Jeremy Reizenstein's avatar
Jeremy Reizenstein committed
54

55
56
57
  ```shell
  git clone http://developer.hpccube.com/codes/aicomponent/pytorch3d.git
  ```
Jeremy Reizenstein's avatar
Jeremy Reizenstein committed
58

59
* 若使用 `GPU` 支持,需要设置环境变量`FORCE_CUDA`为1
Jeremy Reizenstein's avatar
Jeremy Reizenstein committed
60

61
62
63
  ```shell
  export FORCE_CUDA=1
  ```
Christoph Lassner's avatar
Christoph Lassner committed
64

65
- 执行编译命令
Nikhila Ravi's avatar
Nikhila Ravi committed
66

67
68
69
70
  ```shell
  cd path/to/pytorch3d
  pip install -e .
  ```
71

72
* 当编译出现错误时,参考以下说明:
73

74
  * 报错提示缺少 `intel-mkl` 相关库,应安装 `intel-mkl`
Nikhila Ravi's avatar
Nikhila Ravi committed
75

76
77
78
79
80
81
82
    ```shell
    yum-config-manager --add-repo https://yum.repos.intel.com/mkl/setup/intel-mkl.repo
    
    yum install intel-mkl-2020.0-088 -y --nogpgchec
    # 将库路径添加到环境变量中
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/mkl/lib/intel64
    ```
Nikhila Ravi's avatar
Nikhila Ravi committed
83

84
  * 缺少 `magma`时,安装对应库
Nikhila Ravi's avatar
Nikhila Ravi committed
85

86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
    ```shell
    # 默认dtk安装路径为 /opt/dtk
    cd /opt/dtk
    
    wget http://10.6.10.68:8000/debug/pytorch/third_party/magma_v2.7.2-hip_nfs3.2_DTK23.10_intel-2020.1.217_07Oct2023.tar.gz
    
    tar -zxf magma_v2.7.2-hip_nfs3.2_DTK23.10_intel-2020.1.217_07Oct2023.tar.gz
    
    mv magma_v2.7.2-hip_nfs3.2_DTK23.10_intel-2020.1.217_07Oct2023 magma
    
    cd magma/lib/
    
    # 添加环境变量
    export LD_LIBRARY_PATH=${ROCM_PATH}/magma/lib:$LD_LIBRARY_PATH
    ```