Skip to content

Commit

Permalink
Add fbgemm CPU only build in GHA (pytorch#953)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#953

- Add the CPU only build in GHA
- Add the release version of GPU build in GHA
- Add the release version of CPU build in GHA

Reviewed By: colin2328

Differential Revision: D34509897

fbshipit-source-id: 52a0fdd5baa1545c793da981e055b9618426d817
  • Loading branch information
jianyuh authored and facebook-github-bot committed Mar 1, 2022
1 parent 389f89d commit 5f5c368
Show file tree
Hide file tree
Showing 5 changed files with 606 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/fbgemm_nightly_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ jobs:
- os: linux.2xlarge
python-version: 3.7
python-tag: "py37"
cuda-tag: "cu11"
- os: linux.2xlarge
python-version: 3.8
python-tag: "py38"
cuda-tag: "cu11"
- os: linux.2xlarge
python-version: 3.9
python-tag: "py39"
cuda-tag: "cu11"
steps:
# Checkout the repository to the GitHub Actions runner
- name: Check ldd --version
Expand Down Expand Up @@ -97,6 +100,8 @@ jobs:
echo "skbuild succeeded"
conda run -n build_binary python -c "import numpy"
echo "numpy succeeded"
# for the conda run with quotes, we have to use "\" and double quotes
# here is the issue: https://github.com/conda/conda/issues/10972
- name: Build FBGEMM_GPU Nightly
run: |
cd fbgemm_gpu/
Expand All @@ -115,7 +120,7 @@ jobs:
- name: Upload wheel as GHA artifact
uses: actions/upload-artifact@v2
with:
name: fbgemm_gpu_nightly_${{ matrix.python-version }}.whl
name: fbgemm_gpu_nightly_${{ matrix.python-version }}_${{ matrix.cuda-tag }}.whl
path: fbgemm_gpu/dist/fbgemm_gpu_nightly-*.whl

# download from GHA, test on gpu and push to pypi
Expand All @@ -125,6 +130,7 @@ jobs:
matrix:
os: [linux.4xlarge.nvidia.gpu]
python-version: [3.7, 3.8, 3.9]
cuda-tag: ["cu11"]
needs: build_on_cpu
steps:
- name: Check ldd --version
Expand Down Expand Up @@ -216,7 +222,7 @@ jobs:
- name: Download wheel
uses: actions/download-artifact@v2
with:
name: fbgemm_gpu_nightly_${{ matrix.python-version }}.whl
name: fbgemm_gpu_nightly_${{ matrix.python-version }}_${{ matrix.cuda-tag }}.whl
- name: Display structure of downloaded files
run: ls -R
- name: Install Dependencies
Expand Down Expand Up @@ -256,9 +262,10 @@ jobs:
# Push to Pypi
- name: Push FBGEMM_GPU Binary to PYPI
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
conda run -n build_binary python -m pip install twine
# Official PYPI website
conda run -n build_binary \
python -m twine upload \
--username __token__ \
Expand Down
158 changes: 158 additions & 0 deletions .github/workflows/fbgemm_nightly_build_cpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Push CPU Binary Nightly

on:
# # For debugging, enable push/pull_request
# [push, pull_request]
# run every day at 10:45 AM
schedule:
- cron: '45 10 * * *'
# or manually trigger it
workflow_dispatch:

jobs:
# build, test, and upload to GHA on cpu hosts
build_test_upload:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: linux.2xlarge
python-version: 3.7
python-tag: "py37"
cuda-tag: "cpu"
- os: linux.2xlarge
python-version: 3.8
python-tag: "py38"
cuda-tag: "cpu"
- os: linux.2xlarge
python-version: 3.9
python-tag: "py39"
cuda-tag: "cpu"
steps:
# Checkout the repository to the GitHub Actions runner
- name: Check ldd --version
run: ldd --version
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
# Update references
- name: Git Sumbodule Update
run: |
cd fbgemm_gpu/
git submodule sync
git submodule update --init --recursive
- name: Update pip
run: |
sudo yum update -y
sudo yum -y install git python3-pip
sudo pip3 install --upgrade pip
- name: Setup conda
run: |
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p $HOME/miniconda
- name: Setup PATH with conda
run: |
echo "/home/ec2-user/miniconda/bin" >> $GITHUB_PATH
echo "CONDA=/home/ec2-user/miniconda" >> $GITHUB_PATH
- name: Create conda env
run: |
conda create --name build_binary python=${{ matrix.python-version }}
conda info
- name: check python version
run: |
conda run -n build_binary python --version
- name: Install gcc
shell: bash
run: |
sudo yum group install -y "Development Tools"
- name: setup Path
run: |
echo /usr/local/bin >> $GITHUB_PATH
- name: Install PyTorch
shell: bash
run: |
conda run -n build_binary python -m pip install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
- name: Install Dependencies
shell: bash
run: |
cd fbgemm_gpu/
conda run -n build_binary python -m pip install -r requirements.txt
- name: Test Installation of dependencies
run: |
cd fbgemm_gpu/
conda run -n build_binary python -c "import torch.distributed"
echo "torch.distributed succeeded"
conda run -n build_binary python -c "import skbuild"
echo "skbuild succeeded"
conda run -n build_binary python -c "import numpy"
echo "numpy succeeded"
- name: Build FBGEMM_GPU Nightly
run: |
cd fbgemm_gpu/
rm -r dist || true
# buld cuda7.0;8.0 for v100/a100 arch:
# Couldn't build more cuda arch due to 100 MB binary size limit from
# pypi website.
# manylinux1_x86_64 is specified for pypi upload:
# distribute python extensions as wheels on Linux
conda run -n build_binary \
python setup.py bdist_wheel \
--package_name=fbgemm_gpu_nightly-cpu \
--python-tag=${{ matrix.python-tag }} \
--cpu_only \
--plat-name=manylinux1_x86_64
- name: Upload wheel as GHA artifact
uses: actions/upload-artifact@v2
with:
name: fbgemm_gpu_nightly_cpu_${{ matrix.python-version }}_${{ matrix.cuda-tag }}.whl
path: fbgemm_gpu/dist/fbgemm_gpu_nightly_cpu-*.whl

- name: Install Dependencies
shell: bash
run: |
cd fbgemm_gpu/
conda run -n build_binary python -m pip install -r requirements.txt
- name: Test Installation of dependencies
run: |
cd fbgemm_gpu/
conda run -n build_binary python -c "import torch.distributed"
echo "torch.distributed succeeded"
conda run -n build_binary python -c "import skbuild"
echo "skbuild succeeded"
conda run -n build_binary python -c "import numpy"
echo "numpy succeeded"
- name: Install FBGEMM_GPU Nightly (CPU version)
run: |
conda run -n build_binary \
python -m pip install fbgemm_gpu/dist/fbgemm_gpu_nightly_cpu-*.whl
- name: Test fbgemm_gpu installation
shell: bash
run: |
conda run -n build_binary \
python -c "import fbgemm_gpu"
- name: Test with pytest
# remove this line when we fixed all the unit tests
continue-on-error: true
run: |
conda run -n build_binary \
python -m pip install pytest
# The tests with single CPU core on a less powerful testing GPU in GHA
# can take 5 hours.
timeout 600s conda run -n build_binary \
python -m pytest -v -s -W ignore::pytest.PytestCollectionWarning --continue-on-collection-errors
# Push to Pypi
- name: Push FBGEMM_GPU Binary to PYPI
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
conda run -n build_binary python -m pip install twine
# Official PYPI website
conda run -n build_binary \
python -m twine upload \
--username __token__ \
--password "$PYPI_TOKEN" \
fbgemm_gpu/dist/fbgemm_gpu_nightly_cpu-*.whl
Loading

0 comments on commit 5f5c368

Please sign in to comment.