Skip to content

Commit 91f17f9

Browse files
authored
Merge pull request #37 from ROCmSoftwarePlatform/IFU-2023-03-10
Ifu 2023 03 10
2 parents 9acabd0 + a25615e commit 91f17f9

40 files changed

+2109
-1379
lines changed

.github/scripts/setup_env.bash

Lines changed: 547 additions & 119 deletions
Large diffs are not rendered by default.

.github/workflows/fbgemm_docs.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
# This workflow builds the fbgemm_gpu docs and deploys them to gh-pages.
2-
name: Generate documentation
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
# This source code is licensed under the BSD-style license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
6+
name: FBGEMM Documentation
37
on:
48
push:
59
branches:

.github/workflows/fbgemm_gpu_ci.yml

Lines changed: 65 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ on:
1414
- main
1515

1616
jobs:
17-
build_nvidia_gpu:
18-
if: ${{ false }} # Disable the job for now
17+
build_and_test_amd:
1918
runs-on: ${{ matrix.os }}
2019
defaults:
2120
run:
@@ -24,13 +23,11 @@ jobs:
2423
PRELUDE: .github/scripts/setup_env.bash
2524
BUILD_ENV: build_binary
2625
strategy:
27-
# Don't fast-fail all the other builds if one of the them fails
2826
fail-fast: false
2927
matrix:
3028
os: [ ubuntu-20.04 ]
31-
python-version: [ "3.8" ]
32-
# As of version 2.0, PyTorch has dropped support for CUDA 11.6
33-
cuda-version: [ 11.7.1 ]
29+
python-version: [ "3.10" ]
30+
rocm-version: [ "5.3" ]
3431

3532
steps:
3633
- name: Checkout the Repository
@@ -41,120 +38,52 @@ jobs:
4138
- name: Display System Info
4239
run: . $PRELUDE; print_system_info
4340

41+
- name: Display GPU Info
42+
run: . $PRELUDE; print_gpu_info
43+
44+
- name: Free Disk Space
45+
run: . $PRELUDE; free_disk_space
46+
4447
- name: Setup Miniconda
4548
run: |
4649
. $PRELUDE; setup_miniconda $HOME/miniconda
4750
echo "${HOME}/miniconda/bin" >> $GITHUB_PATH
4851
echo "CONDA=${HOME}/miniconda" >> $GITHUB_PATH
4952
5053
- name: Create Conda Environment
51-
run: |
52-
. $PRELUDE
53-
create_conda_environment $BUILD_ENV ${{ matrix.python-version }}
54+
run: . $PRELUDE; create_conda_environment $BUILD_ENV ${{ matrix.python-version }}
5455

55-
# This hack is needed to get builds running properly on Ubuntu 20.04
56-
echo "[SETUP] Creating symlink \$CONDA_PREFIX/lib64 -> \$CONDA_PREFIX/lib ..."
57-
conda_prefix=$(conda run -n "${env_name}" printenv CONDA_PREFIX)
58-
ln -s "${conda_prefix}/lib" "${conda_prefix}/lib64"
59-
60-
# - name: Install C/C++ Compilers
61-
# run: . $PRELUDE; install_cxx_compiler $BUILD_ENV
56+
- name: Install ROCm
57+
run: . $PRELUDE; install_rocm_ubuntu $BUILD_ENV ${{ matrix.rocm-version }}
6258

6359
- name: Install Build Tools
6460
run: . $PRELUDE; install_build_tools $BUILD_ENV
6561

66-
- name: Install CUDA
67-
run: . $PRELUDE; install_cuda $BUILD_ENV "${{ matrix.cuda-version }}"
68-
69-
- name: Install PyTorch
70-
run: . $PRELUDE; install_pytorch_pip $BUILD_ENV nightly cuda "${{ matrix.cuda-version }}"
71-
72-
- name: Install cuDNN
73-
run: . $PRELUDE; install_cudnn $BUILD_ENV "$(pwd)/build_only/cudnn" "${{ matrix.cuda-version }}"
62+
- name: Install PyTorch-ROCm Nightly
63+
run: . $PRELUDE; install_pytorch_pip $BUILD_ENV nightly rocm ${{ matrix.rocm-version }}
7464

