README.md 1.38 KB
Newer Older
lishen's avatar
lishen committed
1
# DLIB
lishen's avatar
lishen committed
2

lishen's avatar
lishen committed
3
## 环境配置
lishen's avatar
lishen committed
4

lishen's avatar
lishen committed
5
6
使用DCU编译之前,需要准备编译环境。参考
[environment prepare](environment_prepare.md)
lishen's avatar
lishen committed
7

lishen's avatar
lishen committed
8
## 使用源码安装
lishen's avatar
lishen committed
9

lishen's avatar
lishen committed
10
### 编译环境准备(以dtk-23.04版本为例)
lishen's avatar
lishen committed
11

lishen's avatar
lishen committed
12
- 拉取代码
lishen's avatar
lishen committed
13

lishen's avatar
lishen committed
14
15
16
17
  ```
  git clone -b develop http://developer.hpccube.com/codes/aicomponent/dlib.git
  ```
-[开发者社区](https://developer.hpccube.com/tool/#sdk) DCU Toolkit 中下载 DTK-23.04 解压至 /opt/ 路径下,并建立软链接
lishen's avatar
lishen committed
18

lishen's avatar
lishen committed
19
20
21
  ```
  cd /opt && ln -s dtk-23.04 dtk
  ```
lishen's avatar
lishen committed
22

lishen's avatar
lishen committed
23
- 导入环境变量以及安装必要依赖库
lishen's avatar
lishen committed
24

lishen's avatar
lishen committed
25
26
27
  ```shell
  source /opt/dtk/env.sh
  ```
lishen's avatar
lishen committed
28

lishen's avatar
lishen committed
29
### 编译安装
lishen's avatar
lishen committed
30

lishen's avatar
lishen committed
31
#### 使用cmake编译
lishen's avatar
lishen committed
32
33

```shell
lishen's avatar
lishen committed
34
35
mkdir build; cd build; 
cmake .. -DCMAKE_CXX_COMPILER=/opt/dtk/bin/hipcc
lishen's avatar
lishen committed
36

lishen's avatar
lishen committed
37
cmake --build . -j16 #--verbose
lishen's avatar
lishen committed
38
39
```

lishen's avatar
lishen committed
40
#### 单元测试
lishen's avatar
lishen committed
41

lishen's avatar
lishen committed
42
Running the unit test suite.
lishen's avatar
lishen committed
43
44
Type the following to compile and run the dlib unit test suite:

lishen's avatar
lishen committed
45
46
- 编译单元测试

lishen's avatar
lishen committed
47
48
49
50
51
52
```shell
cd dlib/test
mkdir build
cd build

cmake .. -DCMAKE_CXX_COMPILER=/opt/dtk/bin/hipcc
lishen's avatar
lishen committed
53
54
55
56
cmake --build . -j16 --config Release #--verbose
```

- 进行单元测试
lishen's avatar
lishen committed
57

lishen's avatar
lishen committed
58
59
60
```shell
./dtest --runall    # 全部测试
./dtest -d --test_rocblas    # 测试单个测试单元
lishen's avatar
lishen committed
61
62
```

lishen's avatar
lishen committed
63
#### 编译 dlib Python API
lishen's avatar
lishen committed
64

lishen's avatar
lishen committed
65
- 使用python安装
lishen's avatar
lishen committed
66

lishen's avatar
lishen committed
67
68
69
```shell
python setup.py install --set CMAKE_CXX_COMPILER=/opt/dtk/bin/hipcc
```
lishen's avatar
lishen committed
70

lishen's avatar
lishen committed
71
- 使用python编译whl包
lishen's avatar
lishen committed
72

lishen's avatar
lishen committed
73
74
75
76
```shell
python setup.py bdist_wheel --set CMAKE_CXX_COMPILER=/opt/dtk/bin/hipcc
```