From 0df17c3c6d285d49f934a2c2f751288b9e13b7ef Mon Sep 17 00:00:00 2001 From: Benson Ma Date: Thu, 15 Aug 2024 11:14:19 -0700 Subject: [PATCH] [fbgemm_gpu] Deprecate Python 3.8 builds - Deprecate Python 3.8 builds as Python 3.8 has been deprecated from PyTorch builds since 2024-07-31 - Clarify module load errors in OSS --- .github/scripts/fbgemm_gpu_install.bash | 2 ++ .github/scripts/fbgemm_gpu_test.bash | 1 - .github/workflows/fbgemm_gpu_ci_cpu.yml | 4 +-- .github/workflows/fbgemm_gpu_ci_cuda.yml | 4 +-- .github/workflows/fbgemm_gpu_ci_genai.yml | 4 +-- .github/workflows/fbgemm_gpu_ci_rocm.yml | 2 +- .github/workflows/fbgemm_gpu_pip.yml | 10 ++++++-- .github/workflows/fbgemm_gpu_release_cpu.yml | 4 +-- .github/workflows/fbgemm_gpu_release_cuda.yml | 4 +-- .../workflows/fbgemm_gpu_release_genai.yml | 4 +-- fbgemm_gpu/fbgemm_gpu/__init__.py | 25 +++++++++---------- fbgemm_gpu/setup.py | 2 +- 12 files changed, 36 insertions(+), 30 deletions(-) diff --git a/.github/scripts/fbgemm_gpu_install.bash b/.github/scripts/fbgemm_gpu_install.bash index 61678c84fc..ff7834602f 100644 --- a/.github/scripts/fbgemm_gpu_install.bash +++ b/.github/scripts/fbgemm_gpu_install.bash @@ -68,7 +68,9 @@ __install_check_subpackages () { echo "[INSTALL] Check for installation of Python sources ..." local subpackages=( + "fbgemm_gpu.config" "fbgemm_gpu.docs" + "fbgemm_gpu.quantize" "fbgemm_gpu.tbe.cache" ) diff --git a/.github/scripts/fbgemm_gpu_test.bash b/.github/scripts/fbgemm_gpu_test.bash index adb2342462..757b1c43ec 100644 --- a/.github/scripts/fbgemm_gpu_test.bash +++ b/.github/scripts/fbgemm_gpu_test.bash @@ -460,7 +460,6 @@ test_fbgemm_gpu_setup_and_pip_install () { } local python_versions=( - 3.8 3.9 3.10 3.11 diff --git a/.github/workflows/fbgemm_gpu_ci_cpu.yml b/.github/workflows/fbgemm_gpu_ci_cpu.yml index 1df50be75b..1867410cc4 100644 --- a/.github/workflows/fbgemm_gpu_ci_cpu.yml +++ b/.github/workflows/fbgemm_gpu_ci_cpu.yml @@ -67,7 +67,7 @@ jobs: { arch: x86, instance: "linux.4xlarge" }, { arch: arm, instance: "linux.arm64.2xlarge" }, ] - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] compiler: [ "gcc", "clang" ] steps: @@ -136,7 +136,7 @@ jobs: { arch: x86, instance: "linux.4xlarge", timeout: 20 }, { arch: arm, instance: "linux.arm64.2xlarge", timeout: 30 }, ] - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] compiler: [ "gcc", "clang" ] needs: build_artifact diff --git a/.github/workflows/fbgemm_gpu_ci_cuda.yml b/.github/workflows/fbgemm_gpu_ci_cuda.yml index 45957afc7b..c4e4990890 100644 --- a/.github/workflows/fbgemm_gpu_ci_cuda.yml +++ b/.github/workflows/fbgemm_gpu_ci_cuda.yml @@ -65,7 +65,7 @@ jobs: host-machine: [ { arch: x86, instance: "linux.24xlarge" }, ] - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] cuda-version: [ "11.8.0", "12.1.1", "12.4.1" ] compiler: [ "gcc", "clang" ] @@ -147,7 +147,7 @@ jobs: # https://hud.pytorch.org/metrics # { arch: x86, instance: "linux.gcp.a100" }, ] - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] cuda-version: [ "11.8.0", "12.1.1", "12.4.1" ] # Specify exactly ONE CUDA version for artifact publish cuda-version-publish: [ "12.1.1" ] diff --git a/.github/workflows/fbgemm_gpu_ci_genai.yml b/.github/workflows/fbgemm_gpu_ci_genai.yml index 7ce15ce519..07f8f80595 100644 --- a/.github/workflows/fbgemm_gpu_ci_genai.yml +++ b/.github/workflows/fbgemm_gpu_ci_genai.yml @@ -65,7 +65,7 @@ jobs: host-machine: [ { arch: x86, instance: "linux.24xlarge" }, ] - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] cuda-version: [ "11.8.0", "12.1.1", "12.4.1" ] compiler: [ "gcc", "clang" ] @@ -147,7 +147,7 @@ jobs: # https://hud.pytorch.org/metrics # { arch: x86, instance: "linux.gcp.a100" }, ] - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] cuda-version: [ "11.8.0", "12.1.1", "12.4.1" ] # Specify exactly ONE CUDA version for artifact publish cuda-version-publish: [ "12.1.1" ] diff --git a/.github/workflows/fbgemm_gpu_ci_rocm.yml b/.github/workflows/fbgemm_gpu_ci_rocm.yml index b378c2821f..27788f92c1 100644 --- a/.github/workflows/fbgemm_gpu_ci_rocm.yml +++ b/.github/workflows/fbgemm_gpu_ci_rocm.yml @@ -64,7 +64,7 @@ jobs: { arch: x86, instance: "linux.24xlarge" }, ] container-image: [ "ubuntu:20.04" ] - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] rocm-version: [ "6.0.2" ] compiler: [ "gcc", "clang" ] diff --git a/.github/workflows/fbgemm_gpu_pip.yml b/.github/workflows/fbgemm_gpu_pip.yml index f0c07ced3e..6da63fe724 100644 --- a/.github/workflows/fbgemm_gpu_pip.yml +++ b/.github/workflows/fbgemm_gpu_pip.yml @@ -8,6 +8,12 @@ name: FBGEMM_GPU PIP Install + Test on: + # PR Trigger (enabled for regression checks and debugging) + # + pull_request: + branches: + - main + # Cron Trigger (UTC) # # Based on the the nightly releases schedule in PyTorch infrastructure, the @@ -64,7 +70,7 @@ jobs: { arch: x86, instance: "linux.4xlarge", timeout: 20 }, { arch: arm, instance: "linux.arm64.2xlarge", timeout: 30 }, ] - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] steps: - name: Setup Build Container @@ -120,7 +126,7 @@ jobs: host-machine: [ { instance: "linux.g5.4xlarge.nvidia.gpu" }, ] - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] cuda-version: [ "11.8.0", "12.1.1", "12.4.1" ] steps: diff --git a/.github/workflows/fbgemm_gpu_release_cpu.yml b/.github/workflows/fbgemm_gpu_release_cpu.yml index 1bb2038cd6..51e4a9bec1 100644 --- a/.github/workflows/fbgemm_gpu_release_cpu.yml +++ b/.github/workflows/fbgemm_gpu_release_cpu.yml @@ -64,7 +64,7 @@ jobs: { arch: x86, instance: "linux.4xlarge" }, { arch: arm, instance: "linux.arm64.2xlarge" }, ] - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] steps: - name: Setup Build Container @@ -132,7 +132,7 @@ jobs: { arch: x86, instance: "linux.4xlarge", timeout: 20 }, { arch: arm, instance: "linux.arm64.2xlarge", timeout: 30 }, ] - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] needs: build_artifact steps: diff --git a/.github/workflows/fbgemm_gpu_release_cuda.yml b/.github/workflows/fbgemm_gpu_release_cuda.yml index cbe5f9c1a4..9b242950e8 100644 --- a/.github/workflows/fbgemm_gpu_release_cuda.yml +++ b/.github/workflows/fbgemm_gpu_release_cuda.yml @@ -69,7 +69,7 @@ jobs: host-machine: [ { arch: x86, instance: "linux.24xlarge" }, ] - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] cuda-version: [ "11.8.0", "12.1.1", "12.4.1" ] steps: @@ -141,7 +141,7 @@ jobs: host-machine: [ { arch: x86, instance: "linux.g5.4xlarge.nvidia.gpu" }, ] - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] cuda-version: [ "11.8.0", "12.1.1", "12.4.1" ] needs: build_artifact diff --git a/.github/workflows/fbgemm_gpu_release_genai.yml b/.github/workflows/fbgemm_gpu_release_genai.yml index 14d744d620..33fca1f640 100644 --- a/.github/workflows/fbgemm_gpu_release_genai.yml +++ b/.github/workflows/fbgemm_gpu_release_genai.yml @@ -69,7 +69,7 @@ jobs: host-machine: [ { arch: x86, instance: "linux.24xlarge" }, ] - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] cuda-version: [ "11.8.0", "12.1.1", "12.4.1" ] steps: @@ -141,7 +141,7 @@ jobs: host-machine: [ { arch: x86, instance: "linux.g5.4xlarge.nvidia.gpu" }, ] - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] cuda-version: [ "11.8.0", "12.1.1", "12.4.1" ] needs: build_artifact diff --git a/fbgemm_gpu/fbgemm_gpu/__init__.py b/fbgemm_gpu/fbgemm_gpu/__init__.py index ab20e533c1..201848428c 100644 --- a/fbgemm_gpu/fbgemm_gpu/__init__.py +++ b/fbgemm_gpu/fbgemm_gpu/__init__.py @@ -5,24 +5,23 @@ # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. +import logging import os import torch -try: - torch.ops.load_library(os.path.join(os.path.dirname(__file__), "fbgemm_gpu_py.so")) -except Exception as error_ranking: +def _load_library(filename: str) -> None: + """Load a shared library from the given filename.""" try: - torch.ops.load_library( - os.path.join( - os.path.dirname(__file__), - "experimental/gen_ai/fbgemm_gpu_experimental_gen_ai_py.so", - ) - ) - except Exception as error_gen_ai: - # When both ranking/gen_ai so files are not available, print the error logs - print(error_ranking) - print(error_gen_ai) + torch.ops.load_library(os.path.join(os.path.dirname(__file__), filename)) + except Exception as error: + logging.warning(f"Could not the library '{filename}': {error}. This may be expected depending on the FBGEMM_GPU variant.") + +for filename in [ + "fbgemm_gpu_py.so", + "experimental/gen_ai/fbgemm_gpu_experimental_gen_ai_py.so", +]: + _load_library(filename) # Since __init__.py is only used in OSS context, we define `open_source` here # and use its existence to determine whether or not we are in OSS context diff --git a/fbgemm_gpu/setup.py b/fbgemm_gpu/setup.py index c8cdf114d4..6da8c3b2e8 100644 --- a/fbgemm_gpu/setup.py +++ b/fbgemm_gpu/setup.py @@ -547,7 +547,7 @@ def main(argv: List[str]) -> None: ] + [ f"Programming Language :: Python :: {x}" - for x in ["3", "3.8", "3.9", "3.10", "3.11", "3.12"] + for x in ["3", "3.9", "3.10", "3.11", "3.12"] ], )