Skip to content

Commit

Permalink
ver: bump version to 0.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
XuehaiPan authored Aug 7, 2022
1 parent 84d1c3d commit 0ab590e
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 28 deletions.
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

### Changed

### Fixed

### Removed

------

## [0.4.3] - 2022-08-08

### Added

- Bump PyTorch version to 1.12.1 by [@XuehaiPan](https://github.com/XuehaiPan) in [#49](https://github.com/metaopt/TorchOpt/pull/49).
- CPU-only build without `nvcc` requirement by [@XuehaiPan](https://github.com/XuehaiPan) in [#51](https://github.com/metaopt/TorchOpt/pull/51).
- Use [`cibuildwheel`](https://github.com/pypa/cibuildwheel) to build wheels by [@XuehaiPan](https://github.com/XuehaiPan) in [#45](https://github.com/metaopt/TorchOpt/pull/45).
- Use dynamic process number in CPU kernels by [@JieRen98](https://github.com/JieRen98) in [#42](https://github.com/metaopt/TorchOpt/pull/42).
Expand Down Expand Up @@ -61,7 +74,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

------

[Unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.4.2...HEAD
[Unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.4.3...HEAD
[0.4.3]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.4.2...v0.4.3
[0.4.2]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.4.1...v0.4.2
[0.4.1]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.4.0...v0.4.1
[0.4.0]: https://github.com/olivierlacan/keep-a-changelog/releases/tag/v0.4.0
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ authors:
family-names: Yang
affiliation: Peking University
email: [email protected]
version: 0.4.2
date-released: "2022-07-26"
version: 0.4.3
date-released: "2022-08-08"
license: Apache-2.0
repository-code: "https://github.com/metaopt/TorchOpt"
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,20 @@ Requirements
- (Optional) For visualizing computation graphs
- [Graphviz](https://graphviz.org/download/) (for Linux users use `apt/yum install graphviz` or `conda install -c anaconda python-graphviz`)

Please follow the instructions at <https://pytorch.org> to install PyTorch in your Python environment first. Then run the following command to install TorchOpt from PyPI ([![PyPI](https://img.shields.io/pypi/v/torchopt?label=PyPI)](https://pypi.org/project/torchopt) / ![Status](https://img.shields.io/pypi/status/torchopt?label=Status)):
**Please follow the instructions at <https://pytorch.org> to install PyTorch in your Python environment first.** Then run the following command to install TorchOpt from PyPI ([![PyPI](https://img.shields.io/pypi/v/torchopt?label=PyPI)](https://pypi.org/project/torchopt) / ![Status](https://img.shields.io/pypi/status/torchopt?label=Status)):

```bash
pip3 install torchopt
```

If the minimum version of PyTorch is not satisfied, `pip` will install/upgrade it for you. Please be careful about the `torch` build for CPU / CUDA support (e.g. `cpu`, `cu102`, `cu113`). You may need to specify the extra index URL for the `torch` package:

```bash
pip3 install torchopt --extra-index-url https://download.pytorch.org/whl/cu116
```

See <https://pytorch.org> for more information about installing PyTorch.

You can also build shared libraries from source, use:

```bash
Expand Down
4 changes: 2 additions & 2 deletions conda-recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ dependencies:
- pip

# Learning
- pytorch::pytorch = 1.12
- pytorch::pytorch >= 1.12
- pytorch::torchvision
- pytorch::pytorch-mutex = *=*cuda*
- pip:
- functorch
- functorch >= 0.2
- torchviz
- sphinxcontrib-katex # for documentation
- jax
Expand Down
4 changes: 2 additions & 2 deletions docs/conda-recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ dependencies:
- pip

# Learning
- pytorch::pytorch = 1.12
- pytorch::pytorch >= 1.12
- pytorch::torchvision
- pytorch::pytorch-mutex = *=*cpu*
- pip:
- jax[cpu] >= 0.3
- functorch
- functorch >= 0.2
- torchviz
- sphinxcontrib-katex # for documentation
- tensorboard
Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--extra-index-url https://download.pytorch.org/whl/cpu
torch == 1.12
torch >= 1.12
torchvision
functorch
functorch >= 0.2

--requirement ../requirements.txt

Expand Down
14 changes: 13 additions & 1 deletion docs/source/developer/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,23 @@ To build compatible **manylinux2014** (:pep:`599`) wheels for distribution, you
export CUDA_VERSION="11.6" # version of `nvcc` for compilation
python3 -m cibuildwheel --platform=linux --output-dir=wheelhouse --config-file=pyproject.toml
It will installs the CUDA compiler with ``CUDA_VERSION`` in the build container. Then build wheel binaries for all supported CPython versions. The outputs will be placed in the ``wheelhouse`` directory.
It will install the CUDA compiler with ``CUDA_VERSION`` in the build container. Then build wheel binaries for all supported CPython versions. The outputs will be placed in the ``wheelhouse`` directory.

To build a wheel for a specific CPython version, you can use the |CIBW_BUILD|_ environment variable.
For example, the following command will build a wheel for Python 3.7:

.. code-block:: bash
CIBW_BUILD="cp37*manylinux*" python3 -m cibuildwheel --platform=linux --output-dir=wheelhouse --config-file=pyproject.toml
You can change ``cp37*`` to ``cp310*`` to build for Python 3.10. See https://cibuildwheel.readthedocs.io/en/stable/options for more options.

.. |cibuildwheel| replace:: ``cibuildwheel``
.. _cibuildwheel: https://github.com/pypa/cibuildwheel

.. |CIBW_BUILD| replace:: ``CIBW_BUILD``
.. _CIBW_BUILD: https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip

.. |docker| replace:: ``docker``
.. _docker: https://www.docker.com

Expand Down
4 changes: 2 additions & 2 deletions examples/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--extra-index-url https://download.pytorch.org/whl/cu116
torch == 1.12
torch >= 1.12
torchvision
functorch
functorch >= 0.2

--requirement ../requirements.txt

Expand Down
28 changes: 19 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Package ######################################################################

[build-system]
requires = ["setuptools", "torch == 1.12", "numpy", "pybind11"]
requires = ["setuptools", "torch >= 1.12", "numpy", "pybind11"]
build-backend = "setuptools.build_meta"

[project]
Expand Down Expand Up @@ -44,7 +44,7 @@ classifiers = [
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
dependencies = [
"torch == 1.12",
"torch >= 1.12",
"jax[cpu] >= 0.3",
"numpy",
"graphviz",
Expand Down Expand Up @@ -72,7 +72,13 @@ lint = [
"cpplint",
"pre-commit",
]
test = ['torchvision', 'functorch', 'pytest', 'pytest-cov', 'pytest-xdist']
test = [
'torchvision',
'functorch >= 0.2',
'pytest',
'pytest-cov',
'pytest-xdist',
]

[tool.setuptools.packages.find]
include = ["torchopt", "torchopt.*"]
Expand Down Expand Up @@ -109,10 +115,11 @@ test-extras = ["test"]
test-command = """
SITE_PACKAGES="$(python -c 'print(__import__("sysconfig").get_path("purelib"))')"
TORCH_LIB_PATH="${SITE_PACKAGES}/torch/lib"
echo "LD_LIBRARY_PATH='${LD_LIBRARY_PATH}'"
echo "ls ${TORCH_LIB_PATH}"; ls -lh "${TORCH_LIB_PATH}"
find "${SITE_PACKAGES}/torchopt" -name "*.so" -print0 |
xargs -0 -I '{}' bash -c "echo 'ldd {}'; ldd '{}'; echo 'patchelf --print-rpath {}'; patchelf --print-rpath '{}'"
make -C "{project}" test || true
make -C "{project}" test || exit 1
TORCH_VERSION="$(python -c 'print(__import__("torch").__version__.partition("+")[0])')"
TEST_TORCH_SPECS="${TEST_TORCH_SPECS:-"${DEFAULT_TEST_TORCH_SPECS}"}"
for spec in ${TEST_TORCH_SPECS}; do
Expand All @@ -125,18 +132,21 @@ test-command = """
xargs -0 -I '{}' bash -c "echo 'ldd {}'; ldd '{}'; echo 'patchelf --print-rpath {}'; patchelf --print-rpath '{}'"
make -C "{project}" test || exit 1
done
rm -rf ~/.pip/cache ~/.cache/pip
"""

[tool.cibuildwheel.linux]
repair-wheel-command = """
python -m pip install -r requirements.txt
SITE_PACKAGES="$(python -c 'print(__import__("sysconfig").get_path("purelib"))')"
TORCH_LIB_PATH="${SITE_PACKAGES}/torch/lib"
export LD_LIBRARY_PATH="${TORCH_LIB_PATH}:/usr/local/cuda/lib64:/usr/local/cuda/targets/x86_64-linux/lib/stubs${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
echo "ls ${TORCH_LIB_PATH}"; ls -lh "${TORCH_LIB_PATH}"
python -m pip install --force-reinstall git+https://github.com/XuehaiPan/auditwheel.git@torchopt
python -m auditwheel lddtree "{wheel}"
python -m auditwheel repair --no-copy-site-libs --wheel-dir="{dest_dir}" "{wheel}"
(
export LD_LIBRARY_PATH="${TORCH_LIB_PATH}:/usr/local/cuda/lib64:/usr/local/cuda/targets/x86_64-linux/lib/stubs${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
echo "ls ${TORCH_LIB_PATH}"; ls -lh "${TORCH_LIB_PATH}"
python -m pip install --force-reinstall git+https://github.com/XuehaiPan/auditwheel.git@torchopt
python -m auditwheel lddtree "{wheel}"
python -m auditwheel repair --no-copy-site-libs --wheel-dir="{dest_dir}" "{wheel}"
)
"""

# Linter tools #################################################################
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
torch == 1.12
torch >= 1.12
jax[cpu] >= 0.3
numpy
graphviz
Expand Down
4 changes: 2 additions & 2 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--extra-index-url https://download.pytorch.org/whl/cu116
torch == 1.12
torch >= 1.12
torchvision
functorch
functorch >= 0.2

--requirement ../requirements.txt

Expand Down
2 changes: 1 addition & 1 deletion torchopt/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# ==============================================================================
"""TorchOpt: a high-performance optimizer library built upon PyTorch."""

__version__ = '0.4.2'
__version__ = '0.4.3'
4 changes: 2 additions & 2 deletions tutorials/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--extra-index-url https://download.pytorch.org/whl/cu116
torch == 1.12
torch >= 1.12
torchvision
functorch
functorch >= 0.2

--requirement ../requirements.txt

Expand Down

0 comments on commit 0ab590e

Please sign in to comment.