Skip to content

Updated setup.py to add and link cuda libraries #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
210 changes: 5 additions & 205 deletions .github/workflows/whl-build-ec2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,6 @@ concurrency:
cancel-in-progress: true

jobs:
create-habitat-index-html:
needs: [whl-build-cu111, whl-build-cu113, whl-build-cu116, whl-build-cu117]
runs-on:
group: organization/t4
labels: [self-hosted]
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.HABITAT_AWS_ACCESS_KEY }}
aws-region: ${{ secrets.HABITAT_AWS_REGION }}
aws-secret-access-key: ${{ secrets.HABITAT_AWS_SECRET_ACCESS_KEY }}

- name: Create index.html
run: |
python3 /home/builduser/create_index.py habitat -f wheels-cu102 wheels-cu111 wheels-cu113 wheels-cu116 wheels-cu117

- name: Upload to S3
run: |
aws s3 cp index.html s3://centml-releases/habitat/

start-runner:
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
Expand All @@ -51,171 +30,6 @@ jobs:
a10g: false
v100: false

whl-build-cu111:
runs-on:
group: organization/t4
labels: [cu111]
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.HABITAT_AWS_ACCESS_KEY }}
aws-region: ${{ secrets.HABITAT_AWS_REGION }}
aws-secret-access-key: ${{ secrets.HABITAT_AWS_SECRET_ACCESS_KEY }}

- name: Display host information
run: |
uname -a
hostname
pwd
id
ls -la

- name: Fetch repository
uses: actions/checkout@v3

- name: Build Python3.7 wheel
run: |
/home/builduser/build_habitat.sh python3.7 py37

- name: Build Python3.8 wheel
run: |
/home/builduser/build_habitat.sh python3.8 py38

- name: Build Python3.9 wheel
run: |
/home/builduser/build_habitat.sh python3.9 py39

- name: Build Python3.10 wheel
run: |
/home/builduser/build_habitat.sh python3.10 py310

- name: Upload wheels to S3
run: |
aws s3 cp analyzer/dist/ s3://centml-releases/habitat/wheels-cu111/ --recursive --exclude "*" --include "*.whl"

