Skip to content

Commit 4f6b948

Browse files
authored
Updated setup.py to add and link cuda libraries (#29)
* Updated setup.py to add and link cuda libraries * Update build scripts * Add error handling if CUDA libs are not installed * Use build patchelf binary instead of global binary * Ignore build output * Fix script bugs * Only package with cuda11.7 * Updated metadata and readme
1 parent 2d5b6e7 commit 4f6b948

File tree

8 files changed

+122
-256
lines changed

8 files changed

+122
-256
lines changed

.github/workflows/whl-build-ec2.yaml

+5-205
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,6 @@ concurrency:
77
cancel-in-progress: true
88

99
jobs:
10-
create-habitat-index-html:
11-
needs: [whl-build-cu111, whl-build-cu113, whl-build-cu116, whl-build-cu117]
12-
runs-on:
13-
group: organization/t4
14-
labels: [self-hosted]
15-
steps:
16-
- name: Configure AWS Credentials
17-
uses: aws-actions/configure-aws-credentials@v1
18-
with:
19-
aws-access-key-id: ${{ secrets.HABITAT_AWS_ACCESS_KEY }}
20-
aws-region: ${{ secrets.HABITAT_AWS_REGION }}
21-
aws-secret-access-key: ${{ secrets.HABITAT_AWS_SECRET_ACCESS_KEY }}
22-
23-
- name: Create index.html
24-
run: |
25-
python3 /home/builduser/create_index.py habitat -f wheels-cu102 wheels-cu111 wheels-cu113 wheels-cu116 wheels-cu117
26-
27-
- name: Upload to S3
28-
run: |
29-
aws s3 cp index.html s3://centml-releases/habitat/
30-
3110
start-runner:
3211
name: Start self-hosted EC2 runner
3312
runs-on: ubuntu-latest
@@ -51,171 +30,6 @@ jobs:
5130
a10g: false
5231
v100: false
5332

54-
whl-build-cu111:
55-
runs-on:
56-
group: organization/t4
57-
labels: [cu111]
58-
steps:
59-
- name: Configure AWS Credentials
60-
uses: aws-actions/configure-aws-credentials@v1
61-
with:
62-
aws-access-key-id: ${{ secrets.HABITAT_AWS_ACCESS_KEY }}
63-
aws-region: ${{ secrets.HABITAT_AWS_REGION }}
64-
aws-secret-access-key: ${{ secrets.HABITAT_AWS_SECRET_ACCESS_KEY }}
65-
66-
- name: Display host information
67-
run: |
68-
uname -a
69-
hostname
70-
pwd
71-
id
72-
ls -la
73-
74-
- name: Fetch repository
75-
uses: actions/checkout@v3
76-
77-
- name: Build Python3.7 wheel
78-
run: |
79-
/home/builduser/build_habitat.sh python3.7 py37
80-
81-
- name: Build Python3.8 wheel
82-
run: |
83-
/home/builduser/build_habitat.sh python3.8 py38
84-
85-
- name: Build Python3.9 wheel
86-
run: |
87-
/home/builduser/build_habitat.sh python3.9 py39
88-
89-
- name: Build Python3.10 wheel
90-
run: |
91-
/home/builduser/build_habitat.sh python3.10 py310
92-
93-
- name: Upload wheels to S3
94-
run: |
95-
aws s3 cp analyzer/dist/ s3://centml-releases/habitat/wheels-cu111/ --recursive --exclude "*" --include "*.whl"
96-
97-
- name: Create index.html
98-
run: |
99-
file_list=(analyzer/dist/*.whl)
100-
formatted_file_list=$(basename -a ${file_list[@]})
101-
python3 /home/builduser/create_index.py habitat_cu111 -f $formatted_file_list
102-
103-
- name: Upload index.html to S3
104-
run: |
105-
aws s3 cp index.html s3://centml-releases/habitat/wheels-cu111/
106-
107-
whl-build-cu113:
108-
runs-on:
109-
group: organization/t4
110-
labels: [cu113]
111-
steps:
112-
- name: Configure AWS Credentials
113-
uses: aws-actions/configure-aws-credentials@v1
114-
with:
115-
aws-access-key-id: ${{ secrets.HABITAT_AWS_ACCESS_KEY }}
116-
aws-region: ${{ secrets.HABITAT_AWS_REGION }}
117-
aws-secret-access-key: ${{ secrets.HABITAT_AWS_SECRET_ACCESS_KEY }}
118-
119-
- name: Display host information
120-
run: |
121-
uname -a
122-
hostname
123-
pwd
124-
id
125-
ls -la
126-
127-
- name: Fetch repository
128-
uses: actions/checkout@v3
129-
130-
- name: Build Python3.7 wheel
131-
run: |
132-
/home/builduser/build_habitat.sh python3.7 py37
133-
134-
- name: Build Python3.8 wheel
135-
run: |
136-
/home/builduser/build_habitat.sh python3.8 py38
137-
138-
- name: Build Python3.9 wheel
139-
run: |
140-
/home/builduser/build_habitat.sh python3.9 py39
141-
142-
- name: Build Python3.10 wheel
143-
run: |
144-
/home/builduser/build_habitat.sh python3.10 py310
145-
146-
- name: Upload wheels to S3
147-
run: |
148-
aws s3 cp analyzer/dist/ s3://centml-releases/habitat/wheels-cu113/ --recursive --exclude "*" --include "*.whl"
149-
150-
- name: Create index.html
151-
run: |
152-
file_list=(analyzer/dist/*.whl)
153-
formatted_file_list=$(basename -a ${file_list[@]})
154-
python3 /home/builduser/create_index.py habitat_cu113 -f $formatted_file_list
155-
156-
- name: Upload index.html to S3
157-
run: |
158-
aws s3 cp index.html s3://centml-releases/habitat/wheels-cu113/
159-
160-
whl-build-cu116:
161-
runs-on:
162-
group: organization/t4
163-
labels: [cu116]
164-
steps:
165-
- name: Configure AWS Credentials
166-
uses: aws-actions/configure-aws-credentials@v1
167-
with:
168-
aws-access-key-id: ${{ secrets.HABITAT_AWS_ACCESS_KEY }}
169-
aws-region: ${{ secrets.HABITAT_AWS_REGION }}
170-
aws-secret-access-key: ${{ secrets.HABITAT_AWS_SECRET_ACCESS_KEY }}
171-
172-
- name: Display host information
173-
run: |
174-
uname -a
175-
hostname
176-
pwd
177-
id
178-
ls -la
179-
180-
- name: Fetch repository
181-
uses: actions/checkout@v3
182-
183-
- name: Build Python3.7 wheel
184-
run: |
185-
/home/builduser/build_habitat.sh python3.7 py37
186-
187-
- name: Build Python3.8 wheel
188-
run: |
189-
/home/builduser/build_habitat.sh python3.8 py38
190-
191-
- name: Build Python3.9 wheel
192-
run: |
193-
/home/builduser/build_habitat.sh python3.9 py39
194-
195-
- name: Build Python3.10 wheel
196-
run: |
197-
/home/builduser/build_habitat.sh python3.10 py310
198-
199-
- name: Upload wheel artifact
200-
uses: actions/upload-artifact@v3
201-
with:
202-
name: wheels-cu116
203-
path: analyzer/dist/*.whl
204-
205-
- name: Upload wheels to S3
206-
run: |
207-
aws s3 cp analyzer/dist/ s3://centml-releases/habitat/wheels-cu116/ --recursive --exclude "*" --include "*.whl"
208-
209-
- name: Create index.html
210-
run: |
211-
file_list=(analyzer/dist/*.whl)
212-
formatted_file_list=$(basename -a ${file_list[@]})
213-
python3 /home/builduser/create_index.py habitat_cu116 -f $formatted_file_list
214-
215-
- name: Upload index.html to S3
216-
run: |
217-
aws s3 cp index.html s3://centml-releases/habitat/wheels-cu116/
218-
21933
whl-build-cu117:
22034
runs-on:
22135
group: organization/t4
@@ -241,43 +55,29 @@ jobs:
24155

24256
- name: Build Python3.7 wheel
24357
run: |
244-
/home/builduser/build_habitat.sh python3.7 py37
58+
./build_scripts/build_wheel.sh python3.7
24559
24660
- name: Build Python3.8 wheel
24761
run: |
248-
/home/builduser/build_habitat.sh python3.8 py38
62+
./build_scripts/build_wheel.sh python3.8
24963
25064
- name: Build Python3.9 wheel
25165
run: |
252-
/home/builduser/build_habitat.sh python3.9 py39
66+
./build_scripts/build_wheel.sh python3.9
25367
25468
- name: Build Python3.10 wheel
25569
run: |
256-
/home/builduser/build_habitat.sh python3.10 py310
70+
./build_scripts/build_wheel.sh python3.10
25771
25872
- name: Upload wheels to S3
25973
run: |
260-
aws s3 cp analyzer/dist/ s3://centml-releases/habitat/wheels-cu117/ --recursive --exclude "*" --include "*.whl"
261-
262-
- name: Create index.html
263-
run: |
264-
file_list=(analyzer/dist/*.whl)
265-
formatted_file_list=$(basename -a ${file_list[@]})
266-
python3 /home/builduser/create_index.py habitat_cu117 -f $formatted_file_list
267-
268-
- name: Upload index.html to S3
269-
run: |
270-
aws s3 cp index.html s3://centml-releases/habitat/wheels-cu117/
74+
aws s3 cp analyzer/dist/ s3://centml-releases/habitat/wheels-cu117/ --recursive --include "*"
27175
27276
stop-runner:
27377
name: Stop self-hosted EC2 runner
27478
needs:
27579
- start-runner # required to get output from the start-runner job
27680
- whl-build-cu117 # required to wait when the main job is done
277-
- whl-build-cu116
278-
- whl-build-cu113
279-
- whl-build-cu111
280-
- create-habitat-index-html
28181
runs-on: ubuntu-latest
28282
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
28383
steps:

README.md

+17-33
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,17 @@ Currently, we have predictors for the following Nvidia GPUs:
4545

4646
<h2 id="building-locally">Building locally</h2>
4747

48-
### 1. Install CUPTI
48+
### Installing from pip
49+
50+
Install via pip with the following command
51+
52+
```bash
53+
pip install deepview-predict
54+
```
55+
56+
### Installing from source
57+
58+
1. Install CUPTI
4959

5060
CUPTI is a profiling interface required by DeepView.Predict. Select your version of CUDA [here](https://developer.nvidia.com/cuda-toolkit-archive) and follow the instructions to add NVIDIA's repository. Then, install CUPTI with:
5161
```bash
@@ -59,34 +69,7 @@ Alternatively, if you do not have root access on your machine, you can use `cond
5969
```
6070
After installing CUPTI, add `$CONDA_HOME/extras/CUPTI/lib64/` to `LD_LIBRARY_PATH` to ensure the library is linked.
6171

62-
### 2. Install DeepView.Predict
63-
64-
You can install via pip if you have the following versions of CUDA and Python
65-
66-
- CUDA: 10.2, 11.1, 11.3, 11.6, 11.7
67-
- Python: 3.7 - 3.10
68-
69-
### Installing from pip
70-
71-
Install via pip with the following command
72-
73-
```bash
74-
pip install http://centml-releases.s3-website.us-east-2.amazonaws.com/habitat/wheels/habitat_predict-1.0.0-20221123+cuYYY-pyZZ-none-any.whl
75-
```
76-
77-
where YYY is your CUDA version and ZZ is your Python version.
78-
79-
For example, if you are using CUDA 10.2 and Python 3.7):
80-
81-
```bash
82-
pip install http://centml-releases.s3-website.us-east-2.amazonaws.com/habitat/wheels/habitat_predict-1.0.0-20221123+cu102-py37-none-any.whl
83-
```
84-
85-
If you do not find matching version of CUDA and Python above, you need to build DeepView.Predict from source with the following instructions
86-
87-
### Installing from source
88-
89-
1. Install CMake 3.17+.
72+
2. Install CMake 3.17+.
9073
- Note that CMake 3.24.0 and 3.24.1 has a bug that breaks DeepView.Predict as it is not able to find the CUPTI directory and you should not use those versions
9174
- [https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7608/diffs](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7608/diffs)
9275
- Run the following commands to download and install a precompiled version of CMake 3.24.2
@@ -105,22 +88,23 @@ If you do not find matching version of CUDA and Python above, you need to build
10588
cmake --version
10689
```
10790

108-
2. Install [Git Large File Storage](https://git-lfs.github.com/)
109-
3. Clone the DeepView.Predict package
91+
3. Install [Git Large File Storage](https://git-lfs.github.com/)
92+
93+
4. Clone the DeepView.Predict package
11094

11195
```bash
11296
git clone https://github.com/CentML/DeepView.Predict
11397
cd DeepView.Predict
11498
```
11599

116-
4. Get the pre-trained models used by DeepView.Predict
100+
5. Get the pre-trained models used by DeepView.Predict
117101

118102
```bash
119103
git submodule init && git submodule update
120104
git lfs pull
121105
```
122106

123-
5. Finally build DeepView.Predict with the following command
107+
6. Finally build DeepView.Predict with the following command
124108

125109
```bash
126110
./analyzer/install-dev.sh

analyzer/.gitignore

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
habitat_predict.egg-info
21
habitat/habitat_cuda.cpython-36m-x86_64-linux-gnu.so
3-
habitat-models.tar.gz
2+
.eggs
3+
build
4+
*.egg-info
5+
dist

analyzer/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Habitat
1+
DeepView.Profile
22
=======
3-
This directory contains the Python source code for Habitat—a tool that predicts
3+
This directory contains the Python source code for DeepView.Profile - a tool that predicts
44
the execution time of DNN operations across different GPUs.

analyzer/habitat/__init__.py

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
from habitat.analysis import Device
2-
from habitat.analysis.metrics import Metric
3-
from habitat.analysis.predictor import Predictor
4-
from habitat.tracking.operation import OperationTracker
1+
MISSING_LIBRARY_MESSAGE = 'CUDA runtime libraries cannot be found on this machine. Please re-install DeepView and try again!'
52

6-
__version__ = '1.0.0'
3+
try :
4+
from habitat.analysis import Device
5+
from habitat.analysis.metrics import Metric
6+
from habitat.analysis.predictor import Predictor
7+
from habitat.tracking.operation import OperationTracker
8+
except ImportError as ie:
9+
import traceback
10+
traceback.print_exc()
11+
print(MISSING_LIBRARY_MESSAGE)
12+
13+
__version__ = '0.1.0'
714
__description__ = 'Cross-GPU performance predictions for PyTorch neural network training.'
815

9-
__author__ = 'Geoffrey Yu'
10-
__email__ = '[email protected]'
16+
__author__ = 'CentML'
17+
__email__ = '[email protected]'
1118

1219
__license__ = 'Apache-2.0'
1320

analyzer/install-dev.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,13 @@ function install_cupti_sample() {
8383
function main() {
8484
if [ "$1" = "--uninstall" ]; then
8585
uninstall_habitat
86+
elif [ "$1" = "--build" ]; then
87+
install_cupti_sample
88+
check_prereqs
89+
compile_habitat_cuda
90+
symlink_habitat_cuda
8691
else
87-
install_cupti_sample
92+
install_cupti_sample
8893
check_prereqs
8994
compile_habitat_cuda
9095
symlink_habitat_cuda

0 commit comments

Comments
 (0)