"vscode:/vscode.git/clone" did not exist on "fec0167a123eddc60891320dd263e974671ad1c9"
README_HIP.md 1.25 KB
Newer Older
lishen's avatar
lishen committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
60
61
62
63
64
65
66
67
# DLIB

## 环境配置

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

## 使用源码安装

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

- 拉取 apex 代码

  ```
  git clone -b dtk-23.04 http://developer.hpccube.com/codes/aicomponent/dlib.git
  ```
-[开发者社区](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    # 全部测试
./dtest -d --test_dnn    # 测试单个测试单元
```

#### 编译 dlib Python API

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