- name: Create index.html
run: |
file_list=(analyzer/dist/*.whl)
formatted_file_list=$(basename -a ${file_list[@]})
python3 /home/builduser/create_index.py habitat_cu111 -f $formatted_file_list

- name: Upload index.html to S3
run: |
aws s3 cp index.html s3://centml-releases/habitat/wheels-cu111/

whl-build-cu113:
runs-on:
group: organization/t4
labels: [cu113]
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.HABITAT_AWS_ACCESS_KEY }}
aws-region: ${{ secrets.HABITAT_AWS_REGION }}
aws-secret-access-key: ${{ secrets.HABITAT_AWS_SECRET_ACCESS_KEY }}

- name: Display host information
run: |
uname -a
hostname
pwd
id
ls -la

- name: Fetch repository
uses: actions/checkout@v3

- name: Build Python3.7 wheel
run: |
/home/builduser/build_habitat.sh python3.7 py37

- name: Build Python3.8 wheel
run: |
/home/builduser/build_habitat.sh python3.8 py38

- name: Build Python3.9 wheel
run: |
/home/builduser/build_habitat.sh python3.9 py39

- name: Build Python3.10 wheel
run: |
/home/builduser/build_habitat.sh python3.10 py310

- name: Upload wheels to S3
run: |
aws s3 cp analyzer/dist/ s3://centml-releases/habitat/wheels-cu113/ --recursive --exclude "*" --include "*.whl"

- name: Create index.html
run: |
file_list=(analyzer/dist/*.whl)
formatted_file_list=$(basename -a ${file_list[@]})
python3 /home/builduser/create_index.py habitat_cu113 -f $formatted_file_list

- name: Upload index.html to S3
run: |
aws s3 cp index.html s3://centml-releases/habitat/wheels-cu113/

whl-build-cu116:
runs-on:
group: organization/t4
labels: [cu116]
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.HABITAT_AWS_ACCESS_KEY }}
aws-region: ${{ secrets.HABITAT_AWS_REGION }}
aws-secret-access-key: ${{ secrets.HABITAT_AWS_SECRET_ACCESS_KEY }}

- name: Display host information
run: |
uname -a
hostname
pwd
id
ls -la

- name: Fetch repository
uses: actions/checkout@v3

- name: Build Python3.7 wheel
run: |
/home/builduser/build_habitat.sh python3.7 py37

- name: Build Python3.8 wheel
run: |
/home/builduser/build_habitat.sh python3.8 py38

- name: Build Python3.9 wheel
run: |
/home/builduser/build_habitat.sh python3.9 py39

- name: Build Python3.10 wheel
run: |
/home/builduser/build_habitat.sh python3.10 py310

- name: Upload wheel artifact
uses: actions/upload-artifact@v3
with:
name: wheels-cu116
path: analyzer/dist/*.whl

- name: Upload wheels to S3
run: |
aws s3 cp analyzer/dist/ s3://centml-releases/habitat/wheels-cu116/ --recursive --exclude "*" --include "*.whl"

- name: Create index.html
run: |
file_list=(analyzer/dist/*.whl)
formatted_file_list=$(basename -a ${file_list[@]})
python3 /home/builduser/create_index.py habitat_cu116 -f $formatted_file_list

- name: Upload index.html to S3
run: |
aws s3 cp index.html s3://centml-releases/habitat/wheels-cu116/

whl-build-cu117:
runs-on:
group: organization/t4
Expand All @@ -241,43 +55,29 @@ jobs:

- name: Build Python3.7 wheel
run: |
/home/builduser/build_habitat.sh python3.7 py37
./build_scripts/build_wheel.sh python3.7

- name: Build Python3.8 wheel
run: |
/home/builduser/build_habitat.sh python3.8 py38
./build_scripts/build_wheel.sh python3.8

- name: Build Python3.9 wheel
run: |
/home/builduser/build_habitat.sh python3.9 py39
./build_scripts/build_wheel.sh python3.9

- name: Build Python3.10 wheel
run: |
/home/builduser/build_habitat.sh python3.10 py310
./build_scripts/build_wheel.sh python3.10

- name: Upload wheels to S3
run: |
aws s3 cp analyzer/dist/ s3://centml-releases/habitat/wheels-cu117/ --recursive --exclude "*" --include "*.whl"

- name: Create index.html
run: |
file_list=(analyzer/dist/*.whl)
formatted_file_list=$(basename -a ${file_list[@]})
python3 /home/builduser/create_index.py habitat_cu117 -f $formatted_file_list

- name: Upload index.html to S3
run: |
aws s3 cp index.html s3://centml-releases/habitat/wheels-cu117/
aws s3 cp analyzer/dist/ s3://centml-releases/habitat/wheels-cu117/ --recursive --include "*"

stop-runner:
name: Stop self-hosted EC2 runner
needs:
- start-runner # required to get output from the start-runner job
- whl-build-cu117 # required to wait when the main job is done
- whl-build-cu116
- whl-build-cu113
- whl-build-cu111
- create-habitat-index-html
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
Expand Down
50 changes: 17 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,17 @@ Currently, we have predictors for the following Nvidia GPUs:

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

### 1. Install CUPTI
### Installing from pip

Install via pip with the following command

```bash
pip install deepview-predict
```

### Installing from source

1. Install CUPTI

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:
```bash
Expand All @@ -59,34 +69,7 @@ Alternatively, if you do not have root access on your machine, you can use `cond
```
After installing CUPTI, add `$CONDA_HOME/extras/CUPTI/lib64/` to `LD_LIBRARY_PATH` to ensure the library is linked.

### 2. Install DeepView.Predict

You can install via pip if you have the following versions of CUDA and Python

- CUDA: 10.2, 11.1, 11.3, 11.6, 11.7
- Python: 3.7 - 3.10

### Installing from pip

Install via pip with the following command

```bash
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
```

where YYY is your CUDA version and ZZ is your Python version.

For example, if you are using CUDA 10.2 and Python 3.7):

```bash
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
```

If you do not find matching version of CUDA and Python above, you need to build DeepView.Predict from source with the following instructions

### Installing from source

1. Install CMake 3.17+.
2. Install CMake 3.17+.
- 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
- [https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7608/diffs](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7608/diffs)
- Run the following commands to download and install a precompiled version of CMake 3.24.2
Expand All @@ -105,22 +88,23 @@ If you do not find matching version of CUDA and Python above, you need to build
cmake --version
```

2. Install [Git Large File Storage](https://git-lfs.github.com/)
3. Clone the DeepView.Predict package
3. Install [Git Large File Storage](https://git-lfs.github.com/)

4. Clone the DeepView.Predict package

```bash
git clone https://github.com/CentML/DeepView.Predict
cd DeepView.Predict
```

4. Get the pre-trained models used by DeepView.Predict
5. Get the pre-trained models used by DeepView.Predict

```bash
git submodule init && git submodule update
git lfs pull
```

5. Finally build DeepView.Predict with the following command
6. Finally build DeepView.Predict with the following command

```bash
./analyzer/install-dev.sh
Expand Down
6 changes: 4 additions & 2 deletions analyzer/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
habitat_predict.egg-info
habitat/habitat_cuda.cpython-36m-x86_64-linux-gnu.so
habitat-models.tar.gz
.eggs
build
*.egg-info
dist
4 changes: 2 additions & 2 deletions analyzer/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Habitat
DeepView.Profile
=======
This directory contains the Python source code for Habitat—a tool that predicts
This directory contains the Python source code for DeepView.Profile - a tool that predicts
the execution time of DNN operations across different GPUs.
21 changes: 14 additions & 7 deletions analyzer/habitat/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
from habitat.analysis import Device
from habitat.analysis.metrics import Metric
from habitat.analysis.predictor import Predictor
from habitat.tracking.operation import OperationTracker
MISSING_LIBRARY_MESSAGE = 'CUDA runtime libraries cannot be found on this machine. Please re-install DeepView and try again!'

__version__ = '1.0.0'
try :
from habitat.analysis import Device
from habitat.analysis.metrics import Metric
from habitat.analysis.predictor import Predictor
from habitat.tracking.operation import OperationTracker
except ImportError as ie:
import traceback
traceback.print_exc()
print(MISSING_LIBRARY_MESSAGE)

__version__ = '0.1.0'
__description__ = 'Cross-GPU performance predictions for PyTorch neural network training.'

__author__ = 'Geoffrey Yu'
__email__ = 'gxyu@cs.toronto.edu'
__author__ = 'CentML'
__email__ = 'support@centml.ai'

__license__ = 'Apache-2.0'

Expand Down
7 changes: 6 additions & 1 deletion analyzer/install-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,13 @@ function install_cupti_sample() {
function main() {
if [ "$1" = "--uninstall" ]; then
uninstall_habitat
elif [ "$1" = "--build" ]; then
install_cupti_sample
check_prereqs
compile_habitat_cuda
symlink_habitat_cuda
else
install_cupti_sample
install_cupti_sample
check_prereqs
compile_habitat_cuda
symlink_habitat_cuda
Expand Down
Loading