transonic


Nametransonic JSON
Version 0.7.2 PyPI version JSON
download
home_pageNone
SummaryMake your Python code fly at transonic speeds!
upload_time2024-08-26 14:58:09
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseBSD License
keywords pythran
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Make your Python code fly at *transonic* speeds!

[![Latest version](https://badge.fury.io/py/transonic.svg)](https://pypi.python.org/pypi/transonic/)
[![Code coverage](https://codecov.io/gh/fluiddyn/transonic/branch/branch%2Fdefault/graph/badge.svg)](https://codecov.io/gh/fluiddyn/transonic)
[![Documentation status](https://readthedocs.org/projects/transonic/badge/?version=latest)](http://transonic.readthedocs.org)
![Supported Python versions](https://img.shields.io/pypi/pyversions/transonic.svg)
[![Heptapod CI](https://foss.heptapod.net/fluiddyn/transonic/badges/branch/default/pipeline.svg)](https://foss.heptapod.net/fluiddyn/transonic/-/pipelines)
[![Github Actions](https://github.com/fluiddyn/transonic/actions/workflows/ci-linux.yml/badge.svg?branch=branch/default)](https://github.com/fluiddyn/transonic/actions)
[![mybinder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/fluiddyn/transonic/branch/default?urlpath=lab/tree/doc/ipynb/executed)
[![sonarcloud](https://sonarcloud.io/api/project_badges/measure?project=fluiddyn_transonic&metric=alert_status)](https://sonarcloud.io/dashboard?id=fluiddyn_transonic)

<!-- [![Github Actions](https://github.com/fluiddyn/transonic/actions/workflows/ci.yml/badge.svg?branch=branch/default)](https://github.com/fluiddyn/transonic/actions) -->

**Documentation**: <https://transonic.readthedocs.io>

<!-- start short description -->

Transonic is a pure Python package (requiring Python >= 3.9) to easily accelerate modern
Python-Numpy code with different accelerators (currently [Cython], [Pythran], [Numba] and
[JAX], but potentially later [Cupy], [PyTorch], [Weld], [Pyccel], etc...).

**The accelerators are not hard dependencies of Transonic:** Python codes using Transonic
run fine without any accelerators installed (of course without speedup)!

<!-- end short description -->

> [!WARNING] Transonic is still in an active development stage (see our
> [roadmap](https://transonic.readthedocs.io/en/latest/roadmap.html)). Remarks and
> suggestions are very welcome.
>
> However, Transonic is now really usable, useful and used "in production" in
> [FluidSim](https://foss.heptapod.net/fluiddyn/fluidsim) and
> [FluidFFT](https://foss.heptapod.net/fluiddyn/fluidfft) (see examples for
> [blocks](https://foss.heptapod.net/fluiddyn/fluidsim/src/default/fluidsim/base/time_stepping/pseudo_spect.py)
> and
> [@boost](https://foss.heptapod.net/fluiddyn/fluidfft/src/default/fluidfft/fft3d/operators.py)).

## The long-term project

> [!NOTE] The context of the creation of Transonic is presented in these documents:
>
> - [Transonic Vision](https://fluiddyn.netlify.app/transonic-vision.html)
> - [Make your numerical Python code fly at transonic speed (EuroScipy 2019)](http://www.legi.grenoble-inp.fr/people/Pierre.Augier/docs/ipynbslides/20190904-euroscipy-transonic/pres.slides.html#/),
> - [Overview of the Python HPC landscape and zoom on Transonic](http://www.legi.grenoble-inp.fr/people/Pierre.Augier/docs/ipynbslides/20190319_PySciDataGre_transonic/pres_20190319_PySciDataGre_transonic.slides.html).

Transonic targets Python end-users and library developers.

It is based on the following principles:

- We'd like to write scientific / computing applications / libraries with pythonic,
  readable, modern code (Python >= 3.6).

- In some cases, Python-Numpy is too slow. However, there are tools to accelerate such
  Python-Numpy code which lead to very good performances!

- Let's try to write universal code which express what we want to compute and not the
  special hacks we want to use to make it fast. We just need nice ways to express that a
  function, a method or a block of code has to be accelerated (and how it has to be
  accelerated). We'd like to be able to do this in a pythonic way, with decorators and
  context managers.

- There are many tools to accelerate Python-Numpy code! Let's avoid writting code
  specialized for only one of these tools.

- Let's try to keep the code as it would be written without acceleration. For example,
  with Transonic, we are able to accelerate (simple) methods of classes even though some
  accelerators don't support classes.

- Let's accelerate/compile only what needs to be accelerated, i.e. only the bottlenecks.
  Python and its interpreters are good for the rest. In most cases, the benefice of
  writting big compiled extensions (with Cython or in other languages) is negligible.

- Adding types is sometimes necessary. In modern Python, we have nice syntaxes for type
  annotations! Let's use them.

- Ahead-of-time (AOT) and just-in-time (JIT) compilation modes are both useful. We'd like
  to have a nice, simple and unified API for these two modes.

  - AOT is useful to be able to distribute compiled packages and in some cases, more
    optimizations can be applied.
  - JIT is simpler to use (no need for type annotations) and optimizations can be more
    hardware specific.

  Note that with Transonic, AOT compilers (Pythran and Cython) can be used as JIT
  compilers (with a cache mechanism).

To summarize, a **strategy to quickly develop a very efficient scientific
application/library** with Python could be:

1. Use modern Python coding, standard Numpy/Scipy for the computations and all the cool
   libraries you want.
2. Profile your applications on real cases, detect the bottlenecks and apply standard
   optimizations with Numpy.
3. Add few lines of Transonic to compile the hot spots.

## What we have now

We start to have a good API to accelerate Python-Numpy code (functions, methods and
blocks of code). The default Transonic backend uses Pythran and works well.
[Here, we explain why Pythran is so great for Python users and why Transonic is great for Pythran users](https://transonic.readthedocs.io/en/latest/backends/pythran.html).
There are also (more experimental) backends for Cython and Numba.

> [!NOTE] Transonic can be used in libraries and applications using MPI (as
> [FluidSim](https://foss.heptapod.net/fluiddyn/fluidsim)).

## Installation and configuration

```bash
pip install transonic
```

Transonic is sensible to environment variables:

- `TRANSONIC_DIR` can be set to control where the cached files are saved.
- `TRANSONIC_DEBUG` triggers a verbose mode.
- `TRANSONIC_COMPILE_AT_IMPORT` can be set to enable a mode for which Transonic compiles
  at import time the Pythran file associated with the imported module. This behavior can
  also be triggered programmatically by using the function `set_compile_at_import`.
- `TRANSONIC_NO_REPLACE` can be set to disable all code replacements. This is useful to
  compare execution times and when measuring code coverage.
- `TRANSONIC_COMPILE_JIT` can be set to false to disable the compilation of jited
  functions. This can be useful for unittests.
- `TRANSONIC_BACKEND` to choose between the supported backends. The default backend
  "pythran" is quite robust. There are now 3 other backends: "cython", "numba" and
  "python" (prototypes).
- `TRANSONIC_MPI_TIMEOUT` sets the MPI timeout (default to 5 s).

## License

Transonic is distributed under the BSD License.

[cupy]: https://cupy.chainer.org/
[cython]: https://cython.org/
[jax]: https://github.com/google/jax
[numba]: https://numba.pydata.org/
[pyccel]: https://github.com/pyccel/pyccel
[pythran]: https://github.com/serge-sans-paille/pythran
[pytorch]: https://pytorch.org/
[weld]: https://github.com/weld-project/weld

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "transonic",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "pythran",
    "author": null,
    "author_email": "Pierre Augier <pierre.augier@univ-grenoble-alpes.fr>",
    "download_url": "https://files.pythonhosted.org/packages/60/d0/ba73c22637d4931d230aa769f2c14e1b8f889819a76702c0633cb063bd6b/transonic-0.7.2.tar.gz",
    "platform": null,
    "description": "# Make your Python code fly at *transonic* speeds!\n\n[![Latest version](https://badge.fury.io/py/transonic.svg)](https://pypi.python.org/pypi/transonic/)\n[![Code coverage](https://codecov.io/gh/fluiddyn/transonic/branch/branch%2Fdefault/graph/badge.svg)](https://codecov.io/gh/fluiddyn/transonic)\n[![Documentation status](https://readthedocs.org/projects/transonic/badge/?version=latest)](http://transonic.readthedocs.org)\n![Supported Python versions](https://img.shields.io/pypi/pyversions/transonic.svg)\n[![Heptapod CI](https://foss.heptapod.net/fluiddyn/transonic/badges/branch/default/pipeline.svg)](https://foss.heptapod.net/fluiddyn/transonic/-/pipelines)\n[![Github Actions](https://github.com/fluiddyn/transonic/actions/workflows/ci-linux.yml/badge.svg?branch=branch/default)](https://github.com/fluiddyn/transonic/actions)\n[![mybinder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/fluiddyn/transonic/branch/default?urlpath=lab/tree/doc/ipynb/executed)\n[![sonarcloud](https://sonarcloud.io/api/project_badges/measure?project=fluiddyn_transonic&metric=alert_status)](https://sonarcloud.io/dashboard?id=fluiddyn_transonic)\n\n<!-- [![Github Actions](https://github.com/fluiddyn/transonic/actions/workflows/ci.yml/badge.svg?branch=branch/default)](https://github.com/fluiddyn/transonic/actions) -->\n\n**Documentation**: <https://transonic.readthedocs.io>\n\n<!-- start short description -->\n\nTransonic is a pure Python package (requiring Python >= 3.9) to easily accelerate modern\nPython-Numpy code with different accelerators (currently [Cython], [Pythran], [Numba] and\n[JAX], but potentially later [Cupy], [PyTorch], [Weld], [Pyccel], etc...).\n\n**The accelerators are not hard dependencies of Transonic:** Python codes using Transonic\nrun fine without any accelerators installed (of course without speedup)!\n\n<!-- end short description -->\n\n> [!WARNING] Transonic is still in an active development stage (see our\n> [roadmap](https://transonic.readthedocs.io/en/latest/roadmap.html)). Remarks and\n> suggestions are very welcome.\n>\n> However, Transonic is now really usable, useful and used \"in production\" in\n> [FluidSim](https://foss.heptapod.net/fluiddyn/fluidsim) and\n> [FluidFFT](https://foss.heptapod.net/fluiddyn/fluidfft) (see examples for\n> [blocks](https://foss.heptapod.net/fluiddyn/fluidsim/src/default/fluidsim/base/time_stepping/pseudo_spect.py)\n> and\n> [@boost](https://foss.heptapod.net/fluiddyn/fluidfft/src/default/fluidfft/fft3d/operators.py)).\n\n## The long-term project\n\n> [!NOTE] The context of the creation of Transonic is presented in these documents:\n>\n> - [Transonic Vision](https://fluiddyn.netlify.app/transonic-vision.html)\n> - [Make your numerical Python code fly at transonic speed (EuroScipy 2019)](http://www.legi.grenoble-inp.fr/people/Pierre.Augier/docs/ipynbslides/20190904-euroscipy-transonic/pres.slides.html#/),\n> - [Overview of the Python HPC landscape and zoom on Transonic](http://www.legi.grenoble-inp.fr/people/Pierre.Augier/docs/ipynbslides/20190319_PySciDataGre_transonic/pres_20190319_PySciDataGre_transonic.slides.html).\n\nTransonic targets Python end-users and library developers.\n\nIt is based on the following principles:\n\n- We'd like to write scientific / computing applications / libraries with pythonic,\n  readable, modern code (Python >= 3.6).\n\n- In some cases, Python-Numpy is too slow. However, there are tools to accelerate such\n  Python-Numpy code which lead to very good performances!\n\n- Let's try to write universal code which express what we want to compute and not the\n  special hacks we want to use to make it fast. We just need nice ways to express that a\n  function, a method or a block of code has to be accelerated (and how it has to be\n  accelerated). We'd like to be able to do this in a pythonic way, with decorators and\n  context managers.\n\n- There are many tools to accelerate Python-Numpy code! Let's avoid writting code\n  specialized for only one of these tools.\n\n- Let's try to keep the code as it would be written without acceleration. For example,\n  with Transonic, we are able to accelerate (simple) methods of classes even though some\n  accelerators don't support classes.\n\n- Let's accelerate/compile only what needs to be accelerated, i.e. only the bottlenecks.\n  Python and its interpreters are good for the rest. In most cases, the benefice of\n  writting big compiled extensions (with Cython or in other languages) is negligible.\n\n- Adding types is sometimes necessary. In modern Python, we have nice syntaxes for type\n  annotations! Let's use them.\n\n- Ahead-of-time (AOT) and just-in-time (JIT) compilation modes are both useful. We'd like\n  to have a nice, simple and unified API for these two modes.\n\n  - AOT is useful to be able to distribute compiled packages and in some cases, more\n    optimizations can be applied.\n  - JIT is simpler to use (no need for type annotations) and optimizations can be more\n    hardware specific.\n\n  Note that with Transonic, AOT compilers (Pythran and Cython) can be used as JIT\n  compilers (with a cache mechanism).\n\nTo summarize, a **strategy to quickly develop a very efficient scientific\napplication/library** with Python could be:\n\n1. Use modern Python coding, standard Numpy/Scipy for the computations and all the cool\n   libraries you want.\n2. Profile your applications on real cases, detect the bottlenecks and apply standard\n   optimizations with Numpy.\n3. Add few lines of Transonic to compile the hot spots.\n\n## What we have now\n\nWe start to have a good API to accelerate Python-Numpy code (functions, methods and\nblocks of code). The default Transonic backend uses Pythran and works well.\n[Here, we explain why Pythran is so great for Python users and why Transonic is great for Pythran users](https://transonic.readthedocs.io/en/latest/backends/pythran.html).\nThere are also (more experimental) backends for Cython and Numba.\n\n> [!NOTE] Transonic can be used in libraries and applications using MPI (as\n> [FluidSim](https://foss.heptapod.net/fluiddyn/fluidsim)).\n\n## Installation and configuration\n\n```bash\npip install transonic\n```\n\nTransonic is sensible to environment variables:\n\n- `TRANSONIC_DIR` can be set to control where the cached files are saved.\n- `TRANSONIC_DEBUG` triggers a verbose mode.\n- `TRANSONIC_COMPILE_AT_IMPORT` can be set to enable a mode for which Transonic compiles\n  at import time the Pythran file associated with the imported module. This behavior can\n  also be triggered programmatically by using the function `set_compile_at_import`.\n- `TRANSONIC_NO_REPLACE` can be set to disable all code replacements. This is useful to\n  compare execution times and when measuring code coverage.\n- `TRANSONIC_COMPILE_JIT` can be set to false to disable the compilation of jited\n  functions. This can be useful for unittests.\n- `TRANSONIC_BACKEND` to choose between the supported backends. The default backend\n  \"pythran\" is quite robust. There are now 3 other backends: \"cython\", \"numba\" and\n  \"python\" (prototypes).\n- `TRANSONIC_MPI_TIMEOUT` sets the MPI timeout (default to 5 s).\n\n## License\n\nTransonic is distributed under the BSD License.\n\n[cupy]: https://cupy.chainer.org/\n[cython]: https://cython.org/\n[jax]: https://github.com/google/jax\n[numba]: https://numba.pydata.org/\n[pyccel]: https://github.com/pyccel/pyccel\n[pythran]: https://github.com/serge-sans-paille/pythran\n[pytorch]: https://pytorch.org/\n[weld]: https://github.com/weld-project/weld\n",
    "bugtrack_url": null,
    "license": "BSD License",
    "summary": "Make your Python code fly at transonic speeds!",
    "version": "0.7.2",
    "project_urls": {
        "Documentation": "https://transonic.readthedocs.io",
        "Git mirror": "https://github.com/fluiddyn/transonic",
        "Source": "https://foss.heptapod.net/fluiddyn/transonic"
    },
    "split_keywords": [
        "pythran"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b475f3b9fe19c1cc5365b8f1b2f8d1e6b3a9bdc96f9bcf120eee4ff2acb1adba",
                "md5": "83095afc68e001d11f64ea9908bbb379",
                "sha256": "5e7ad061da05b633ce743215da78e207131956182de57066278526f4e381da47"
            },
            "downloads": -1,
            "filename": "transonic-0.7.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "83095afc68e001d11f64ea9908bbb379",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 76486,
            "upload_time": "2024-08-26T14:58:08",
            "upload_time_iso_8601": "2024-08-26T14:58:08.240108Z",
            "url": "https://files.pythonhosted.org/packages/b4/75/f3b9fe19c1cc5365b8f1b2f8d1e6b3a9bdc96f9bcf120eee4ff2acb1adba/transonic-0.7.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "60d0ba73c22637d4931d230aa769f2c14e1b8f889819a76702c0633cb063bd6b",
                "md5": "b4e9b0832470d96a302c67125916b17d",
                "sha256": "d0c39c13b535df4f121a8a378efc42e3d3bf4e49536d131e6d26e9fe7d5a5bf4"
            },
            "downloads": -1,
            "filename": "transonic-0.7.2.tar.gz",
            "has_sig": false,
            "md5_digest": "b4e9b0832470d96a302c67125916b17d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 72217,
            "upload_time": "2024-08-26T14:58:09",
            "upload_time_iso_8601": "2024-08-26T14:58:09.806708Z",
            "url": "https://files.pythonhosted.org/packages/60/d0/ba73c22637d4931d230aa769f2c14e1b8f889819a76702c0633cb063bd6b/transonic-0.7.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-26 14:58:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fluiddyn",
    "github_project": "transonic",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "appveyor": true,
    "lcname": "transonic"
}
        
Elapsed time: 1.32996s