7565
- name: Prepare FBGEMM Build
7666
run: . $PRELUDE; cd fbgemm_gpu; prepare_fbgemm_gpu_build $BUILD_ENV
7767

78-
- name: Build and Install FBGEMM_GPU
79-
run: . $PRELUDE; cd fbgemm_gpu; build_fbgemm_gpu_install $BUILD_ENV
80-
81-
- name: Test FBGEMM_GPU installation
82-
shell: bash
83-
run: |
84-
. $PRELUDE;
85-
cd fbgemm_gpu/test
86-
print_exec conda run -n $BUILD_ENV python input_combine_test.py -v
87-
print_exec conda run -n $BUILD_ENV python quantize_ops_test.py -v
88-
print_exec conda run -n $BUILD_ENV python sparse_ops_test.py -v
89-
conda run -n $BUILD_ENV python -c "import fbgemm_gpu"
90-
conda run -n $BUILD_ENV python -c "import fbgemm_gpu.split_embedding_codegen_lookup_invokers"
91-
92-
build_amd_gpu:
93-
if: ${{ false }} # Disable the job for now
94-
runs-on: ${{ matrix.os }}
95-
strategy:
96-
matrix:
97-
os: [ubuntu-20.04]
98-
config: [[pip, 5.3]]
99-
100-
steps:
101-
- name: Free space
102-
run: sudo rm -rf /usr/local/android /usr/share/dotnet /usr/local/share/boost /opt/ghc /usr/local/share/chrom* /usr/share/swift /usr/local/julia* /usr/local/lib/android
103-
104-
- uses: actions/checkout@v3
105-
106-
- name: Install ROCm
107-
shell: bash
108-
run: |
109-
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
110-
wget https://repo.radeon.com/amdgpu-install/5.3/ubuntu/focal/amdgpu-install_5.3.50300-1_all.deb
111-
export DEBIAN_FRONTEND=noninteractive
112-
sudo apt install -y ./amdgpu-install_5.3.50300-1_all.deb
113-
amdgpu-install -y --usecase=hiplibsdk,rocm --no-dkms
114-
sudo rm amdgpu-install_5.3.50300-1_all.deb
115-
116-
- name: Install dependencies
117-
shell: bash
118-
run: |
119-
sudo apt-get update
120-
sudo apt-get install -y git pip python3-dev mesa-common-dev clang comgr libopenblas-dev jp intel-mkl-full locales libnuma-dev
121-
sudo apt-get install -y hipify-clang || true
122-
sudo apt-get install -y miopen-hip miopen-hip-dev
123-
sudo pip install cmake scikit-build ninja jinja2 numpy hypothesis --no-input
124-
sudo apt-get clean
125-
# Install PyTorch (nightly) as required by fbgemm_gpu
126-
sudo pip install --pre torch torchvision --extra-index-url https://download.pytorch.org/whl/nightly/rocm5.3/
127-
128-
- name: Checkout submodules
129-
shell: bash
68+
- name: Build FBGEMM_GPU-ROCM Nightly
13069
run: |
70+
. $PRELUDE
13171
cd fbgemm_gpu
132-
git submodule sync
133-
git submodule update --init --recursive
13472
135-
- name: Build fbgemm_gpu
136-
shell: bash
137-
run: |
138-
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
139-
cd fbgemm_gpu
140-
# build for MI250 only to save time.
141-
sudo PYTORCH_ROCM_ARCH=gfx90a python3 setup.py build develop
73+
# Build for MI250 only to save time.
74+
print_exec conda env config vars set -n $BUILD_ENV PYTORCH_ROCM_ARCH=gfx90a
75+
print_exec conda run -n $BUILD_ENV python setup.py build develop
76+
77+
- name: Test FBGEMM_GPU-ROCM Nightly installation
78+
timeout-minutes: 10
79+
run: . $PRELUDE; cd fbgemm_gpu/test; run_fbgemm_gpu_tests $BUILD_ENV rocm
14280

