-
Notifications
You must be signed in to change notification settings - Fork 53
182 lines (163 loc) · 6.68 KB
/
regression.yaml
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: Regression
on:
workflow_dispatch:
inputs:
shutdown_instances:
description: 'Shut down GPU instances when finished.'
required: true
type: boolean
default: true
source_repo:
description: 'Source Repository Name. E.g, hidet-org/hidet'
required: true
type: string
default: 'this'
source_ref:
description: 'Source repository ref (Branch name or PR number).'
required: true
type: string
default: 'this'
jobs:
start_instances:
runs-on: ubuntu-latest
outputs:
started_instances: ${{ steps.run_py_script.outputs.started_instances }}
hw_configs: ${{ steps.run_py_script.outputs.hw_configs }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install dependencies
run: pip install mysql-connector-python
- name: Run main Python script
id: run_py_script
run: timeout 36000 python ./.github/scripts/start_instances.py
env:
# TODO: Allow launching only specified GPU instances
HW_CONFIG: all
REPO_NAME: ${{ github.repository }}
CI_DB_HOSTNAME: ${{ secrets.CI_DB_HOSTNAME }}
CI_DB_PORT: ${{ secrets.CI_DB_PORT }}
CI_DB_USERNAME: ${{ secrets.CI_DB_USERNAME }}
CI_DB_PASSWORD: ${{ secrets.CI_DB_PASSWORD }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
#- name: Upload run configs
# uses: actions/upload-artifact@v3
# with:
# name: run_configs
# path: run_configs.json
# retention-days: 1
run_tests:
needs: start_instances
timeout-minutes: 2880
strategy:
matrix:
hw_configs: ${{ fromJSON(needs.start_instances.outputs.hw_configs) }}
runs-on: ${{ matrix.hw_configs }}
outputs:
commit_time: ${{ steps.get_commit_info.outputs.commit_time }}
commit_author: ${{ steps.get_commit_info.outputs.commit_author }}
commit_sha: ${{ steps.get_commit_info.outputs.commit_sha }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
repository: |
${{ inputs.source_repo == 'this' && github.repository ||
inputs.source_repo }}
ref: |
${{ inputs.source_repo == 'this' && github.ref_name ||
format('refs/pull/{0}/head', inputs.source_ref) }}
path: hidet
- name: Checkout models
uses: actions/checkout@v4
with:
repository: ${{ secrets.MODEL_REPO }}
token: ${{ secrets.GH_PAT }}
path: models
ref: ci
#- name: Download run configs
# uses: actions/download-artifact@v3
# with:
# name: run_configs
# path: ./mount
# Put run_configs.json in shared folder. Intup and output of tests is saved in it.
- name: Copy run_config.json
run: cp hidet/tests/benchmarks/run_configs.json ./mount
# Build the image
- name: Build docker image from base image
run: docker build -t hidet-ci -f hidet/.github/Dockerfile .
# Run the tests in the container. Container should write output to host file
- name: Run Docker with slurm
timeout-minutes: 2880
run: >
srun --gpus 1 -c 8 bash -c 'docker run --privileged
--gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=-1
-e CUDA_VISIBLE_DEVICES=$SLURM_STEP_GPUS
-e HW_CONFIG -e REPO_NAME -e REPO_BRANCH -e CI_CS_HOSTNAME -e CI_CS_PORT
-e CI_CS_USERNAME -e CI_CS_PASSWORD -e HF_TOKEN
-v ./mount:/workspace/mount
hidet-ci python hidet/tests/benchmarks/run_tests.py --configs /workspace/mount/run_configs.json'
env:
HW_CONFIG: ${{ matrix.hw_configs }}
REPO_NAME: ${{ inputs.source_repo == 'this' && github.repository || inputs.source_repo }}
REPO_BRANCH: ${{ inputs.source_repo == 'this' && github.ref_name || format('pull/{0}', inputs.source_ref) }}
CI_CS_HOSTNAME: ${{ secrets.CI_CS_HOSTNAME }}
CI_CS_PORT: ${{ secrets.CI_CS_PORT }}
CI_CS_USERNAME: ${{ secrets.CI_CS_USERNAME }}
CI_CS_PASSWORD: ${{ secrets.CI_CS_PASSWORD }}
HF_TOKEN: ${{ secrets.HF_TOKEN }}
- name: Upload run configs
uses: actions/upload-artifact@v3
with:
name: run_configs_${{ matrix.hw_configs }}
path: ./mount/run_configs.json
retention-days: 1
- name: Retrieve commit properties
id: get_commit_info
run: |
cd hidet
COMMIT_TIME=$(git log -1 --format=%cd --date=format:'%Y-%m-%d %H:%M:%S')
COMMIT_AUTHOR=$(git log -1 --format=%an)
COMMIT_SHA=$(git log -1 --format=%H)
echo "commit_time=$COMMIT_TIME" >> $GITHUB_OUTPUT
echo "commit_author=$COMMIT_AUTHOR" >> $GITHUB_OUTPUT
echo "commit_sha=$COMMIT_SHA" >> $GITHUB_OUTPUT
upload_results:
runs-on: ubuntu-latest
needs: [start_instances, run_tests]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install dependencies
run: pip install mysql-connector-python
- name: Download run configs
uses: actions/download-artifact@v3
- name: Run main Python script
run: python ./.github/scripts/upload_results.py
env:
REPO_NAME: ${{ inputs.source_repo == 'this' && github.repository || inputs.source_repo }}
REPO_BRANCH: ${{ inputs.source_repo == 'this' && github.ref_name || format('pull/{0}', inputs.source_ref) }}
COMMIT_SHA: ${{ needs.run_tests.outputs.commit_sha }}
COMMIT_TIME: ${{ needs.run_tests.outputs.commit_time }}
COMMIT_AUTHOR: ${{ needs.run_tests.outputs.commit_author }}
HW_CONFIGS: ${{ needs.start_instances.outputs.hw_configs }}
CI_DB_HOSTNAME: ${{ secrets.CI_DB_HOSTNAME }}
CI_DB_PORT: ${{ secrets.CI_DB_PORT }}
CI_DB_USERNAME: ${{ secrets.CI_DB_USERNAME }}
CI_DB_PASSWORD: ${{ secrets.CI_DB_PASSWORD }}
stop_instances:
if: ${{ always() && inputs.shutdown_instances }}
runs-on: ubuntu-latest
needs: [start_instances, run_tests]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Run main Python script
run: timeout 900 python ./.github/scripts/stop_instances.py
env:
STARTED_INSTANCES: ${{ needs.start_instances.outputs.started_instances }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1