Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
flash-attention
Commits
f515c77f
Unverified
Commit
f515c77f
authored
Oct 09, 2022
by
Tri Dao
Committed by
GitHub
Oct 09, 2022
Browse files
Merge pull request #53 from robotcator/workflow
build wheel workflow
parents
8dd52b07
2c853fe8
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
255 additions
and
0 deletions
+255
-0
.github/workflows/cuda/cu102-Linux-env.sh
.github/workflows/cuda/cu102-Linux-env.sh
+9
-0
.github/workflows/cuda/cu102-Linux.sh
.github/workflows/cuda/cu102-Linux.sh
+15
-0
.github/workflows/cuda/cu113-Linux-env.sh
.github/workflows/cuda/cu113-Linux-env.sh
+9
-0
.github/workflows/cuda/cu113-Linux.sh
.github/workflows/cuda/cu113-Linux.sh
+15
-0
.github/workflows/cuda/cu116-Linux-env.sh
.github/workflows/cuda/cu116-Linux-env.sh
+9
-0
.github/workflows/cuda/cu116-Linux.sh
.github/workflows/cuda/cu116-Linux.sh
+15
-0
.github/workflows/env.sh
.github/workflows/env.sh
+53
-0
.github/workflows/publish.yml
.github/workflows/publish.yml
+130
-0
No files found.
.github/workflows/cuda/cu102-Linux-env.sh
0 → 100644
View file @
f515c77f
#!/bin/bash
CUDA_HOME
=
/usr/local/cuda-10.2
LD_LIBRARY_PATH
=
${
CUDA_HOME
}
/lib64:
${
LD_LIBRARY_PATH
}
PATH
=
${
CUDA_HOME
}
/bin:
${
PATH
}
export
FORCE_CUDA
=
1
export
TORCH_CUDA_ARCH_LIST
=
"3.5;5.0+PTX;6.0;7.0;7.5"
export
CUDA_HOME
=
/usr/local/cuda-10.2
\ No newline at end of file
.github/workflows/cuda/cu102-Linux.sh
0 → 100644
View file @
f515c77f
#!/bin/bash
OS
=
ubuntu1804
wget
-nv
https://developer.download.nvidia.com/compute/cuda/repos/
${
OS
}
/x86_64/cuda-
${
OS
}
.pin
sudo mv
cuda-
${
OS
}
.pin /etc/apt/preferences.d/cuda-repository-pin-600
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
sudo
dpkg
-i
cuda-repo-
${
OS
}
-10-2-local-10
.2.89-440.33.01_1.0-1_amd64.deb
sudo
apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub
sudo
apt-get
-qq
update
sudo
apt
install
cuda cuda-nvcc-10-2 cuda-libraries-dev-10-2
sudo
apt clean
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
\ No newline at end of file
.github/workflows/cuda/cu113-Linux-env.sh
0 → 100644
View file @
f515c77f
#!/bin/bash
CUDA_HOME
=
/usr/local/cuda-11.3
LD_LIBRARY_PATH
=
${
CUDA_HOME
}
/lib64:
${
LD_LIBRARY_PATH
}
PATH
=
${
CUDA_HOME
}
/bin:
${
PATH
}
export
FORCE_CUDA
=
1
export
TORCH_CUDA_ARCH_LIST
=
"3.5;5.0+PTX;6.0;7.0;7.5;8.0;8.6"
export
CUDA_HOME
=
/usr/local/cuda-11.3
\ No newline at end of file
.github/workflows/cuda/cu113-Linux.sh
0 → 100644
View file @
f515c77f
#!/bin/bash
OS
=
ubuntu1804
wget
-nv
https://developer.download.nvidia.com/compute/cuda/repos/
${
OS
}
/x86_64/cuda-
${
OS
}
.pin
sudo mv
cuda-
${
OS
}
.pin /etc/apt/preferences.d/cuda-repository-pin-600
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
sudo
dpkg
-i
cuda-repo-
${
OS
}
-11-3-local_11
.3.0-465.19.01-1_amd64.deb
sudo
apt-key add /var/cuda-repo-
${
OS
}
-11-3-local
/7fa2af80.pub
sudo
apt-get
-qq
update
sudo
apt
install
cuda cuda-nvcc-11-3 cuda-libraries-dev-11-3
sudo
apt clean
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
\ No newline at end of file
.github/workflows/cuda/cu116-Linux-env.sh
0 → 100644
View file @
f515c77f
#!/bin/bash
CUDA_HOME
=
/usr/local/cuda-11.6
LD_LIBRARY_PATH
=
${
CUDA_HOME
}
/lib64:
${
LD_LIBRARY_PATH
}
PATH
=
${
CUDA_HOME
}
/bin:
${
PATH
}
export
FORCE_CUDA
=
1
export
TORCH_CUDA_ARCH_LIST
=
"3.5;5.0+PTX;6.0;7.0;7.5;8.0;8.6"
export
CUDA_HOME
=
/usr/local/cuda-11.6
\ No newline at end of file
.github/workflows/cuda/cu116-Linux.sh
0 → 100644
View file @
f515c77f
#!/bin/bash
OS
=
ubuntu1804
wget
-nv
https://developer.download.nvidia.com/compute/cuda/repos/
${
OS
}
/x86_64/cuda-
${
OS
}
.pin
sudo mv
cuda-
${
OS
}
.pin /etc/apt/preferences.d/cuda-repository-pin-600
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
sudo
dpkg
-i
cuda-repo-
${
OS
}
-11-6-local_11
.6.2-510.47.03-1_amd64.deb
sudo
apt-key add /var/cuda-repo-
${
OS
}
-11-6-local
/7fa2af80.pub
sudo
apt-get
-qq
update
sudo
apt
install
cuda cuda-nvcc-11-6 cuda-libraries-dev-11-6
sudo
apt clean
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
\ No newline at end of file
.github/workflows/env.sh
0 → 100644
View file @
f515c77f
export
LANG C.UTF-8
export
OFED_VERSION
=
5.3-1.0.0.1
sudo
apt-get update
&&
\
sudo
apt-get
install
-y
--no-install-recommends
\
software-properties-common
\
sudo
apt-get
install
-y
--no-install-recommends
\
build-essential
\
apt-utils
\
ca-certificates
\
wget
\
git
\
vim
\
libssl-dev
\
curl
\
unzip
\
unrar
\
cmake
\
net-tools
\
sudo
\
autotools-dev
\
rsync
\
jq
\
openssh-server
\
tmux
\
screen
\
htop
\
pdsh
\
openssh-client
\
lshw
\
dmidecode
\
util-linux
\
automake
\
autoconf
\
libtool
\
net-tools
\
pciutils
\
libpci-dev
\
libaio-dev
\
libcap2
\
libtinfo5
\
fakeroot
\
devscripts
\
debhelper
\
nfs-common
# wget -O ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
# chmod +x ~/miniconda.sh && \
# ~/miniconda.sh -b -p /opt/conda && \
# rm ~/miniconda.sh
# export PATH=/opt/conda/bin:$PATH
\ No newline at end of file
.github/workflows/publish.yml
0 → 100644
View file @
f515c77f
# This workflow will upload a Python Package to Release asset
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name
:
Python Package
on
:
# create:
# tags:
# - '**'
push
:
branch
:
publish
jobs
:
release
:
name
:
Create Release
runs-on
:
ubuntu-latest
steps
:
-
name
:
Get the tag version
id
:
extract_branch
run
:
echo ::set-output name=branch::${GITHUB_REF#refs/tags/}
shell
:
bash
-
name
:
Create Release
id
:
create_release
uses
:
actions/create-release@v1
env
:
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
with
:
tag_name
:
${{ steps.extract_branch.outputs.branch }}
release_name
:
${{ steps.extract_branch.outputs.branch }}
wheel
:
name
:
Build Wheel
runs-on
:
${{ matrix.os }}
needs
:
release
strategy
:
fail-fast
:
false
matrix
:
# os: [ubuntu-20.04]
os
:
[
ubuntu-18.04
]
python-version
:
[
'
3.7'
,
'
3.8'
,
'
3.9'
,
'
3.10'
]
torch-version
:
[
1.11.0
,
1.12.0
,
1.12.1
]
cuda-version
:
[
'
113'
,
'
116'
]
exclude
:
-
torch-version
:
1.11.0
cuda-version
:
'
116'
steps
:
-
name
:
Checkout
uses
:
actions/checkout@v3
-
name
:
Set up Python
uses
:
actions/setup-python@v3
with
:
python-version
:
${{ matrix.python-version }}
-
name
:
Set up Linux Env
if
:
${{ runner.os == 'Linux' }}
run
:
|
sudo rm -rf /usr/share/dotnet
bash .github/workflows/env.sh
echo ${{ needs.create_release.outputs.upload_url }}
echo ${{ needs.steps.extract_branch.outputs.upload_url }}
shell
:
bash
-
name
:
Install CUDA ${{ matrix.cuda-version }}
if
:
${{ matrix.cuda-version != 'cpu' }}
run
:
|
bash .github/workflows/cuda/cu${{ matrix.cuda-version }}-${{ runner.os }}.sh
shell
:
bash
-
name
:
Check GPU Env
if
:
${{ matrix.cuda-version != 'cpu' }}
run
:
|
source .github/workflows/cuda/cu${{ matrix.cuda-version }}-${{ runner.os }}-env.sh
nvcc --version
shell
:
bash
-
name
:
Install PyTorch ${{ matrix.torch-version }}+cu${{ matrix.cuda-version }}
run
:
|
pip install numpy pyyaml scipy ipython mkl mkl-include ninja cython typing pandas typing-extensions dataclasses && conda clean -ya
pip install --no-index --no-cache-dir torch==${{ matrix.torch-version }} -f https://download.pytorch.org/whl/cu${{ matrix.cuda-version }}/torch_stable.html
python --version
python -c "import torch; print('PyTorch:', torch.__version__)"
python -c "import torch; print('CUDA:', torch.version.cuda)"
python -c "from torch.utils import cpp_extension; print (cpp_extension.CUDA_HOME)"
shell
:
bash
-
name
:
Get the tag version
id
:
extract_branch
run
:
echo ::set-output name=branch::${GITHUB_REF#refs/tags/}
-
name
:
Get Release with tag
id
:
get_current_release
uses
:
joutvhu/get-release@v1
with
:
tag_name
:
${{ steps.extract_branch.outputs.branch }}
env
:
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
-
name
:
Build wheel
run
:
|
export FORCE_CUDA="1"
export PATH=/usr/local/nvidia/bin:/usr/local/nvidia/lib64:$PATH
export LD_LIBRARY_PATH=/usr/local/nvidia/lib64:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export CUDA_INSTALL_DIR=/usr/local/cuda-11.3$CUDA_INSTALL_DIR
pip install wheel
python setup.py bdist_wheel --dist-dir=dist
tmpname=cu${{ matrix.cuda-version }}torch${{ matrix.torch-version }}
wheel_name=$(ls dist/*whl | xargs -n 1 basename | sed "s/-/+$tmpname-/2")
ls dist/*whl |xargs -I {} mv {} ${wheel_name}
echo "wheel_name=${wheel_name}" >> $GITHUB_ENV
-
name
:
Upload Release Asset
id
:
upload_release_asset
uses
:
actions/upload-release-asset@v1
env
:
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
with
:
upload_url
:
${{ steps.get_current_release.outputs.upload_url }}
asset_path
:
./${{env.wheel_name}}
asset_name
:
${{env.wheel_name}}
asset_content_type
:
application/*
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment