This repository was archived by the owner on May 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
AMD ROCm support #5
Merged
casper-hansen
merged 9 commits into
casper-hansen:main
from
IlyasMoutawwakil:amd-support
Jan 26, 2024
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f0502a1
added rocm support
IlyasMoutawwakil 8c585f7
added rocm build workflow
IlyasMoutawwakil 3602356
rocm version
IlyasMoutawwakil aa34717
updated readme
IlyasMoutawwakil 20417e0
rocm 5.6
IlyasMoutawwakil 9915b39
remove unnecessary packages
IlyasMoutawwakil c9c5197
fix for rocm6.0
IlyasMoutawwakil 82f9647
fix
IlyasMoutawwakil d012946
fix extra_compile_args
IlyasMoutawwakil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,11 +32,11 @@ jobs: | |
const script = require('.github/workflows/scripts/github_create_release.js') | ||
await script(github, context, core) | ||
|
||
build_wheels: | ||
name: Build AWQ | ||
build_cuda_wheels: | ||
name: Build AWQ with CUDA | ||
runs-on: ${{ matrix.os }} | ||
needs: release | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-20.04, windows-latest] | ||
|
@@ -48,7 +48,7 @@ jobs: | |
env: | ||
PYPI_CUDA_VERSION: "12.1.1" | ||
CUDA_VERSION: ${{ matrix.cuda }} | ||
|
||
steps: | ||
- name: Free Disk Space | ||
uses: jlumbroso/[email protected] | ||
|
@@ -61,7 +61,7 @@ jobs: | |
large-packages: false | ||
docker-images: true | ||
swap-storage: false | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v3 | ||
|
@@ -78,7 +78,7 @@ jobs: | |
use-mamba: true | ||
add-pip-as-python-dependency: true | ||
auto-activate-base: false | ||
|
||
- name: Install Dependencies | ||
run: | | ||
# Install CUDA toolkit | ||
|
@@ -87,7 +87,7 @@ jobs: | |
# Env variables | ||
$env:CUDA_PATH = $env:CONDA_PREFIX | ||
$env:CUDA_HOME = $env:CONDA_PREFIX | ||
|
||
# Install torch | ||
$cudaVersion = $env:CUDA_VERSION.Replace('.', '') | ||
$cudaVersionPytorch = $cudaVersion.Substring(0, $cudaVersion.Length - 1) | ||
|
@@ -113,9 +113,122 @@ jobs: | |
} | ||
|
||
python setup.py sdist bdist_wheel | ||
|
||
|
||
- name: Upload Assets | ||
uses: shogo82148/actions-upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ needs.release.outputs.upload_url }} | ||
asset_path: ./dist/*.whl | ||
|
||
build_rocm_wheels: | ||
name: Build AWQ with ROCm | ||
runs-on: ${{ matrix.os }} | ||
needs: release | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-20.04] | ||
python: ["3.8", "3.9", "3.10", "3.11"] | ||
rocm: ["5.6.1", "5.7.1"] # we build only for rocm5.6 & 5.7 to match PyTorch 2.1.0 and PyTorch 2.2 nightly | ||
defaults: | ||
run: | ||
shell: bash | ||
env: | ||
ROCM_VERSION: ${{ matrix.rocm }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Free Disk Space | ||
run: | | ||
df -h | ||
echo "Removing large packages" | ||
sudo apt-get remove -y '^dotnet-.*' | ||
sudo apt-get remove -y 'php.*' | ||
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel | ||
df -h | ||
sudo apt-get autoremove -y >/dev/null 2>&1 | ||
sudo apt-get clean | ||
sudo apt-get autoremove -y >/dev/null 2>&1 | ||
sudo apt-get autoclean -y >/dev/null 2>&1 | ||
df -h | ||
echo "https://github.com/actions/virtual-environments/issues/709" | ||
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | ||
df -h | ||
echo "remove big /usr/local" | ||
sudo rm -rf "/usr/local/share/boost" | ||
sudo rm -rf /usr/local/lib/android >/dev/null 2>&1 | ||
df -h | ||
sudo rm -rf /usr/share/dotnet/sdk > /dev/null 2>&1 | ||
sudo rm -rf /usr/share/dotnet/shared > /dev/null 2>&1 | ||
sudo rm -rf /usr/share/swift > /dev/null 2>&1 | ||
df -h | ||
|
||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Setup Mamba | ||
uses: conda-incubator/[email protected] | ||
with: | ||
activate-environment: "build" | ||
python-version: ${{ matrix.python }} | ||
mamba-version: "*" | ||
use-mamba: false | ||
channels: conda-forge,defaults | ||
channel-priority: true | ||
add-pip-as-python-dependency: true | ||
auto-activate-base: false | ||
|
||
- name: Set up ROCm | ||
run: | | ||
echo "Using python:" | ||
python --version | ||
which python | ||
|
||
if [[ "${{ matrix.rocm }}" == "5.4.2" ]]; then | ||
export ROCM_DL_FILE=amdgpu-install_5.4.50402-1_all.deb | ||
elif [[ "${{ matrix.rocm }}" == "5.6.1" ]]; then | ||
export ROCM_DL_FILE=amdgpu-install_5.6.50601-1_all.deb | ||
elif [[ "${{ matrix.rocm }}" == "5.7.1" ]]; then | ||
export ROCM_DL_FILE=amdgpu-install_5.7.50701-1_all.deb | ||
else | ||
echo Unknown rocm version | ||
exit 1 | ||
fi | ||
|
||
curl -O https://repo.radeon.com/amdgpu-install/${{ matrix.rocm }}/ubuntu/focal/$ROCM_DL_FILE | ||
sudo dpkg -i $ROCM_DL_FILE | ||
sudo DEBIAN_FRONTEND=noninteractive amdgpu-install --usecase=rocm --no-dkms --no-32 -y | ||
|
||
- name: Install Dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y --no-install-recommends rocsparse-dev rocthrust-dev rocblas-dev hipblas-dev hipsparse-dev | ||
|
||
python -m pip install --upgrade build setuptools wheel | ||
|
||
if [[ "${{ matrix.rocm }}" == "5.7.1" ]]; then | ||
echo "Using PyTorch nightly" | ||
python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/rocm5.7 | ||
elif [[ "${{ matrix.rocm }}" == "5.6.1" ]]; then | ||
echo "Using PyTorch stable" | ||
python -m pip install torch --index-url https://download.pytorch.org/whl/rocm5.6 | ||
else | ||
echo Unknown rocm version for python install | ||
exit 1 | ||
fi | ||
|
||
- name: Build Wheel | ||
run: | | ||
echo "Using python for build:" | ||
python --version | ||
which python | ||
|
||
ROCM_VERSION=${{ matrix.rocm }} python setup.py sdist bdist_wheel | ||
|
||
- name: Upload Assets | ||
uses: shogo82148/actions-upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ needs.release.outputs.upload_url }} | ||
asset_path: ./dist/*.whl | ||
asset_path: ./dist/*.whl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.