Skip to content

Commit 4b6b35e

Browse files
committed
Add docker image for the artifact
1 parent 7ac396a commit 4b6b35e

File tree

8 files changed

+142
-24
lines changed

8 files changed

+142
-24
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.hidet_cache
2+
build
3+
cmake-build-debug
4+
**/outs

Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
FROM nvidia/cuda:11.6.0-devel-ubuntu20.04 as base
2+
3+
COPY . /root/hidet
4+
5+
ENV TZ=America/Toronto
6+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
7+
8+
RUN apt-get update && apt-get install -y \
9+
build-essential \
10+
wget \
11+
git \
12+
vim \
13+
python3 \
14+
llvm-10 \
15+
ccache \
16+
software-properties-common \
17+
python3-pip \
18+
&& rm -rf /var/lib/apt/lists/*
19+
20+
RUN python3 -m pip install --upgrade pip && \
21+
python3 -m pip install --no-cache-dir -r /root/hidet/requirements.txt && \
22+
python3 -m pip install --no-cache-dir --upgrade cmake && \
23+
python3 -m pip uninstall -y onnxruntime-gpu==1.11.1 && \
24+
python3 -m pip install --no-cache-dir onnxruntime-gpu==1.11.1 && \
25+
hash -r # refresh the hash
26+
27+
RUN ln -s /usr/bin/python3 /usr/bin/python
28+
29+
RUN cd /root/hidet && \
30+
mkdir build && \
31+
cd build && \
32+
cmake .. && \
33+
make -j 8 && \
34+
rm -rf /root/hidet/build/3rdparty
35+
36+
RUN echo export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/hidet/build/lib >> ~/.bashrc && \
37+
echo export PYTHONPATH=$PYTHONPATH:/root/hidet/python:/root/hidet/3rdparty/tvm/python >> ~/.bashrc && \
38+
echo alias python=python3 >> ~/.bashrc
39+
40+
WORKDIR /root/hidet/artifacts

README.md

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ This repository contains the artifacts for the paper
44

55
"Hidet: Task Mapping Programming Paradigm for Deep Learning Tensor Programs".
66

7-
## Installation
8-
9-
### Requirements
7+
## Hardware requirements
108

119
We did experiment on the following hardware platform
1210

@@ -16,13 +14,76 @@ We did experiment on the following hardware platform
1614

1715
Other workstation equipped with a modern NVIDIA GPU should also be able to run the experiments.
1816

19-
On the software side, we require the following software to be installed
17+
The experiments require a Linux system with NVIDIA GPU driver installed.
18+
19+
## Run experiments via docker
20+
21+
We provide a docker image to run the experiments, with pre-configured environment.
22+
23+
### Install docker and nvidia-docker
24+
25+
Please follow the instructions on the [official website](https://github.com/NVIDIA/nvidia-docker) to install docker and
26+
nvidia-docker.
27+
28+
### Prepare the image
29+
30+
We provide two ways to get the docker image to use. Please choose the one you like.
31+
32+
#### Option 1: use the prebuilt image
33+
34+
```bash
35+
docker pull yyding/hidet-artifact:latest
36+
```
37+
38+
#### Option 2: build docker image from Dockerfile
39+
40+
```bash
41+
git clone --recursive git@github.com:yaoyaoding/hidet-artifacts hidet
42+
cd hidet
43+
docker build -t yyding/hidet-artifact:latest .
44+
```
45+
46+
### Run experiments inside docker container
47+
48+
After above step, you can see a docker image named `yyding/hidet-artifact:latest` in your local docker image list via:
49+
50+
```bash
51+
docker image ls
52+
```
53+
54+
You should be able to see something like this:
55+
56+
```text
57+
REPOSITORY TAG IMAGE ID CREATED SIZE
58+
yyding/hidet-artifact latest 1074c09962c0 33 minutes ago 13.7GB
59+
```
60+
61+
To run experiments, you need to start a docker container from the image:
62+
63+
```bash
64+
# the following command will start a container based on the image
65+
# you will enter the container after the command at working directory /root/hidet/artifacts
66+
docker run -it --gpus all --rm yyding/hidet-artifact:latest
67+
# when you are in the container, run
68+
bash run.sh
69+
# to run all experiments
70+
```
71+
72+
You can also run experiments in the container one by one. See [here](#run-the-experiments) for details.
73+
74+
## Build and run experiments from source
75+
76+
You can also build and run experiments from source on your host environment.
77+
78+
### Installation
79+
80+
We require the following software to be installed
2081

2182
- cmake 3.19+
2283
- llvm (required by TVM, we used llvm-10)
2384
- ccache (used to accelerate duplicated compilation)
2485

25-
### NVIDIA CUDA Toolkit
86+
#### NVIDIA CUDA Toolkit
2687

2788
Please follow https://developer.nvidia.com/cuda-downloads guide to install the CUDA toolkit.
2889

@@ -35,15 +96,12 @@ nvidia-smi
3596
nvcc --version
3697
```
3798

38-
### Install Hidet and baselines
99+
#### Install Hidet and baselines
39100

40101
```bash
41102
# clone hidet repository
42-
git clone git@github.com:yaoyaoding/hidet
103+
git clone --recursive git@github.com:yaoyaoding/hidet-artifacts hidet
43104
cd hidet
44-
git checkout artifact
45-
git submodule init
46-
git submodule update --recursive --init
47105

48106
# install the dependencies of hidet and the baselines (e.g., TensorRT, PyTorch, Onnx Runtime)
49107
# the versions of baselines are specified in requirements.txt file.
@@ -70,7 +128,7 @@ python3 -c "import hidet"
70128
python3 -c "import artifact"
71129
```
72130

73-
# Run the experiments
131+
### Run the experiments
74132

75133
This artifact contains all the experiments in the evaluation section of the paper:
76134

artifacts/2_input_sensitivity/main.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ def main():
99
]:
1010
for model in [
1111
'--model op_matmul_nn_4', # 2048x2048x2048
12-
'--model op_matmul_nn_5', # 2047x2047x2047
13-
'--model op_matmul_nn_6', # 2046x2046x2046
14-
'--model op_matmul_nn_7', # 2045x2045x2045
15-
'--model op_matmul_nn_8', # 2044x2044x2044
16-
'--model op_matmul_nn_9', # 2043x2043x2043
17-
'--model op_matmul_nn_10', # 2042x2042x2042
18-
'--model op_matmul_nn_11', # 2041x2041x2041
12+
'--model op_matmul_nn_5', # 2039x2039x2039
13+
'--model op_matmul_nn_6', # 2047x2047x2047
14+
'--model op_matmul_nn_7', # 2046x2046x2046
15+
'--model op_matmul_nn_8', # 2045x2045x2045
16+
'--model op_matmul_nn_9', # 2044x2044x2044
17+
'--model op_matmul_nn_10', # 2043x2043x2043
18+
'--model op_matmul_nn_11', # 2042x2042x2042
1919
]:
20-
if '11' in model and ('ansor' in executor or 'autotvm' in executor):
21-
# both schedulers failed to find a schedule for this input 2041x2041x2041, skip
20+
if '_5' in model and ('ansor' in executor or 'autotvm' in executor):
21+
# both schedulers failed to find a schedule for this input 2039x2039x2039, skip
2222
# for autotvm, it will fall back to a default schedule.
2323
# for ansor, it will fall into a dead loop.
2424
continue

artifacts/run.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
export TVM_BIND_THREADS=0
66
export TVM_NUM_THREADS=24
77

8+
# The first run would generate a lot of logs and take a long time
9+
python ./0_end2end/main.py
10+
python ./1_latency_distribution/main.py
11+
python ./2_input_sensitivity/main.py
12+
python ./3_batch_size/main.py
13+
python ./4_prologue_epilogue_fusion/main.py
14+
python ./5_tensorrt/main.py
15+
16+
# The second run would use the cached results and take a short time
17+
# The output would be clear (not scattered with logs)
818
python ./0_end2end/main.py
919
python ./1_latency_distribution/main.py
1020
python ./2_input_sensitivity/main.py

build_docker_image.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
docker build -t hidet-artifact:latest .

requirements.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ nvtx
2323

2424
# for onnx frontend
2525
onnx==1.10.2
26+
protobuf==3.20
2627

2728
################################################################################
2829
# Optional packages
@@ -31,13 +32,14 @@ onnx==1.10.2
3132
torch==1.11
3233
torchvision==0.12
3334

34-
# for language model converting
35-
transformers==4.19.2
36-
transformers[onnx]
37-
3835
# for onnx runtime baseline
36+
onnxruntime==1.11.1
3937
onnxruntime-gpu==1.11.1
4038

39+
# for language model converting
40+
transformers==4.19.2
41+
transformers[onnx]==4.19.2
42+
4143
# for tensor rt baseline
4244
--extra-index-url https://pypi.ngc.nvidia.com
4345
nvidia-tensorrt==8.2.5.1

run_docker.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
docker run --rm --gpus all -it hidet-artifact:latest

0 commit comments

Comments
 (0)