Skip to content

Commit

Permalink
Merge pull request ROCm#30 from ROCmSoftwarePlatform/update-from-public
Browse files Browse the repository at this point in the history
Update from public repo 2022-08-02
  • Loading branch information
liligwu authored Aug 2, 2022
2 parents c6f77ae + a98d7f4 commit c377f98
Show file tree
Hide file tree
Showing 151 changed files with 11,675 additions and 3,154 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/fbgemm_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# This workflow builds the fbgemm_gpu docs and deploys them to gh-pages.
name: Generate documentation
on:
push:
branches:
- main
jobs:
build_docs_job:
runs-on: linux.2xlarge
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
# Update references
# TODO: update the git submodule sync after we fixed the auto-sync part
- name: Git Sumbodule Update
run: |
git submodule init
git submodule update --remote --recursive
git log
- 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
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=3.9
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: Test PyTorch Installation
run: |
conda run -n build_binary python -c "import torch.distributed"
echo "torch.distributed succeeded"
- name: Install fbgemm_gpu nightly
run: |
conda run -n build_binary python -m pip install fbgemm-gpu-nightly-cpu
- name: Test fbgemm_gpu installation
shell: bash
run: |
conda run -n build_binary \
python -c "import fbgemm_gpu"
- name: Install Doxygen
run: |
conda install -n build_binary -c conda-forge doxygen
which doxygen
- name: Build the docset
run: |
conda run -n build_binary python -m pip install -r fbgemm_gpu/docs/requirements.txt
cd ./fbgemm_gpu/docs
conda run -n build_binary doxygen Doxyfile.in
conda run -n build_binary make html
cd ..
- name: Get output time
run: echo "The time was ${{ steps.build.outputs.time }}"
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: fbgemm_gpu/docs/build/html # The folder the action should deploy.
2 changes: 2 additions & 0 deletions .github/workflows/fbgemm_nightly_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ jobs:
--python-tag=${{ matrix.python-tag }} \
-DTORCH_CUDA_ARCH_LIST="'7.0;8.0'" \
--plat-name=manylinux1_x86_64
ls -lt dist/*.whl
- name: Upload wheel as GHA artifact
uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -271,4 +272,5 @@ jobs:
--username __token__ \
--password "$PYPI_TOKEN" \
--skip-existing \
--verbose \
fbgemm_gpu_nightly-*.whl
2 changes: 2 additions & 0 deletions .github/workflows/fbgemm_nightly_build_cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ jobs:
--python-tag=${{ matrix.python-tag }} \
--cpu_only \
--plat-name=manylinux1_x86_64
ls -lt dist/*.whl
- name: Upload wheel as GHA artifact
uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -156,4 +157,5 @@ jobs:
--username __token__ \
--password "$PYPI_TOKEN" \
--skip-existing \
--verbose \
fbgemm_gpu/dist/fbgemm_gpu_nightly_cpu-*.whl
2 changes: 2 additions & 0 deletions .github/workflows/fbgemm_release_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ jobs:
--python-tag=${{ matrix.python-tag }} \
-DTORCH_CUDA_ARCH_LIST="'7.0;8.0'" \
--plat-name=manylinux1_x86_64
ls -lt dist/*.whl
- name: Upload wheel as GHA artifact
uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -273,4 +274,5 @@ jobs:
--username __token__ \
--password "$PYPI_TOKEN" \
--skip-existing \
--verbose \
fbgemm_gpu-*.whl
2 changes: 2 additions & 0 deletions .github/workflows/fbgemm_release_build_cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ jobs:
--python-tag=${{ matrix.python-tag }} \
--cpu_only \
--plat-name=manylinux1_x86_64
ls -lt dist/*.whl
- name: Upload wheel as GHA artifact
uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -158,4 +159,5 @@ jobs:
--username __token__ \
--password "$PYPI_TOKEN" \
--skip-existing \
--verbose \
fbgemm_gpu/dist/fbgemm_gpu_cpu-*.whl
107 changes: 107 additions & 0 deletions .github/workflows/fbgemmci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,113 @@ jobs:
python -c "import fbgemm_gpu"
python -c "import fbgemm_gpu.split_embedding_codegen_lookup_invokers"
build_amd_gpu:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]

steps:
- name: Free space
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

- uses: actions/checkout@v2

- name: Install ROCm 5.1.1
shell: bash
run: |
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
wget https://repo.radeon.com/amdgpu-install/22.10.1/ubuntu/focal/amdgpu-install_22.10.1.50101-1_all.deb
export DEBIAN_FRONTEND=noninteractive
sudo apt install -y ./amdgpu-install_22.10.1.50101-1_all.deb
amdgpu-install -y --usecase=hiplibsdk,rocm --no-dkms
sudo rm amdgpu-install_22.10.1.50101-1_all.deb
- name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get -y install git pip python3-dev mesa-common-dev clang comgr libopenblas-dev jp intel-mkl-full locales libnuma-dev
sudo apt-get install -y hipify-clang || true
sudo pip install cmake scikit-build ninja jinja2 numpy hypothesis --no-input
sudo apt-get clean
# Install pytorch 1.11 as required by fbgemm_gpu
sudo pip install --pre torch torchvision --extra-index-url https://download.pytorch.org/whl/nightly/rocm5.1.1/
- name: Checkout submodules
shell: bash
run: |
cd fbgemm_gpu
git submodule sync
git submodule update --init --recursive
- name: Build fbgemm_gpu
shell: bash
run: |
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
cd fbgemm_gpu
# build for MI250 only to save time.
sudo PYTORCH_ROCM_ARCH=gfx90a python3 setup.py build develop
- name: Test fbgemm_gpu installation
shell: bash
run: |
cd fbgemm_gpu
cd test
python3 input_combine_test.py
python3 quantize_ops_test.py
python3 sparse_ops_test.py
python3 -c "import fbgemm_gpu"
python3 -c "import fbgemm_gpu.split_embedding_codegen_lookup_invokers"
test_amd_gpu:
runs-on: rocm
strategy:
matrix:
os: [ubuntu-latest]

steps:
- name: pre-checkout
shell: bash
run: |
if [ -d ${{ github.workspace }} ]
then
sudo chown -R $USER:$USER ${{ github.workspace }}
fi
sudo add-apt-repository ppa:git-core/ppa
sudo apt update
sudo apt -y install --only-upgrade git
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
submodules: 'true'

- name: build fbgemm_gpu and test
shell: bash
run: |
set -eux
env
ls -l
DOCKER_IMAGE=rocm/pytorch:rocm5.1.1_ubuntu20.04_py3.7_pytorch_staging_base
docker pull $DOCKER_IMAGE
JENKINS_REPO_DIR=fbgemm-private-jenkins
JENKINS_REPO_DIR_BAREMETAL=$PWD
JENKINS_REPO_DIR_DOCKER=/workspace/$JENKINS_REPO_DIR
DOCKER_OPTIONS="\
--user 0 \
--network=host \
--ipc=host \
--shm-size 16G \
--group-add video \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
--device=/dev/kfd \
--device=/dev/dri \
-v $JENKINS_REPO_DIR_BAREMETAL:$JENKINS_REPO_DIR_DOCKER
"
docker run $DOCKER_OPTIONS $DOCKER_IMAGE $JENKINS_REPO_DIR_DOCKER/.jenkins/rocm/build_and_test.sh $JENKINS_REPO_DIR_DOCKER
build_cpu_only:
runs-on: ${{ matrix.os }}
strategy:
Expand Down
58 changes: 58 additions & 0 deletions .jenkins/rocm/build_and_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

# exit immediately on failure, or if an undefined variable is used
set -eux

FBGEMM_REPO_DIR=${1:-/workspace/FBGEMM}

git config --global --add safe.directory "$FBGEMM_REPO_DIR"
git config --global --add safe.directory "$FBGEMM_REPO_DIR/third_party/asmjit"
git config --global --add safe.directory "$FBGEMM_REPO_DIR/third_party/cpuinfo"
git config --global --add safe.directory "$FBGEMM_REPO_DIR/third_party/googletest"
git config --global --add safe.directory "$FBGEMM_REPO_DIR/third_party/hipify_torch"

# Install dependencies
apt-get update --allow-insecure-repositories && \
apt-get install -y --allow-unauthenticated \
git \
jq \
sshfs \
sshpass \
unzip

apt-get install -y locales
locale-gen en_US.UTF-8

pip3 install click
pip3 install jinja2
pip3 install ninja
pip3 install scikit-build
pip3 install --upgrade hypothesis
pip3 install --pre torch torchvision --extra-index-url https://download.pytorch.org/whl/nightly/rocm5.1.1/

pip3 list

# Build fbgemm_gpu
cd "$FBGEMM_REPO_DIR/fbgemm_gpu"
MAX_JOBS="$(nproc)"
export MAX_JOBS
export PYTORCH_ROCM_ARCH="gfx908"
python setup.py build develop

export FBGEMM_TEST_WITH_ROCM=1

# Test fbgemm_gpu
cd test

python batched_unary_embeddings_test.py --verbose
python input_combine_test.py --verbose
python jagged_tensor_ops_test.py --verbose
python layout_transform_ops_test.py --verbose
python merge_pooled_embeddings_test.py --verbose
python metric_ops_test.py --verbose
python permute_pooled_embedding_modules_test.py --verbose
python quantize_ops_test.py --verbose
python sparse_ops_test.py --verbose
python split_embedding_inference_converter_test.py --verbose
python split_table_batched_embeddings_test.py --verbose
python uvm_test.py --verbose
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ if(NOT TARGET asmjit)

add_subdirectory("${ASMJIT_SRC_DIR}" "${FBGEMM_BINARY_DIR}/asmjit")
set_property(TARGET asmjit PROPERTY POSITION_INDEPENDENT_CODE ON)
# add a flag required for mac build
if(NOT MSVC)
target_compile_options(asmjit PRIVATE "-Wno-sign-conversion")
endif()
endif()

if(NOT TARGET cpuinfo)
Expand Down Expand Up @@ -293,6 +297,10 @@ endif()

if(FBGEMM_BUILD_BENCHMARKS)
add_subdirectory(bench)
# add a flag to enable Clang 14
set_source_files_properties(
bench/GEMMsBenchmark.cc
PROPERTIES COMPILE_FLAGS "-Wno-unused-variable")
endif()

if(FBGEMM_BUILD_DOCS)
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ cd FBGEMM
# if you are updating an existing checkout
git submodule sync
git submodule update --init --recursive
mkdir build && cd build
cmake ..
make
cmake -B build
make -C build
```

To run the tests after building FBGEMM (if tests are built), use the following
Expand Down
Loading

0 comments on commit c377f98

Please sign in to comment.