Skip to content

Commit f515c77

Browse files
authored
Merge pull request Dao-AILab#53 from robotcator/workflow
build wheel workflow
2 parents 8dd52b0 + 2c853fe commit f515c77

File tree

8 files changed

+255
-0
lines changed

8 files changed

+255
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
CUDA_HOME=/usr/local/cuda-10.2
4+
LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
5+
PATH=${CUDA_HOME}/bin:${PATH}
6+
7+
export FORCE_CUDA=1
8+
export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5"
9+
export CUDA_HOME=/usr/local/cuda-10.2
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
OS=ubuntu1804
4+
5+
wget -nv https://developer.download.nvidia.com/compute/cuda/repos/${OS}/x86_64/cuda-${OS}.pin
6+
sudo mv cuda-${OS}.pin /etc/apt/preferences.d/cuda-repository-pin-600
7+
wget -nv https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-${OS}-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
8+
sudo dpkg -i cuda-repo-${OS}-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
9+
sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub
10+
11+
sudo apt-get -qq update
12+
sudo apt install cuda cuda-nvcc-10-2 cuda-libraries-dev-10-2
13+
sudo apt clean
14+
15+
rm -f https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-${OS}-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
CUDA_HOME=/usr/local/cuda-11.3
4+
LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
5+
PATH=${CUDA_HOME}/bin:${PATH}
6+
7+
export FORCE_CUDA=1
8+
export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5;8.0;8.6"
9+
export CUDA_HOME=/usr/local/cuda-11.3
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
OS=ubuntu1804
4+
5+
wget -nv https://developer.download.nvidia.com/compute/cuda/repos/${OS}/x86_64/cuda-${OS}.pin
6+
sudo mv cuda-${OS}.pin /etc/apt/preferences.d/cuda-repository-pin-600
7+
wget -nv https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda-repo-${OS}-11-3-local_11.3.0-465.19.01-1_amd64.deb
8+
sudo dpkg -i cuda-repo-${OS}-11-3-local_11.3.0-465.19.01-1_amd64.deb
9+
sudo apt-key add /var/cuda-repo-${OS}-11-3-local/7fa2af80.pub
10+
11+
sudo apt-get -qq update
12+
sudo apt install cuda cuda-nvcc-11-3 cuda-libraries-dev-11-3
13+
sudo apt clean
14+
15+
rm -f https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda-repo-${OS}-11-3-local_11.3.0-465.19.01-1_amd64.deb
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
CUDA_HOME=/usr/local/cuda-11.6
4+
LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
5+
PATH=${CUDA_HOME}/bin:${PATH}
6+
7+
export FORCE_CUDA=1
8+
export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5;8.0;8.6"
9+
export CUDA_HOME=/usr/local/cuda-11.6
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
OS=ubuntu1804
4+
5+
wget -nv https://developer.download.nvidia.com/compute/cuda/repos/${OS}/x86_64/cuda-${OS}.pin
6+
sudo mv cuda-${OS}.pin /etc/apt/preferences.d/cuda-repository-pin-600
7+
wget -nv https://developer.download.nvidia.com/compute/cuda/11.6.2/local_installers/cuda-repo-${OS}-11-6-local_11.6.2-510.47.03-1_amd64.deb
8+
sudo dpkg -i cuda-repo-${OS}-11-6-local_11.6.2-510.47.03-1_amd64.deb
9+
sudo apt-key add /var/cuda-repo-${OS}-11-6-local/7fa2af80.pub
10+
11+
sudo apt-get -qq update
12+
sudo apt install cuda cuda-nvcc-11-6 cuda-libraries-dev-11-6
13+
sudo apt clean
14+
15+
rm -f https://developer.download.nvidia.com/compute/cuda/11.5.2/local_installers/cuda-repo-${OS}-11-6-local_11.6.2-510.47.03-1_amd64.deb

.github/workflows/env.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
export LANG C.UTF-8
2+
export OFED_VERSION=5.3-1.0.0.1
3+
4+
5+
sudo apt-get update && \
6+
sudo apt-get install -y --no-install-recommends \
7+
software-properties-common \
8+
9+
sudo apt-get install -y --no-install-recommends \
10+
build-essential \
11+
apt-utils \
12+
ca-certificates \
13+
wget \
14+
git \
15+
vim \
16+
libssl-dev \
17+
curl \
18+
unzip \
19+
unrar \
20+
cmake \
21+
net-tools \
22+
sudo \
23+
autotools-dev \
24+
rsync \
25+
jq \
26+
openssh-server \
27+
tmux \
28+
screen \
29+
htop \
30+
pdsh \
31+
openssh-client \
32+
lshw \
33+
dmidecode \
34+
util-linux \
35+
automake \
36+
autoconf \
37+
libtool \
38+
net-tools \
39+
pciutils \
40+
libpci-dev \
41+
libaio-dev \
42+
libcap2 \
43+
libtinfo5 \
44+
fakeroot \
45+
devscripts \
46+
debhelper \
47+
nfs-common
48+
49+
# wget -O ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
50+
# chmod +x ~/miniconda.sh && \
51+
# ~/miniconda.sh -b -p /opt/conda && \
52+
# rm ~/miniconda.sh
53+
# export PATH=/opt/conda/bin:$PATH