143-
- name: Test fbgemm_gpu installation
144-
shell: bash
145-
run: |
146-
cd fbgemm_gpu
147-
cd test
148-
python3 input_combine_test.py -v
149-
python3 quantize_ops_test.py -v
150-
python3 sparse_ops_test.py -v
151-
python3 -c "import fbgemm_gpu"
152-
python3 -c "import fbgemm_gpu.split_embedding_codegen_lookup_invokers"
15381

15482
test_amd_gpu:
15583
if: ${{ false }} # Disable the job for now
15684
runs-on: rocm
15785
strategy:
86+
fail-fast: false
15887
matrix:
15988
os: [ubuntu-latest]
16089

@@ -200,71 +129,54 @@ jobs:
200129
"
201130
docker run $DOCKER_OPTIONS $DOCKER_IMAGE $JENKINS_REPO_DIR_DOCKER/.jenkins/rocm/build_and_test.sh $JENKINS_REPO_DIR_DOCKER
202131
203-
test_nvidia_gpu:
204-
if: ${{ false }} # Disable the job for now
205-
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
206-
with:
207-
job-name: cuda 11.7, A10
208-
runner: linux.g5.4xlarge.nvidia.gpu # A10
209-
repository: pytorch/fbgemm
210-
gpu-arch-type: cuda
211-
gpu-arch-version: 11.7
212-
timeout: 150
213-
script: |
214-
set -x
215-
# Checkout FBGEMM_GPU
216-
git submodule update --init
217-
218-
# Build FBGEMM_GPU with pytorch-nightly
219-
CUDA_VERSION="11.7.1"
220-
PYTHON_VERSION="3.10"
221-
bash .github/scripts/build_wheel.bash -v -p "$PYTHON_VERSION" -o fbgemm_gpu_test -P pytorch-nightly -c "$CUDA_VERSION" -m /opt/conda
222-
223-
# Test FBGEMM_GPU using a generated wheel file
224-
WHEEL_PATH="$(ls fbgemm_gpu/dist/*.whl)"
225-
bash .github/scripts/test_wheel.bash -v -p "$PYTHON_VERSION" -P pytorch-nightly -c "$CUDA_VERSION" -w "$WHEEL_PATH" -m /opt/conda
226-
227-
build_cpu_only:
132+
133+
build_and_test_cpu:
228134
runs-on: ${{ matrix.os }}
135+
defaults:
136+
run:
137+
shell: bash
138+
env:
139+
PRELUDE: .github/scripts/setup_env.bash
140+
BUILD_ENV: build_binary
229141
strategy:
142+
fail-fast: false
230143
matrix:
231-
os: [ubuntu-latest]
144+
os: [ ubuntu-20.04, ubuntu-latest ]
145+
python-version: [ "3.8", "3.9", "3.10" ]
232146

233147
steps:
234-
- uses: actions/checkout@v3
148+
- name: Checkout the Repository
149+
uses: actions/checkout@v3
150+
with:
151+
submodules: true
235152

236-
- name: Install dependencies
237-
shell: bash
238-
run: |
239-
sudo apt-get update
240-
sudo apt-get -y install git pip python3-dev
241-
sudo pip install cmake scikit-build ninja jinja2 numpy hypothesis --no-input
242-
# Install PyTorch (nightly) as required by fbgemm_gpu
243-
sudo pip install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
153+
- name: Display System Info
154+
run: . $PRELUDE; print_system_info
244155

245-
- name: Checkout submodules
246-
shell: bash
247-
run: |
248-
cd fbgemm_gpu
249-
git submodule sync
250-
git submodule update --init --recursive
156+
- name: Display GPU Info
157+
run: . $PRELUDE; print_gpu_info
251158

