README_HIP.md 1.38 KB
Newer Older
lishen's avatar
lishen committed
1
2
3
4
5
6
7
8
9
10
11
# DLIB

## 环境配置

使用DCU编译之前,需要准备编译环境。参考
[environment prepare](environment_prepare.md)

## 使用源码安装

### 编译环境准备(以dtk-23.04版本为例)

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

  ```
lishen's avatar
lishen committed
15
  git clone -b develop http://developer.hpccube.com/codes/aicomponent/dlib.git
lishen's avatar
lishen committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  ```
-[开发者社区](https://developer.hpccube.com/tool/#sdk) DCU Toolkit 中下载 DTK-23.04 解压至 /opt/ 路径下,并建立软链接

  ```
  cd /opt && ln -s dtk-23.04 dtk
  ```

- 导入环境变量以及安装必要依赖库

  ```shell
  source /opt/dtk/env.sh
  ```

### 编译安装

#### 使用cmake编译

```shell
mkdir build; cd build; 
cmake .. -DCMAKE_CXX_COMPILER=/opt/dtk/bin/hipcc

cmake --build . -j16 #--verbose
```

#### 单元测试

Running the unit test suite.
Type the following to compile and run the dlib unit test suite:

- 编译单元测试

```shell
cd dlib/test
mkdir build
cd build

cmake .. -DCMAKE_CXX_COMPILER=/opt/dtk/bin/hipcc
cmake --build . -j16 --config Release #--verbose
```

- 进行单元测试

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

#### 编译 dlib Python API

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

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
71
72
73
74
75
76

- 使用python编译whl包

```shell
python setup.py bdist_wheel --set CMAKE_CXX_COMPILER=/opt/dtk/bin/hipcc
```