From 271d10aec77fcfce9e3769a5482fa852f3d92fc9 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Tue, 27 Jun 2023 10:53:20 +0200 Subject: [PATCH 01/31] First take on a pip install script --- .github/workflows/ci.yml | 10 +++ pyproject.toml | 10 +++ setup.py | 172 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 192 insertions(+) create mode 100644 pyproject.toml create mode 100644 setup.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 760f69b..3561eb3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -129,3 +129,13 @@ jobs: conda activate nnpops cd build ctest --verbose --exclude-regex TestCuda + + - name: Pip build (without CUDA) + if: ${{ !matrix.enable_cuda }} + run: | + pip -vvv wheel --wheel-dir=$(pwd) nnpops --extra-index-url https://download.pytorch.org/whl/cpu + - name: Pip build (with CUDA) + if: ${{ matrix.enable_cuda }} + run: | + ENABLE_CUDA=ON pip -vvv wheel --wheel-dir=$(pwd) nnpops + diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..bf7ea6e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,10 @@ +[build-system] +requires = [ + "setuptools>=42", + "wheel", + "ninja", + "cmake>=3.23", + "torch>=1.12", + "GitPython" +] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..cbfab87 --- /dev/null +++ b/setup.py @@ -0,0 +1,172 @@ +import os +import re +import subprocess +import sys +from pathlib import Path +import git +from setuptools import Extension, setup +from setuptools.command.build_ext import build_ext +import torch + +from typing import Optional +# Convert distutils Windows platform specifiers to CMake -A arguments +PLAT_TO_CMAKE = { + "win32": "Win32", + "win-amd64": "x64", + "win-arm32": "ARM", + "win-arm64": "ARM64", +} + +# A CMakeExtension needs a sourcedir instead of a file list. +# The name must be the _single_ output extension from the CMake build. +# If you need multiple extensions, see scikit-build. +class CMakeExtension(Extension): + def __init__(self, name: str, sourcedir: str = "", extra_args: Optional[dict[str, str]] = None) -> None: + super().__init__(name, sources=[]) + self.sourcedir = os.fspath(Path(sourcedir).resolve()) + #Store a list of extra arguments to pass to CMake, prepend -D to each + self.extra_args = extra_args + self.extra_args = ([f"-D{key}={value}" for key, value in extra_args.items()] if extra_args else [""]) + + + +class CMakeBuild(build_ext): + def build_extension(self, ext: CMakeExtension) -> None: + # Must be in this form due to bug in .resolve() only fixed in Python 3.10+ + ext_fullpath = Path.cwd() / self.get_ext_fullpath(ext.name) + extdir = ext_fullpath.parent.resolve() + + # Using this requires trailing slash for auto-detection & inclusion of + # auxiliary "native" libs + + debug = int(os.environ.get("DEBUG", 0)) if self.debug is None else self.debug + cfg = "Debug" if debug else "Release" + + # CMake lets you override the generator - we need to check this. + # Can be set with Conda-Build, for example. + cmake_generator = os.environ.get("CMAKE_GENERATOR", "make") + + # Set Python_EXECUTABLE instead if you use PYBIND11_FINDPYTHON + # EXAMPLE_VERSION_INFO shows you how to pass a value into the C++ code + # from Python. + cmake_args = [ + f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}{os.sep}", + f"-DPYTHON_EXECUTABLE={sys.executable}", + f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm + ] + build_args = [] + # Adding CMake arguments set as environment variable + # (needed e.g. to build for ARM OSx on conda-forge) + if "CMAKE_ARGS" in os.environ: + cmake_args += [item for item in os.environ["CMAKE_ARGS"].split(" ") if item] + + # In this example, we pass in the version to C++. You might not need to. + cmake_args += [f"-DEXAMPLE_VERSION_INFO={self.distribution.get_version()}"] + + if self.compiler.compiler_type != "msvc": + # Using Ninja-build since it a) is available as a wheel and b) + # multithreads automatically. MSVC would require all variables be + # exported for Ninja to pick it up, which is a little tricky to do. + # Users can override the generator with CMAKE_GENERATOR in CMake + # 3.15+. + if not cmake_generator or cmake_generator == "Ninja": + try: + import ninja + + ninja_executable_path = Path(ninja.BIN_DIR) / "ninja" + cmake_args += [ + "-GNinja", + f"-DCMAKE_MAKE_PROGRAM:FILEPATH={ninja_executable_path}", + ] + except ImportError: + pass + + else: + # Single config generators are handled "normally" + single_config = any(x in cmake_generator for x in {"NMake", "Ninja"}) + + # CMake allows an arch-in-generator style for backward compatibility + contains_arch = any(x in cmake_generator for x in {"ARM", "Win64"}) + + # Specify the arch if using MSVC generator, but only if it doesn't + # contain a backward-compatibility arch spec already in the + # generator name. + if not single_config and not contains_arch: + cmake_args += ["-A", PLAT_TO_CMAKE[self.plat_name]] + + # Multi-config generators have a different way to specify configs + if not single_config: + cmake_args += [ + f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{cfg.upper()}={extdir}" + ] + build_args += ["--config", cfg] + + if sys.platform.startswith("darwin"): + # Cross-compile support for macOS - respect ARCHFLAGS if set + archs = re.findall(r"-arch (\S+)", os.environ.get("ARCHFLAGS", "")) + if archs: + cmake_args += ["-DCMAKE_OSX_ARCHITECTURES={}".format(";".join(archs))] + cmake_args += ext.extra_args + # Set CMAKE_BUILD_PARALLEL_LEVEL to control the parallel build level + # across all generators. + if "CMAKE_BUILD_PARALLEL_LEVEL" not in os.environ: + # self.parallel is a Python 3 only way to set parallel jobs by hand + # using -j in the build_ext call, not supported by pip or PyPA-build. + if hasattr(self, "parallel") and self.parallel: + # CMake 3.12+ only. + build_args += [f"-j{self.parallel}"] + + build_temp = Path(self.build_temp) / ext.name + if not build_temp.exists(): + build_temp.mkdir(parents=True) + + subprocess.run( + ["cmake", ext.sourcedir, *cmake_args], cwd=build_temp, check=True + ) + subprocess.run( + ["cmake", "--build", ".", *build_args], cwd=build_temp, check=True + ) + +extra_args = {} + +extra_args["CMAKE_C_COMPILER"] = os.environ.get("CC", "") +extra_args["CMAKE_CXX_COMPILER"] = os.environ.get("CXX", "") +#If ENABLE_CUDA is in the env +if "ENABLE_CUDA" in os.environ: + extra_args["ENABLE_CUDA"] = "ON" + ARCHES = [52, 60, 61, 70] + DEPRECATED_IN_11 = [35, 50] + cuda_version_major= int(torch.version.cuda.split(".")[0]) + cuda_version_minor= int(torch.version.cuda.split(".")[1]) + if cuda_version_major >= 11 or (cuda_version_major == 11 and cuda_version_minor >= 1): + LATEST_ARCH = 90 + ARCHES += [75, 80, 86] + elif cuda_version_major == 11 and cuda_version_minor >= 1: + LATEST_ARCH = 86 + ARCHES += [75, 80] + elif cuda_version_major == 11 and cuda_version_minor >= 0: + LATEST_ARCH = 80 + ARCHES += [75] + elif cuda_version_major >= 10: + LATEST_ARCH = 75 + ARCHES = DEPRECATED_IN_11 + ARCHES + else: + raise RuntimeError("Unsupported CUDA version") + CMAKE_CUDA_ARCHS = ";".join([str(arch) for arch in ARCHES] + [f"{LATEST_ARCH}-real", f"{LATEST_ARCH}-virtual"]) + extra_args["CMAKE_CUDA_ARCHITECTURES"] = "50" + extra_args["CMAKE_CUDA_HOST_COMPILER"] = extra_args["CMAKE_CXX_COMPILER"] +else: + extra_args["ENABLE_CUDA"] = "OFF" + +extra_args["CMAKE_PREFIX_PATH"] = torch.utils.cmake_prefix_path +tag = git.Repo(search_parent_directories=True).git.describe("--tags", always=True) +version = tag.lstrip('v').split('-')[0] +setup( + name="nnpops", + version=version, + ext_modules=[CMakeExtension("cmake_example", ".", extra_args)], + cmdclass={"build_ext": CMakeBuild}, + zip_safe=False, + extras_require={"test": ["pytest>=6.0"]}, + python_requires=">=3.7", +) From 78640ce0b7db0690b25a6113fa92915dfc7f849f Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Tue, 27 Jun 2023 12:00:02 +0200 Subject: [PATCH 02/31] Ask torch if cuda is available --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index cbfab87..2116f15 100644 --- a/setup.py +++ b/setup.py @@ -131,8 +131,7 @@ def build_extension(self, ext: CMakeExtension) -> None: extra_args["CMAKE_C_COMPILER"] = os.environ.get("CC", "") extra_args["CMAKE_CXX_COMPILER"] = os.environ.get("CXX", "") -#If ENABLE_CUDA is in the env -if "ENABLE_CUDA" in os.environ: +if torch.backends.cuda.is_built(): extra_args["ENABLE_CUDA"] = "ON" ARCHES = [52, 60, 61, 70] DEPRECATED_IN_11 = [35, 50] From b50fe87ee33d5f6bd178db35a049ee25023300f2 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Tue, 27 Jun 2023 12:00:12 +0200 Subject: [PATCH 03/31] Update ci --- .github/workflows/ci.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3561eb3..37b54ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,6 +114,16 @@ jobs: conda activate nnpops conda list + - name: Pip build (without CUDA) + if: ${{ !matrix.enable_cuda }} + run: | + pip -vvv wheel --wheel-dir=$(pwd) . --extra-index-url https://download.pytorch.org/whl/cpu + + - name: Pip build (with CUDA) + if: ${{ matrix.enable_cuda }} + run: | + pip -vvv wheel --wheel-dir=$(pwd) . + - name: Configure, compile, and install run: | conda activate nnpops @@ -129,13 +139,4 @@ jobs: conda activate nnpops cd build ctest --verbose --exclude-regex TestCuda - - - name: Pip build (without CUDA) - if: ${{ !matrix.enable_cuda }} - run: | - pip -vvv wheel --wheel-dir=$(pwd) nnpops --extra-index-url https://download.pytorch.org/whl/cpu - - name: Pip build (with CUDA) - if: ${{ matrix.enable_cuda }} - run: | - ENABLE_CUDA=ON pip -vvv wheel --wheel-dir=$(pwd) nnpops - + From 3a9a2b18d6fe4c7565abd353ac57d161a7c1b64e Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Tue, 27 Jun 2023 12:10:25 +0200 Subject: [PATCH 04/31] Hardcode version to 0.5 --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 2116f15..e52fe31 100644 --- a/setup.py +++ b/setup.py @@ -158,8 +158,9 @@ def build_extension(self, ext: CMakeExtension) -> None: extra_args["ENABLE_CUDA"] = "OFF" extra_args["CMAKE_PREFIX_PATH"] = torch.utils.cmake_prefix_path -tag = git.Repo(search_parent_directories=True).git.describe("--tags", always=True) -version = tag.lstrip('v').split('-')[0] +#tag = git.Repo(search_parent_directories=True).git.describe("--tags", always=True) +#version = tag.lstrip('v').split('-')[0] +version = "0.5" setup( name="nnpops", version=version, From c28aa60c9fa4d19a47da7308de12decd030849f5 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Tue, 27 Jun 2023 12:34:54 +0200 Subject: [PATCH 05/31] Let pip find gcc --- setup.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.py b/setup.py index e52fe31..2eb0995 100644 --- a/setup.py +++ b/setup.py @@ -129,8 +129,6 @@ def build_extension(self, ext: CMakeExtension) -> None: extra_args = {} -extra_args["CMAKE_C_COMPILER"] = os.environ.get("CC", "") -extra_args["CMAKE_CXX_COMPILER"] = os.environ.get("CXX", "") if torch.backends.cuda.is_built(): extra_args["ENABLE_CUDA"] = "ON" ARCHES = [52, 60, 61, 70] @@ -153,7 +151,7 @@ def build_extension(self, ext: CMakeExtension) -> None: raise RuntimeError("Unsupported CUDA version") CMAKE_CUDA_ARCHS = ";".join([str(arch) for arch in ARCHES] + [f"{LATEST_ARCH}-real", f"{LATEST_ARCH}-virtual"]) extra_args["CMAKE_CUDA_ARCHITECTURES"] = "50" - extra_args["CMAKE_CUDA_HOST_COMPILER"] = extra_args["CMAKE_CXX_COMPILER"] + #extra_args["CMAKE_CUDA_HOST_COMPILER"] = extra_args["CMAKE_CXX_COMPILER"] else: extra_args["ENABLE_CUDA"] = "OFF" From 97e9d946ebf45802827a4e43ebac2f133b96e462 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Tue, 27 Jun 2023 12:44:57 +0200 Subject: [PATCH 06/31] Do not specify a wheel dir --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37b54ed..607f9f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,12 +117,12 @@ jobs: - name: Pip build (without CUDA) if: ${{ !matrix.enable_cuda }} run: | - pip -vvv wheel --wheel-dir=$(pwd) . --extra-index-url https://download.pytorch.org/whl/cpu + pip -vvv wheel . --extra-index-url https://download.pytorch.org/whl/cpu - name: Pip build (with CUDA) if: ${{ matrix.enable_cuda }} run: | - pip -vvv wheel --wheel-dir=$(pwd) . + pip -vvv wheel . - name: Configure, compile, and install run: | From b5a733857dae7343a30de52000f5300b4c7ae110 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Tue, 27 Jun 2023 12:49:41 +0200 Subject: [PATCH 07/31] Change the name of the pip build directory --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 607f9f4..0bb47ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,12 +117,14 @@ jobs: - name: Pip build (without CUDA) if: ${{ !matrix.enable_cuda }} run: | - pip -vvv wheel . --extra-index-url https://download.pytorch.org/whl/cpu + pip -vvv wheel --wheel-dir=$(pwd) -b build_pip . --extra-index-url https://download.pytorch.org/whl/cpu + rm -rf build - name: Pip build (with CUDA) if: ${{ matrix.enable_cuda }} run: | - pip -vvv wheel . + pip -vvv wheel --wheel-dir=$(pwd) -b build_pip . + rm -rf build_pip - name: Configure, compile, and install run: | From cd2454101fdb4c8b0aa10cbe7d7d6923a8a28797 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Tue, 27 Jun 2023 13:11:57 +0200 Subject: [PATCH 08/31] Remove build directory after pip --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0bb47ca..eacb1b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,14 +117,14 @@ jobs: - name: Pip build (without CUDA) if: ${{ !matrix.enable_cuda }} run: | - pip -vvv wheel --wheel-dir=$(pwd) -b build_pip . --extra-index-url https://download.pytorch.org/whl/cpu + pip -vvv wheel --wheel-dir=$(pwd) . --extra-index-url https://download.pytorch.org/whl/cpu rm -rf build - name: Pip build (with CUDA) if: ${{ matrix.enable_cuda }} run: | - pip -vvv wheel --wheel-dir=$(pwd) -b build_pip . - rm -rf build_pip + pip -vvv wheel --wheel-dir=$(pwd) . + rm -rf build - name: Configure, compile, and install run: | From e05dff0a12038618cbba4b82d254340560dc6a18 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Tue, 27 Jun 2023 13:34:28 +0200 Subject: [PATCH 09/31] Activate nnpops env --- .github/workflows/ci.yml | 2 ++ setup.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eacb1b4..d19a78b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,12 +117,14 @@ jobs: - name: Pip build (without CUDA) if: ${{ !matrix.enable_cuda }} run: | + conda activate nnpops pip -vvv wheel --wheel-dir=$(pwd) . --extra-index-url https://download.pytorch.org/whl/cpu rm -rf build - name: Pip build (with CUDA) if: ${{ matrix.enable_cuda }} run: | + conda activate nnpops pip -vvv wheel --wheel-dir=$(pwd) . rm -rf build diff --git a/setup.py b/setup.py index 2eb0995..83ad6f7 100644 --- a/setup.py +++ b/setup.py @@ -129,6 +129,10 @@ def build_extension(self, ext: CMakeExtension) -> None: extra_args = {} +if "CC" in os.environ: + extra_args["CMAKE_C_COMPILER"] = os.environ.get("CC", "") +if "CXX" in os.environ: + extra_args["CMAKE_CXX_COMPILER"] = os.environ.get("CXX", "") if torch.backends.cuda.is_built(): extra_args["ENABLE_CUDA"] = "ON" ARCHES = [52, 60, 61, 70] @@ -151,7 +155,6 @@ def build_extension(self, ext: CMakeExtension) -> None: raise RuntimeError("Unsupported CUDA version") CMAKE_CUDA_ARCHS = ";".join([str(arch) for arch in ARCHES] + [f"{LATEST_ARCH}-real", f"{LATEST_ARCH}-virtual"]) extra_args["CMAKE_CUDA_ARCHITECTURES"] = "50" - #extra_args["CMAKE_CUDA_HOST_COMPILER"] = extra_args["CMAKE_CXX_COMPILER"] else: extra_args["ENABLE_CUDA"] = "OFF" From 5779ad22d2510a81ff49baeeb222e6c52071cc37 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Tue, 27 Jun 2023 15:02:35 +0200 Subject: [PATCH 10/31] Small changes to setup.py --- setup.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 83ad6f7..b369d3c 100644 --- a/setup.py +++ b/setup.py @@ -25,8 +25,7 @@ def __init__(self, name: str, sourcedir: str = "", extra_args: Optional[dict[str super().__init__(name, sources=[]) self.sourcedir = os.fspath(Path(sourcedir).resolve()) #Store a list of extra arguments to pass to CMake, prepend -D to each - self.extra_args = extra_args - self.extra_args = ([f"-D{key}={value}" for key, value in extra_args.items()] if extra_args else [""]) + self.extra_args = [f"-D{key}={value}" for key, value in extra_args.items()] if extra_args else [] @@ -150,7 +149,7 @@ def build_extension(self, ext: CMakeExtension) -> None: ARCHES += [75] elif cuda_version_major >= 10: LATEST_ARCH = 75 - ARCHES = DEPRECATED_IN_11 + ARCHES + ARCHES += DEPRECATED_IN_11 else: raise RuntimeError("Unsupported CUDA version") CMAKE_CUDA_ARCHS = ";".join([str(arch) for arch in ARCHES] + [f"{LATEST_ARCH}-real", f"{LATEST_ARCH}-virtual"]) From 7571e138645b3f0a1253abedfd5612f9d60b7742 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Tue, 27 Jun 2023 15:18:42 +0200 Subject: [PATCH 11/31] Add cuda archs --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b369d3c..749f12a 100644 --- a/setup.py +++ b/setup.py @@ -153,7 +153,7 @@ def build_extension(self, ext: CMakeExtension) -> None: else: raise RuntimeError("Unsupported CUDA version") CMAKE_CUDA_ARCHS = ";".join([str(arch) for arch in ARCHES] + [f"{LATEST_ARCH}-real", f"{LATEST_ARCH}-virtual"]) - extra_args["CMAKE_CUDA_ARCHITECTURES"] = "50" + extra_args["CMAKE_CUDA_ARCHITECTURES"] = CMAKE_CUDA_ARCHS else: extra_args["ENABLE_CUDA"] = "OFF" From 0080796a28f3616b2bf73987e99c6658893afdac Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Tue, 27 Jun 2023 15:48:29 +0200 Subject: [PATCH 12/31] Update setup.py and toml --- pyproject.toml | 1 + setup.py | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bf7ea6e..e663411 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,3 +8,4 @@ requires = [ "GitPython" ] build-backend = "setuptools.build_meta" +python_requires = ">=3.7" \ No newline at end of file diff --git a/setup.py b/setup.py index 749f12a..08bd194 100644 --- a/setup.py +++ b/setup.py @@ -25,6 +25,8 @@ def __init__(self, name: str, sourcedir: str = "", extra_args: Optional[dict[str super().__init__(name, sources=[]) self.sourcedir = os.fspath(Path(sourcedir).resolve()) #Store a list of extra arguments to pass to CMake, prepend -D to each + if extra_args is not None: + print("Extra args: ", extra_args) self.extra_args = [f"-D{key}={value}" for key, value in extra_args.items()] if extra_args else [] @@ -164,9 +166,6 @@ def build_extension(self, ext: CMakeExtension) -> None: setup( name="nnpops", version=version, - ext_modules=[CMakeExtension("cmake_example", ".", extra_args)], - cmdclass={"build_ext": CMakeBuild}, - zip_safe=False, - extras_require={"test": ["pytest>=6.0"]}, - python_requires=">=3.7", + ext_modules=[CMakeExtension(name="cmake_example", sourcedir=".", extra_args=extra_args)], + cmdclass={"build_ext": CMakeBuild} ) From bdd06ee6e77dc134e754bb26b62764667241fc81 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Tue, 27 Jun 2023 16:25:33 +0200 Subject: [PATCH 13/31] Add quotes --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 08bd194..43fc026 100644 --- a/setup.py +++ b/setup.py @@ -154,7 +154,7 @@ def build_extension(self, ext: CMakeExtension) -> None: ARCHES += DEPRECATED_IN_11 else: raise RuntimeError("Unsupported CUDA version") - CMAKE_CUDA_ARCHS = ";".join([str(arch) for arch in ARCHES] + [f"{LATEST_ARCH}-real", f"{LATEST_ARCH}-virtual"]) + CMAKE_CUDA_ARCHS = '\"' + ";".join([str(arch) for arch in ARCHES] + [f"{LATEST_ARCH}-real", f"{LATEST_ARCH}-virtual"]) + '\"' extra_args["CMAKE_CUDA_ARCHITECTURES"] = CMAKE_CUDA_ARCHS else: extra_args["ENABLE_CUDA"] = "OFF" From 4a4b475d9c52a5fa1d6d2b1d2d81b713afbfb46c Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Wed, 28 Jun 2023 09:02:34 +0200 Subject: [PATCH 14/31] Remove quotes --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 43fc026..08bd194 100644 --- a/setup.py +++ b/setup.py @@ -154,7 +154,7 @@ def build_extension(self, ext: CMakeExtension) -> None: ARCHES += DEPRECATED_IN_11 else: raise RuntimeError("Unsupported CUDA version") - CMAKE_CUDA_ARCHS = '\"' + ";".join([str(arch) for arch in ARCHES] + [f"{LATEST_ARCH}-real", f"{LATEST_ARCH}-virtual"]) + '\"' + CMAKE_CUDA_ARCHS = ";".join([str(arch) for arch in ARCHES] + [f"{LATEST_ARCH}-real", f"{LATEST_ARCH}-virtual"]) extra_args["CMAKE_CUDA_ARCHITECTURES"] = CMAKE_CUDA_ARCHS else: extra_args["ENABLE_CUDA"] = "OFF" From e138ffff18ca06c7119f8e8deb2d2a2df7e876e7 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Wed, 28 Jun 2023 15:36:34 +0200 Subject: [PATCH 15/31] Try setting archs to OFF --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 08bd194..42f5cc0 100644 --- a/setup.py +++ b/setup.py @@ -155,7 +155,7 @@ def build_extension(self, ext: CMakeExtension) -> None: else: raise RuntimeError("Unsupported CUDA version") CMAKE_CUDA_ARCHS = ";".join([str(arch) for arch in ARCHES] + [f"{LATEST_ARCH}-real", f"{LATEST_ARCH}-virtual"]) - extra_args["CMAKE_CUDA_ARCHITECTURES"] = CMAKE_CUDA_ARCHS + extra_args["CMAKE_CUDA_ARCHITECTURES"] = "OFF" #CMAKE_CUDA_ARCHS else: extra_args["ENABLE_CUDA"] = "OFF" From e8c1038eaccbd7046297306419c69b68f9965a3d Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Wed, 28 Jun 2023 15:54:05 +0200 Subject: [PATCH 16/31] Change dict by Dict --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 42f5cc0..ca50b33 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ from setuptools.command.build_ext import build_ext import torch -from typing import Optional +from typing import Optional, Dict # Convert distutils Windows platform specifiers to CMake -A arguments PLAT_TO_CMAKE = { "win32": "Win32", @@ -21,7 +21,7 @@ # The name must be the _single_ output extension from the CMake build. # If you need multiple extensions, see scikit-build. class CMakeExtension(Extension): - def __init__(self, name: str, sourcedir: str = "", extra_args: Optional[dict[str, str]] = None) -> None: + def __init__(self, name: str, sourcedir: str = "", extra_args: Optional[Dict[str, str]] = None) -> None: super().__init__(name, sources=[]) self.sourcedir = os.fspath(Path(sourcedir).resolve()) #Store a list of extra arguments to pass to CMake, prepend -D to each From 176bd7c0b3bf421c62282af96773eaf3eabddc3b Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Wed, 28 Jun 2023 16:17:36 +0200 Subject: [PATCH 17/31] Add pip to environment.yml --- environment.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/environment.yml b/environment.yml index 9db9ae2..26b5612 100644 --- a/environment.yml +++ b/environment.yml @@ -12,3 +12,4 @@ dependencies: - python 3.10.* - pytorch-gpu 2.0.* - sysroot_linux-64 2.17 + - pip From cc307f2c722eccd660b389af66c5ee44b8700270 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Wed, 28 Jun 2023 16:21:26 +0200 Subject: [PATCH 18/31] Remove torch from pyproject, must be installed by conda --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e663411..2965c75 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,6 @@ requires = [ "wheel", "ninja", "cmake>=3.23", - "torch>=1.12", "GitPython" ] build-backend = "setuptools.build_meta" From f0f3bf03eec9cbdf9ad46a7af6d828fca41234b7 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Thu, 29 Jun 2023 10:52:18 +0200 Subject: [PATCH 19/31] Change torch version in pip build depending on the ci's version matrix --- .github/workflows/ci.yml | 2 ++ pyproject.toml | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d19a78b..cfe9748 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,6 +118,7 @@ jobs: if: ${{ !matrix.enable_cuda }} run: | conda activate nnpops + sed -i -e '/"torch/c "torch==${{ matrix.pytorch }}",' pyproject.toml pip -vvv wheel --wheel-dir=$(pwd) . --extra-index-url https://download.pytorch.org/whl/cpu rm -rf build @@ -125,6 +126,7 @@ jobs: if: ${{ matrix.enable_cuda }} run: | conda activate nnpops + sed -i -e '/"torch/c "torch==${{ matrix.pytorch }}",' pyproject.toml pip -vvv wheel --wheel-dir=$(pwd) . rm -rf build diff --git a/pyproject.toml b/pyproject.toml index 2965c75..8293b5a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ requires = [ "wheel", "ninja", "cmake>=3.23", + "torch>=2.0", "GitPython" ] build-backend = "setuptools.build_meta" From af0b8a1822817b7aee9e11f97d2f673ef63b4551 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Fri, 30 Jun 2023 15:11:58 +0200 Subject: [PATCH 20/31] Copy python scripts and put library in the correct place --- pyproject.toml | 13 ++++++++++++- setup.py | 17 ++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8293b5a..4c02e13 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,4 +8,15 @@ requires = [ "GitPython" ] build-backend = "setuptools.build_meta" -python_requires = ">=3.7" \ No newline at end of file +python_requires = ">=3.7" + +[project] +name = "nnpops" +version = "0.5" +dependencies = [ + "numpy", + "torch>=2.0", + "torchani>=2.2" +] +[project.optional-dependencies] +test = ["pytest>=5.0"] \ No newline at end of file diff --git a/setup.py b/setup.py index ca50b33..1798354 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import subprocess import sys from pathlib import Path -import git +#import git from setuptools import Extension, setup from setuptools.command.build_ext import build_ext import torch @@ -51,7 +51,7 @@ def build_extension(self, ext: CMakeExtension) -> None: # EXAMPLE_VERSION_INFO shows you how to pass a value into the C++ code # from Python. cmake_args = [ - f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}{os.sep}", + f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}{os.sep}{ext.name}", f"-DPYTHON_EXECUTABLE={sys.executable}", f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm ] @@ -162,10 +162,13 @@ def build_extension(self, ext: CMakeExtension) -> None: extra_args["CMAKE_PREFIX_PATH"] = torch.utils.cmake_prefix_path #tag = git.Repo(search_parent_directories=True).git.describe("--tags", always=True) #version = tag.lstrip('v').split('-')[0] -version = "0.5" setup( - name="nnpops", - version=version, - ext_modules=[CMakeExtension(name="cmake_example", sourcedir=".", extra_args=extra_args)], - cmdclass={"build_ext": CMakeBuild} + ext_modules=[CMakeExtension(name="NNPOps", sourcedir=".", extra_args=extra_args)], + cmdclass={"build_ext": CMakeBuild}, + packages=["NNPOps", "NNPOps.neighbors", "NNPOps.pme"], + package_dir={ + 'NNPOps': 'src/pytorch', + 'NNPOps.neighbors': 'src/pytorch/neighbors', + 'NNPOps.pme': 'src/pytorch/pme'}, + package_data={'NNPOps': ['lib/*.so', 'lib/*.dll', 'lib/*.dylib']}, ) From 1c06019cc8f5366cc93c53652a2700d1412b2af0 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Wed, 5 Jul 2023 11:23:44 +0200 Subject: [PATCH 21/31] First try at cibuildwheel --- .github/workflows/wheels.yml | 42 ++++++++++++++++++++++++++++++++++++ pyproject.toml | 10 +++++---- setup.py | 3 +++ 3 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/wheels.yml diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml new file mode 100644 index 0000000..461c2b5 --- /dev/null +++ b/.github/workflows/wheels.yml @@ -0,0 +1,42 @@ +name: Build + +on: [push, pull_request] + +jobs: + build_wheels: + name: Build wheels on cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] #, windows-2019, macos-11] + python: [37 38 39 310 311] + torch: [1.11, 1.12, 2.0.0] + cuda: [10, 11, 12] + steps: + - uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + - name: Build wheels + uses: pypa/cibuildwheel@v2.13.1 + env: + CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} + CIBW_ENVIRONMENT: TORCH_VERSION=${{ matrix.torch }} CUDA_VERSION=${{ matrix.cuda }} + + with: + package-dir: . + output-dir: wheelhouse + + + # env: + # CIBW_SOME_OPTION: value + # ... + # with: + # package-dir: . + # output-dir: wheelhouse + # config-file: "{package}/pyproject.toml" + + # - uses: actions/upload-artifact@v3 + # with: + # path: ./wheelhouse/*.whl diff --git a/pyproject.toml b/pyproject.toml index 4c02e13..18cdc9a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,8 +4,8 @@ requires = [ "wheel", "ninja", "cmake>=3.23", - "torch>=2.0", - "GitPython" + "GitPython", + "nvidia-pyindex" ] build-backend = "setuptools.build_meta" python_requires = ">=3.7" @@ -15,8 +15,10 @@ name = "nnpops" version = "0.5" dependencies = [ "numpy", - "torch>=2.0", - "torchani>=2.2" + "torch>=1.11", + "torchani>=2.2", + "mdtraj" ] + [project.optional-dependencies] test = ["pytest>=5.0"] \ No newline at end of file diff --git a/setup.py b/setup.py index 1798354..d7685f3 100644 --- a/setup.py +++ b/setup.py @@ -160,6 +160,8 @@ def build_extension(self, ext: CMakeExtension) -> None: extra_args["ENABLE_CUDA"] = "OFF" extra_args["CMAKE_PREFIX_PATH"] = torch.utils.cmake_prefix_path +torch_version = os.environ.get("TORCH_VERSION", torch.__version__) +cuda_version = os.environ.get("CUDA_VERSION", torch.version.cuda) #tag = git.Repo(search_parent_directories=True).git.describe("--tags", always=True) #version = tag.lstrip('v').split('-')[0] setup( @@ -171,4 +173,5 @@ def build_extension(self, ext: CMakeExtension) -> None: 'NNPOps.neighbors': 'src/pytorch/neighbors', 'NNPOps.pme': 'src/pytorch/pme'}, package_data={'NNPOps': ['lib/*.so', 'lib/*.dll', 'lib/*.dylib']}, + install_requires=[f"torch=={torch_version}", f"nvidia-cuda-nvcc-cu{cuda_version}"], ) From 0fbafc77a19b7d1a030a7124e15045757aa0aec2 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Fri, 7 Jul 2023 11:12:28 +0200 Subject: [PATCH 22/31] Fix typo --- .github/workflows/wheels.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 461c2b5..5296fa2 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -5,13 +5,14 @@ on: [push, pull_request] jobs: build_wheels: name: Build wheels on cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }} + runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-22.04] #, windows-2019, macos-11] - python: [37 38 39 310 311] - torch: [1.11, 1.12, 2.0.0] - cuda: [10, 11, 12] + python: ['3.7', '3.8', '3.9', '3.10', '3.11'] + torch: ['1.11', '1.12', '2.0.0'] + cuda: ['10', '11', '12'] steps: - uses: actions/checkout@v3 - name: Setup Python From d6c4f57cd5cb9ce9a6fe69440dbeb392e12118ac Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Fri, 7 Jul 2023 11:14:44 +0200 Subject: [PATCH 23/31] Fix typo --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 5296fa2..9c6e899 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: os: [ubuntu-22.04] #, windows-2019, macos-11] - python: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python: ['37', '38', '39', '310', '311'] torch: ['1.11', '1.12', '2.0.0'] cuda: ['10', '11', '12'] steps: From 51903c05e89115185d3c17764a2e38e816be0380 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Fri, 7 Jul 2023 11:20:54 +0200 Subject: [PATCH 24/31] Update --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 9c6e899..d84ab26 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -9,7 +9,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-22.04] #, windows-2019, macos-11] + os: [ubuntu-latest] #, windows-2019, macos-11] python: ['37', '38', '39', '310', '311'] torch: ['1.11', '1.12', '2.0.0'] cuda: ['10', '11', '12'] From 8b4da8a6a54baea0bdcaa8e518c7bf4abd4a692b Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Fri, 7 Jul 2023 11:22:53 +0200 Subject: [PATCH 25/31] Update --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index d84ab26..1d2096b 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -18,7 +18,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python }} + python-version: '3.9' - name: Build wheels uses: pypa/cibuildwheel@v2.13.1 env: From 0ba92e2a306773573a8186926d5a2b9a6998d1bf Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Fri, 7 Jul 2023 11:30:54 +0200 Subject: [PATCH 26/31] Update --- .github/workflows/wheels.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 1d2096b..f6d96c8 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -4,13 +4,13 @@ on: [push, pull_request] jobs: build_wheels: - name: Build wheels on cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }} + name: Build wheels on cp${{ matrix.python }}-linux runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest] #, windows-2019, macos-11] - python: ['37', '38', '39', '310', '311'] + python: ['3.7', '3.8', '3.9', '3.10', '3.11'] torch: ['1.11', '1.12', '2.0.0'] cuda: ['10', '11', '12'] steps: @@ -18,17 +18,17 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: '3.9' + python-version: ${{ matrix.python }} - name: Build wheels uses: pypa/cibuildwheel@v2.13.1 env: - CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} + CIBW_BUILD: cp${{ matrix.python }}-linux CIBW_ENVIRONMENT: TORCH_VERSION=${{ matrix.torch }} CUDA_VERSION=${{ matrix.cuda }} with: package-dir: . output-dir: wheelhouse - + # env: # CIBW_SOME_OPTION: value From d2c62573b8d50652e394fa882985ea12845da163 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Fri, 7 Jul 2023 18:21:23 +0200 Subject: [PATCH 27/31] Another try --- .github/workflows/wheels.yml | 1 - CMakeLists.txt | 2 +- pyproject.toml | 5 +++- setup.py | 49 ++++++++++++++++++------------------ 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index f6d96c8..dc30162 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -24,7 +24,6 @@ jobs: env: CIBW_BUILD: cp${{ matrix.python }}-linux CIBW_ENVIRONMENT: TORCH_VERSION=${{ matrix.torch }} CUDA_VERSION=${{ matrix.cuda }} - with: package-dir: . output-dir: wheelhouse diff --git a/CMakeLists.txt b/CMakeLists.txt index 5529ff6..b3df303 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ if(ENABLE_CUDA) endif(ENABLE_CUDA) # Find dependencies -find_package(Python3 REQUIRED COMPONENTS Interpreter Development) +find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module) find_package(Torch REQUIRED) enable_testing() diff --git a/pyproject.toml b/pyproject.toml index 18cdc9a..61920ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,10 @@ requires = [ "ninja", "cmake>=3.23", "GitPython", - "nvidia-pyindex" + "nvidia-pyindex", + "torch>=1.11", + "Cython" + ] build-backend = "setuptools.build_meta" python_requires = ">=3.7" diff --git a/setup.py b/setup.py index d7685f3..1a1cb81 100644 --- a/setup.py +++ b/setup.py @@ -134,30 +134,31 @@ def build_extension(self, ext: CMakeExtension) -> None: extra_args["CMAKE_C_COMPILER"] = os.environ.get("CC", "") if "CXX" in os.environ: extra_args["CMAKE_CXX_COMPILER"] = os.environ.get("CXX", "") -if torch.backends.cuda.is_built(): - extra_args["ENABLE_CUDA"] = "ON" - ARCHES = [52, 60, 61, 70] - DEPRECATED_IN_11 = [35, 50] - cuda_version_major= int(torch.version.cuda.split(".")[0]) - cuda_version_minor= int(torch.version.cuda.split(".")[1]) - if cuda_version_major >= 11 or (cuda_version_major == 11 and cuda_version_minor >= 1): - LATEST_ARCH = 90 - ARCHES += [75, 80, 86] - elif cuda_version_major == 11 and cuda_version_minor >= 1: - LATEST_ARCH = 86 - ARCHES += [75, 80] - elif cuda_version_major == 11 and cuda_version_minor >= 0: - LATEST_ARCH = 80 - ARCHES += [75] - elif cuda_version_major >= 10: - LATEST_ARCH = 75 - ARCHES += DEPRECATED_IN_11 - else: - raise RuntimeError("Unsupported CUDA version") - CMAKE_CUDA_ARCHS = ";".join([str(arch) for arch in ARCHES] + [f"{LATEST_ARCH}-real", f"{LATEST_ARCH}-virtual"]) - extra_args["CMAKE_CUDA_ARCHITECTURES"] = "OFF" #CMAKE_CUDA_ARCHS -else: - extra_args["ENABLE_CUDA"] = "OFF" +# if torch.backends.cuda.is_built(): +# extra_args["ENABLE_CUDA"] = "ON" +# ARCHES = [52, 60, 61, 70] +# DEPRECATED_IN_11 = [35, 50] +# cuda_version_major= int(torch.version.cuda.split(".")[0]) +# cuda_version_minor= int(torch.version.cuda.split(".")[1]) +# if cuda_version_major >= 11 or (cuda_version_major == 11 and cuda_version_minor >= 1): +# LATEST_ARCH = 90 +# ARCHES += [75, 80, 86] +# elif cuda_version_major == 11 and cuda_version_minor >= 1: +# LATEST_ARCH = 86 +# ARCHES += [75, 80] +# elif cuda_version_major == 11 and cuda_version_minor >= 0: +# LATEST_ARCH = 80 +# ARCHES += [75] +# elif cuda_version_major >= 10: +# LATEST_ARCH = 75 +# ARCHES += DEPRECATED_IN_11 +# else: +# raise RuntimeError("Unsupported CUDA version") +# CMAKE_CUDA_ARCHS = ";".join([str(arch) for arch in ARCHES] + [f"{LATEST_ARCH}-real", f"{LATEST_ARCH}-virtual"]) +# extra_args["CMAKE_CUDA_ARCHITECTURES"] = "OFF" #CMAKE_CUDA_ARCHS +# else: +extra_args["CMAKE_CUDA_ARCHITECTURES"] = "OFF" +extra_args["ENABLE_CUDA"] = "OFF" extra_args["CMAKE_PREFIX_PATH"] = torch.utils.cmake_prefix_path torch_version = os.environ.get("TORCH_VERSION", torch.__version__) From 82c63dee75c8daaa63294391734610139192f60d Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Fri, 7 Jul 2023 18:24:18 +0200 Subject: [PATCH 28/31] Update wheels.yml --- .github/workflows/wheels.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index dc30162..3ecbcdc 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -10,9 +10,9 @@ jobs: strategy: matrix: os: [ubuntu-latest] #, windows-2019, macos-11] - python: ['3.7', '3.8', '3.9', '3.10', '3.11'] - torch: ['1.11', '1.12', '2.0.0'] - cuda: ['10', '11', '12'] + python: ['3.9'] + torch: ['1.12'] + cuda: ['11'] steps: - uses: actions/checkout@v3 - name: Setup Python @@ -22,7 +22,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.13.1 env: - CIBW_BUILD: cp${{ matrix.python }}-linux + CIBW_BUILD: cp${{ matrix.python }}-* CIBW_ENVIRONMENT: TORCH_VERSION=${{ matrix.torch }} CUDA_VERSION=${{ matrix.cuda }} with: package-dir: . From a6a39eb0ca44e53986291b17555e33f1429c1e18 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Fri, 7 Jul 2023 18:26:45 +0200 Subject: [PATCH 29/31] Update wheels.yml --- .github/workflows/wheels.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 3ecbcdc..3bab5e3 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] #, windows-2019, macos-11] - python: ['3.9'] + python: ['39'] torch: ['1.12'] cuda: ['11'] steps: @@ -23,6 +23,8 @@ jobs: uses: pypa/cibuildwheel@v2.13.1 env: CIBW_BUILD: cp${{ matrix.python }}-* + CIBW_SKIP: "cp36-* *-win32 *i686" + CIBW_ENVIRONMENT: TORCH_VERSION=${{ matrix.torch }} CUDA_VERSION=${{ matrix.cuda }} with: package-dir: . From 134c3412e25e2d49c774514604922ff129461744 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Fri, 7 Jul 2023 18:29:15 +0200 Subject: [PATCH 30/31] Update wheels.yml --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 3bab5e3..a66b94c 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] #, windows-2019, macos-11] - python: ['39'] + python: ['310'] torch: ['1.12'] cuda: ['11'] steps: From 1afe7fcf1524c0b1354a2384980ce0997bd53e9f Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Fri, 7 Jul 2023 18:53:40 +0200 Subject: [PATCH 31/31] Update wheels --- .github/workflows/wheels.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index a66b94c..14d0ef5 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] #, windows-2019, macos-11] - python: ['310'] + python: ['3.10'] torch: ['1.12'] cuda: ['11'] steps: @@ -22,7 +22,6 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.13.1 env: - CIBW_BUILD: cp${{ matrix.python }}-* CIBW_SKIP: "cp36-* *-win32 *i686" CIBW_ENVIRONMENT: TORCH_VERSION=${{ matrix.torch }} CUDA_VERSION=${{ matrix.cuda }}