Update gcc version for FBGEMM install in CI #9699
Workflow file for this run
This file contains 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 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: CPU Unit Test CI | |
on: | |
push: | |
paths-ignore: | |
- "docs/*" | |
- "third_party/*" | |
- .gitignore | |
- "*.md" | |
pull_request: | |
paths-ignore: | |
- "docs/*" | |
- "third_party/*" | |
- .gitignore | |
- "*.md" | |
jobs: | |
build_test: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: linux.2xlarge | |
python-version: 3.9 | |
python-tag: "py39" | |
- os: linux.2xlarge | |
python-version: '3.10' | |
python-tag: "py310" | |
- os: linux.2xlarge | |
python-version: '3.11' | |
python-tag: "py311" | |
- os: linux.2xlarge | |
python-version: '3.12' | |
python-tag: "py312" | |
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main | |
with: | |
runner: ${{ matrix.os }} | |
timeout: 15 | |
script: | | |
ldd --version | |
conda create -y --name build_binary python=${{ matrix.python-version }} | |
conda info | |
python --version | |
conda run -n build_binary python --version | |
echo "[INSTALL] Installing gcc..." | |
conda install -n build_binary -c conda-forge -y gxx_linux-64=11.4.0 sysroot_linux-64=2.17 | |
echo "[INSTALL] Setting the C/C++ compiler symlinks ..." | |
cc_path=$(conda run -n build_binary printenv CC) | |
cxx_path=$(conda run -n build_binary printenv CXX) | |
ln -sf "${cc_path}" "$(dirname "$cc_path")/cc" | |
ln -sf "${cc_path}" "$(dirname "$cc_path")/gcc" | |
ln -sf "${cxx_path}" "$(dirname "$cxx_path")/c++" | |
ln -sf "${cxx_path}" "$(dirname "$cxx_path")/g++" | |
conda_prefix=$(conda run -n build_binary printenv CONDA_PREFIX) | |
echo "[INSTALL] Enumerating libstdc++.so files ..." | |
all_libcxx_libs=$(find "${conda_prefix}/lib" -type f -name 'libstdc++.so*' -print | sort) | |
for f in $all_libcxx_libs; do | |
echo "$f"; | |
objdump -TC "$f" | grep GLIBCXX_ | sed 's/.*GLIBCXX_\([.0-9]*\).*/GLIBCXX_\1/g' | sort -Vu | cat | |
echo "" | |
done | |
echo "[INSTALL] Appending the Conda-installed libstdc++ to LD_PRELOAD ..." | |
current_value=$(conda run -n build_binary printenv LD_PRELOAD) | |
conda run -n build_binary \ | |
pip install torch --index-url https://download.pytorch.org/whl/nightly/cpu | |
conda run -n build_binary \ | |
python -c "import torch" | |
echo "torch succeeded" | |
conda run -n build_binary \ | |
python -c "import torch.distributed" | |
conda run -n build_binary \ | |
pip install fbgemm-gpu --index-url https://download.pytorch.org/whl/nightly/cpu | |
conda run -n build_binary \ | |
python -c "import fbgemm_gpu" | |
echo "fbgemm_gpu succeeded" | |
conda run -n build_binary \ | |
pip install -r requirements.txt | |
conda run -n build_binary \ | |
python setup.py bdist_wheel \ | |
--python-tag=${{ matrix.python-tag }} | |
conda run -n build_binary \ | |
python -c "import torchrec" | |
echo "torch.distributed succeeded" | |
conda run -n build_binary \ | |
python -c "import numpy" | |
echo "numpy succeeded" | |
conda install -n build_binary -y pytest | |
conda run -n build_binary \ | |
python -m pytest torchrec -v -s -W ignore::pytest.PytestCollectionWarning --continue-on-collection-errors \ | |
--ignore-glob=**/test_utils/ | |
echo "Starting C++ Tests" | |
conda install -n build_binary -c anaconda redis -y | |
conda run -n build_binary redis-server --daemonize yes | |
mkdir cpp-build | |
cd cpp-build | |
conda run -n build_binary cmake \ | |
-DBUILD_TEST=ON \ | |
-DBUILD_REDIS_IO=ON \ | |
-DCMAKE_PREFIX_PATH=/opt/conda/envs/build_binary/lib/python${{ matrix.python-version }}/site-packages/torch/share/cmake .. | |
conda run -n build_binary make -j | |
conda run -n build_binary ctest -V . |