.github/workflows/publish.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# This workflow will upload a Python Package to Release asset
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
5+
name: Python Package
6+
7+
on:
8+
# create:
9+
# tags:
10+
# - '**'
11+
push:
12+
branch:
13+
publish
14+
15+
jobs:
16+
release:
17+
name: Create Release
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Get the tag version
21+
id: extract_branch
22+
run: echo ::set-output name=branch::${GITHUB_REF#refs/tags/}
23+
shell: bash
24+
25+
- name: Create Release
26+
id: create_release
27+
uses: actions/create-release@v1
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
with:
31+
tag_name: ${{ steps.extract_branch.outputs.branch }}
32+
release_name: ${{ steps.extract_branch.outputs.branch }}
33+
34+
wheel:
35+
name: Build Wheel
36+
runs-on: ${{ matrix.os }}
37+
needs: release
38+
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
# os: [ubuntu-20.04]
43+
os: [ubuntu-18.04]
44+
python-version: ['3.7', '3.8', '3.9', '3.10']
45+
torch-version: [1.11.0, 1.12.0, 1.12.1]
46+
cuda-version: ['113', '116']
47+
exclude:
48+
- torch-version: 1.11.0
49+
cuda-version: '116'
50+
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v3
54+
55+
- name: Set up Python
56+
uses: actions/setup-python@v3
57+
with:
58+
python-version: ${{ matrix.python-version }}
59+
60+
- name: Set up Linux Env
61+
if: ${{ runner.os == 'Linux' }}
62+
run: |
63+
sudo rm -rf /usr/share/dotnet
64+
bash .github/workflows/env.sh
65+
echo ${{ needs.create_release.outputs.upload_url }}
66+
echo ${{ needs.steps.extract_branch.outputs.upload_url }}
67+
shell:
68+
bash
69+
70+
- name: Install CUDA ${{ matrix.cuda-version }}
71+
if: ${{ matrix.cuda-version != 'cpu' }}
72+
run: |
73+
bash .github/workflows/cuda/cu${{ matrix.cuda-version }}-${{ runner.os }}.sh
74+
shell:
75+
bash
76+
77+
- name: Check GPU Env
78+
if: ${{ matrix.cuda-version != 'cpu' }}
79+
run: |
80+
source .github/workflows/cuda/cu${{ matrix.cuda-version }}-${{ runner.os }}-env.sh
81+
nvcc --version
82+
shell:
83+
bash
84+
85+
- name: Install PyTorch ${{ matrix.torch-version }}+cu${{ matrix.cuda-version }}
86+
run: |
87+
pip install numpy pyyaml scipy ipython mkl mkl-include ninja cython typing pandas typing-extensions dataclasses && conda clean -ya
88+
pip install --no-index --no-cache-dir torch==${{ matrix.torch-version }} -f https://download.pytorch.org/whl/cu${{ matrix.cuda-version }}/torch_stable.html
89+
python --version
90+
python -c "import torch; print('PyTorch:', torch.__version__)"
91+
python -c "import torch; print('CUDA:', torch.version.cuda)"
92+
python -c "from torch.utils import cpp_extension; print (cpp_extension.CUDA_HOME)"
93+
shell:
94+
bash
95+
96+
- name: Get the tag version
97+
id: extract_branch
98+
run: echo ::set-output name=branch::${GITHUB_REF#refs/tags/}
99+
100+
- name: Get Release with tag
101+
id: get_current_release
102+
uses: joutvhu/get-release@v1
103+
with:
104+
tag_name: ${{ steps.extract_branch.outputs.branch }}
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
108+
- name: Build wheel
109+
run: |
110+
export FORCE_CUDA="1"
111+
export PATH=/usr/local/nvidia/bin:/usr/local/nvidia/lib64:$PATH
112+
export LD_LIBRARY_PATH=/usr/local/nvidia/lib64:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
113+
export CUDA_INSTALL_DIR=/usr/local/cuda-11.3$CUDA_INSTALL_DIR
114+
pip install wheel
115+
python setup.py bdist_wheel --dist-dir=dist
116+
tmpname=cu${{ matrix.cuda-version }}torch${{ matrix.torch-version }}
117+
wheel_name=$(ls dist/*whl | xargs -n 1 basename | sed "s/-/+$tmpname-/2")
118+
ls dist/*whl |xargs -I {} mv {} ${wheel_name}
119+
echo "wheel_name=${wheel_name}" >> $GITHUB_ENV
120+
121+
- name: Upload Release Asset
122+
id: upload_release_asset
123+
uses: actions/upload-release-asset@v1
124+
env:
125+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126+
with:
127+
upload_url: ${{ steps.get_current_release.outputs.upload_url }}
128+
asset_path: ./${{env.wheel_name}}
129+
asset_name: ${{env.wheel_name}}
130+
asset_content_type: application/*

0 commit comments

Comments
 (0)