252-
- name: Build fbgemm_gpu
253-
shell: bash
159+
- name: Setup Miniconda
254160
run: |
255-
cd fbgemm_gpu
256-
# to avoid "Permission denied" error in '/usr/local/lib/python3.8/dist-packages/' folder
257-
sudo python setup.py install --cpu_only
161+
. $PRELUDE; setup_miniconda $HOME/miniconda
162+
echo "${HOME}/miniconda/bin" >> $GITHUB_PATH
163+
echo "CONDA=${HOME}/miniconda" >> $GITHUB_PATH
258164
259-
- name: Test fbgemm_gpu cpu-only installation
260-
shell: bash
261-
run: |
262-
cd fbgemm_gpu
263-
cd test
264-
python batched_unary_embeddings_test.py -v
265-
python input_combine_test.py -v
266-
python layout_transform_ops_test.py -v
267-
python merge_pooled_embeddings_test.py -v
268-
python permute_pooled_embedding_modules_test.py -v
269-
python quantize_ops_test.py -v
270-
python sparse_ops_test.py -v
165+
- name: Create Conda Environment
166+
run: . $PRELUDE; create_conda_environment $BUILD_ENV ${{ matrix.python-version }}
167+
168+
- name: Install Build Tools
169+
run: . $PRELUDE; install_build_tools $BUILD_ENV
170+
171+
- name: Install PyTorch
172+
run: . $PRELUDE; install_pytorch_pip $BUILD_ENV nightly cpu
173+
174+
- name: Prepare FBGEMM Build
175+
run: . $PRELUDE; cd fbgemm_gpu; prepare_fbgemm_gpu_build $BUILD_ENV
176+
177+
- name: Build and Install FBGEMM_GPU (CPU version)
178+
run: . $PRELUDE; cd fbgemm_gpu; build_fbgemm_gpu_install $BUILD_ENV cpu
179+
180+
- name: Test with PyTest
181+
timeout-minutes: 10
182+
run: . $PRELUDE; cd fbgemm_gpu/test; run_fbgemm_gpu_tests $BUILD_ENV cpu

.github/workflows/pylint.yaml renamed to .github/workflows/fbgemm_gpu_lint.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
# This source code is licensed under the BSD-style license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
16
name: FBGEMM_GPU Lint
27

38
on:
@@ -8,36 +13,40 @@ on:
813
pull_request:
914
branches:
1015
- main
16+
1117
jobs:
12-
build:
18+
run_pylint:
1319
runs-on: ubuntu-latest
1420
strategy:
1521
matrix:
16-
python-version: ["3.8"]
22+
python-version: [ "3.8" ]
1723
steps:
1824
- uses: actions/checkout@v3
25+
1926
- name: Set up Python ${{ matrix.python-version }}
2027
uses: actions/setup-python@v2
2128
with:
2229
python-version: ${{ matrix.python-version }}
23-
- name: Install dependencies
30+
31+
- name: Install Dependencies
2432
run: |
2533
python -m pip install --upgrade pip
26-
pip install ufmt
27-
pip install click
28-
pip install flake8
34+
pip install click flake8 ufmt
35+
2936
- name: Analyzing the code with flake8
3037
run: |
3138
echo "::add-matcher::fbgemm_gpu/test/lint/flake8_problem_matcher.json"
3239
flake8 --ignore=E501,W503,E203 .
3340
# E501 = line too long
3441
# W503 = line break before binary operator (deprecated)
3542
# E203 = whitespace before ":"
43+
3644
- name: Analyzing the code with ufmt
3745
run: |
3846
ufmt diff fbgemm_gpu/fbgemm_gpu
3947
ufmt diff fbgemm_gpu/test
4048
ufmt diff fbgemm_gpu/bench
49+
4150
- name: Check Meta copyright header
4251
run: |
4352
python fbgemm_gpu/test/lint/check_meta_header.py --path=./fbgemm_gpu/fbgemm_gpu --fixit=False

0 commit comments

Comments
 (0)