Skip to content

Commit

Permalink
Fix pip install test workflows (#3542)
Browse files Browse the repository at this point in the history
Summary:
X-link: facebookresearch/FBGEMM#630

- Fix pip install test workflows

Pull Request resolved: #3542

Reviewed By: sryap

Differential Revision: D67817349

Pulled By: q10

fbshipit-source-id: 27ffce0b43666df34c8d6c1bf86717abeaf07366
  • Loading branch information
q10 authored and facebook-github-bot committed Jan 5, 2025
1 parent 8e0e531 commit fd04e6a
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/fbgemm_gpu_install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ install_fbgemm_gpu_pip () {
echo "Usage: ${FUNCNAME[0]} ENV_NAME FBGEMM_GPU_CHANNEL[/VERSION] FBGEMM_GPU_VARIANT_TYPE[/VARIANT_VERSION]"
echo "Example(s):"
echo " ${FUNCNAME[0]} build_env 0.8.0 cpu # Install the CPU variant, specific version from release channel"
echo " ${FUNCNAME[0]} build_env release cuda/12.4.1 # Install the CUDA variant, latest version from release channel"
echo " ${FUNCNAME[0]} build_env test/0.8.0 cuda/12.4.1 # Install the CUDA 12.4 variant, specific version from test channel"
echo " ${FUNCNAME[0]} build_env release cuda/12.6.3 # Install the CUDA 12.3 variant, latest version from release channel"
echo " ${FUNCNAME[0]} build_env test/0.8.0 cuda/12.6.3 # Install the CUDA 12.3 variant, specific version from test channel"
echo " ${FUNCNAME[0]} build_env nightly rocm/6.2 # Install the ROCM 6.2 variant, latest version from nightly channel"
return 1
else
Expand Down
18 changes: 8 additions & 10 deletions .github/scripts/fbgemm_gpu_test.bash
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@ test_setup_conda_environment () {
local pytorch_channel_version="$5"
local pytorch_variant_type="$6"
local pytorch_variant_version="$7"
if [ "$pytorch_variant_type" == "" ]; then
echo "Usage: ${FUNCNAME[0]} ENV_NAME COMPILER PYTHON_VERSION PYTORCH_INSTALLER PYTORCH_CHANNEL[/VERSION] PYTORCH_VARIANT_TYPE [PYTORCH_VARIANT_VERSION]"
if [ "$pytorch_variant_version" == "" ]; then
echo "Usage: ${FUNCNAME[0]} ENV_NAME COMPILER PYTHON_VERSION PYTORCH_INSTALLER PYTORCH_CHANNEL[/VERSION] PYTORCH_VARIANT_TYPE PYTORCH_VARIANT_VERSION"
echo "Example(s):"
echo " ${FUNCNAME[0]} build_env clang 3.13 pip test/1.0.0 cuda 12.4.1 # Setup environment with pytorch-test 1.0.0 for Clang + Python 3.13 + CUDA 12.4.1"
echo " ${FUNCNAME[0]} build_env clang 3.13 pip test/1.0.0 cuda 12.6.3 # Setup environment with pytorch-test 1.0.0 for Clang + Python 3.13 + CUDA 12.6.3"
return 1
else
echo "################################################################################"
Expand All @@ -350,16 +350,13 @@ test_setup_conda_environment () {
echo ""
fi

if [ "$env_name" == "" ]; then
local env_name="test_py${python_version}_${pytorch_installer}_pytorch_${pytorch_channel_version}_${pytorch_variant_type}"
if [ "$pytorch_variant_version" != "" ]; then
local env_name="${env_name}_${pytorch_variant_version}"
fi
fi

echo "Creating the Build Environment: ${env_name} ..."
create_conda_environment "${env_name}" "${python_version}" || return 1

if [ "$pytorch_variant_type" == "cuda" ] || [ "$pytorch_variant_type" == "genai" ]; then
print_exec conda env config vars set -n "${env_name}" BUILD_CUDA_VERSION="${pytorch_variant_version}"
fi

# Install C++ compiler and build tools (all FBGEMM_GPU variants)
if [ "$compiler" == "gcc" ] || [ "$compiler" == "clang" ]; then
install_cxx_compiler "${env_name}" "${compiler}" || return 1
Expand Down Expand Up @@ -503,6 +500,7 @@ test_fbgemm_gpu_setup_and_pip_install () {
local variant_versions=(
11.8.0
12.4.1
12.6.3
)
elif [ "$variant_type" == "rocm" ]; then
local variant_versions=(
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/test_torchrec.bash
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ setup_miniconda "$miniconda_prefix"
echo "## 2. Create Conda environment"
################################################################################

if [ "${cuda_version}" == "" ]; then
if [ "${cuda_version}" != "" ]; then
pytorch_variant="cuda ${cuda_version}"
else
pytorch_variant="cpu"
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/utils_build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ install_build_tools () {
local conda_prefix=$(conda run ${env_prefix} printenv CONDA_PREFIX)
(print_exec ln -s "${conda_prefix}/lib/librhash.so" "${conda_prefix}/lib/librhash.so.0") || return 1

# For some reason, the build package for Python 3.12 is missing from Conda, so
# we have to install through PyPI instead.
# For some reason, the build package for Python 3.12+ is missing from conda,
# so we have to install through pip instead.
#
# LibMambaUnsatisfiableError: Encountered problems while solving:
# - package build-0.10.0-py310h06a4308_0 requires python >=3.10,<3.11.0a0, but none of the providers can be installed
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fbgemm_gpu_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.12" ]
python-version: [ "3.13" ]

steps:
- name: Setup Build Container
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/fbgemm_gpu_pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ on:
workflow_dispatch:
inputs:
pytorch_version:
description: PyTorch Version (e.g. '2.1.0', 'nightly', 'test')
description: PyTorch Version (e.g. '2.6.0', 'nightly', 'test')
type: string
required: true
default: "nightly"
fbgemm_gpu_channel_version:
description: FBGEMM-GPU Channel + Version (e.g. '0.5.0', 'nightly', 'test/0.8.0r0')
description: FBGEMM-GPU Channel + Version (e.g. '1.1.0', 'nightly', 'test/1.0.0r1')
type: string
required: true
default: "nightly"
Expand Down Expand Up @@ -85,6 +85,9 @@ jobs:
- name: Create Conda Environment
run: . $PRELUDE; create_conda_environment $BUILD_ENV ${{ matrix.python-version }}

- name: Install C/C++ Compilers for Updated LIBGCC
run: . $PRELUDE; install_cxx_compiler $BUILD_ENV ${{ matrix.compiler }}

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

Expand Down Expand Up @@ -113,6 +116,7 @@ jobs:
PRELUDE: .github/scripts/setup_env.bash
BUILD_ENV: test_install
BUILD_VARIANT: cuda
BUILD_CUDA_VERSION: ${{ matrix.cuda-version }}
ENFORCE_CUDA_DEVICE: 1
strategy:
fail-fast: false
Expand Down Expand Up @@ -143,6 +147,13 @@ jobs:
- name: Create Conda Environment
run: . $PRELUDE; create_conda_environment $BUILD_ENV ${{ matrix.python-version }}

- name: Install C/C++ Compilers for Updated LIBGCC
# NOTE: gcc is required for torch dynamo to work properly, as some of
# the compilation flags used by torch dynamo are gcc-specific:
#
# clang-16: error: unknown argument: '-fno-tree-loop-vectorize'
run: . $PRELUDE; install_cxx_compiler $BUILD_ENV gcc

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

Expand Down Expand Up @@ -213,6 +224,9 @@ jobs:
- name: Create Conda Environment
run: . $PRELUDE; create_conda_environment $BUILD_ENV ${{ matrix.python-version }}

- name: Install ROCm AMD-SMI
run: . $PRELUDE; install_rocm_amdsmi_ubuntu $BUILD_ENV

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

Expand Down
8 changes: 0 additions & 8 deletions cmake/modules/CxxCompilerSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ endif()
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_C_STANDARD_REQUIRED ON)

if(DEFINED GLIBCXX_USE_CXX11_ABI)
if(${GLIBCXX_USE_CXX11_ABI} EQUAL 1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=1")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
endif()

BLOCK_PRINT(
"Default C compiler flags"
"(values may be overridden by CMAKE_CXX_STANDARD and CXX_STANDARD):"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ older than the one that the FBGEMM release corresponds to.
| FBGEMM Release | Corresponding | Supported | Supported | (Experimental) Supported |
| | PyTorch Release | Python Versions | CUDA Versions | ROCm Versions |
+=================+==================+==================+================+===========================+
| 1.1.0 | 2.6.x | 3.9, 3.10, 3.11, | 11.8, 12.4 | 6.0, 6.1 |
| | | 3.12, 3.13 | | |
| 1.1.0 | 2.6.x | 3.9, 3.10, 3.11, | 11.8, 12.4, | 6.0, 6.1 |
| | | 3.12, 3.13 | 12.6 | |
+-----------------+------------------+------------------+----------------+---------------------------+
| 1.0.0 | 2.5.x | 3.9, 3.10, 3.11, | 11.8, 12.1, | 6.0, 6.1 |
| | | 3.12 | 12.4 | |
Expand Down
4 changes: 3 additions & 1 deletion fbgemm_gpu/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ def _get_cxx11_abi():
value = int(torch._C._GLIBCXX_USE_CXX11_ABI)
except ImportError:
value = 0
return "-DGLIBCXX_USE_CXX11_ABI=" + str(value)
# NOTE: The correct spelling for the flag is
# `_GLIBCXX_USE_CXX11_ABI`, not `GLIBCXX_USE_CXX11_ABI`
return f"-D_GLIBCXX_USE_CXX11_ABI={value}"

torch_root = os.path.dirname(torch.__file__)
os.environ["CMAKE_BUILD_PARALLEL_LEVEL"] = str(os.cpu_count() // 2)
Expand Down
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Set up Conda environment
setup_miniconda $HOME/miniconda
create_conda_environment $BUILD_ENV 3.12
create_conda_environment $BUILD_ENV 3.13
# Install tools
install_cxx_compiler $BUILD_ENV
Expand Down

0 comments on commit fd04e6a

Please sign in to comment.