f2py-jit


Namef2py-jit JSON
Version 0.10.2 PyPI version JSON
download
home_pagehttps://framagit.org/coslo/f2py-jit
SummaryJust-in-time Fortran extension builder for Python
upload_time2023-11-26 14:07:39
maintainer
docs_urlNone
authorDaniele Coslovich
requires_python
licenseGPLv3
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            f2py-jit
==================

[![pypi](https://img.shields.io/pypi/v/f2py-jit.svg)](https://pypi.python.org/pypi/f2py-jit/)
[![version](https://img.shields.io/pypi/pyversions/f2py-jit.svg)](https://pypi.python.org/pypi/f2py-jit/)
[![license](https://img.shields.io/pypi/l/f2py-jit.svg)](https://en.wikipedia.org/wiki/GNU_General_Public_License)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/git/https%3A%2F%2Fframagit.org%2Fcoslo%2Ff2py-jit/HEAD?labpath=docs%2Findex.ipynb)
[![pipeline status](https://framagit.org/coslo/f2py-jit/badges/master/pipeline.svg)](https://framagit.org/coslo/f2py-jit/-/commits/master)
[![coverage report](https://framagit.org/coslo/f2py-jit/badges/master/coverage.svg)](https://framagit.org/coslo/f2py-jit/-/commits/master)

Just-in-time compilation of Fortran code in Python via [f2py](https://numpy.org/doc/stable/f2py/).

Check out the [documentation](https://coslo.frama.io/f2py-jit/) for full details.

Quick start
-----------

Start from a piece of Fortran `code.f90`
```fortran
subroutine hello()
  print*, "Hello world!"
end subroutine
```

Compile the code, import it and execute it
```python
from f2py_jit import jit
f90 = jit('code.f90')
f90.hello()
```

Do the same but from a python string containing the source block
```python
source = """
subroutine hello()
  print*, "Hello world!"
end subroutine
"""
f90 = jit(source)
f90.hello()
```

If the Fortran source contains multiple subroutines calling each other, `f2py` will not perform interprocedural optimizations (at least not by default). `f2py_jit` can inline the source code before compiling it, and you will get a [performace boost](https://coslo.frama.io/f2py-jit/tutorial/#performance) [**This feature is experimental**]
```python
f90 = jit('code.f90', inline=True)
```

Features
--------
- Compilation of Fortran source blocks as Python strings
- Caching of module builds across executions
- Support for Fortran derived types via f90wrap
- Inlining to improve performance (experimental)

Dependencies
------------
- numpy
- f90wrap
- Fortran compiler

Installation
------------
From pip
```
pip install f2py-jit
```

From source
```
git clone https://framagit.org/coslo/f2py-jit.git
cd f2py_jit
make install
```

Credits
-------
Part of this code is adapted from `numpy.f2py` module by Pearu Peterson, in accordance with the NumPy license.

Authors
-------
Daniele Coslovich: https://www.units.it/daniele.coslovich/



            

Raw data

            {
    "_id": null,
    "home_page": "https://framagit.org/coslo/f2py-jit",
    "name": "f2py-jit",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Daniele Coslovich",
    "author_email": "daniele.coslovich@umontpellier.fr",
    "download_url": "",
    "platform": null,
    "description": "f2py-jit\n==================\n\n[![pypi](https://img.shields.io/pypi/v/f2py-jit.svg)](https://pypi.python.org/pypi/f2py-jit/)\n[![version](https://img.shields.io/pypi/pyversions/f2py-jit.svg)](https://pypi.python.org/pypi/f2py-jit/)\n[![license](https://img.shields.io/pypi/l/f2py-jit.svg)](https://en.wikipedia.org/wiki/GNU_General_Public_License)\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/git/https%3A%2F%2Fframagit.org%2Fcoslo%2Ff2py-jit/HEAD?labpath=docs%2Findex.ipynb)\n[![pipeline status](https://framagit.org/coslo/f2py-jit/badges/master/pipeline.svg)](https://framagit.org/coslo/f2py-jit/-/commits/master)\n[![coverage report](https://framagit.org/coslo/f2py-jit/badges/master/coverage.svg)](https://framagit.org/coslo/f2py-jit/-/commits/master)\n\nJust-in-time compilation of Fortran code in Python via [f2py](https://numpy.org/doc/stable/f2py/).\n\nCheck out the [documentation](https://coslo.frama.io/f2py-jit/) for full details.\n\nQuick start\n-----------\n\nStart from a piece of Fortran `code.f90`\n```fortran\nsubroutine hello()\n  print*, \"Hello world!\"\nend subroutine\n```\n\nCompile the code, import it and execute it\n```python\nfrom f2py_jit import jit\nf90 = jit('code.f90')\nf90.hello()\n```\n\nDo the same but from a python string containing the source block\n```python\nsource = \"\"\"\nsubroutine hello()\n  print*, \"Hello world!\"\nend subroutine\n\"\"\"\nf90 = jit(source)\nf90.hello()\n```\n\nIf the Fortran source contains multiple subroutines calling each other, `f2py` will not perform interprocedural optimizations (at least not by default). `f2py_jit` can inline the source code before compiling it, and you will get a [performace boost](https://coslo.frama.io/f2py-jit/tutorial/#performance) [**This feature is experimental**]\n```python\nf90 = jit('code.f90', inline=True)\n```\n\nFeatures\n--------\n- Compilation of Fortran source blocks as Python strings\n- Caching of module builds across executions\n- Support for Fortran derived types via f90wrap\n- Inlining to improve performance (experimental)\n\nDependencies\n------------\n- numpy\n- f90wrap\n- Fortran compiler\n\nInstallation\n------------\nFrom pip\n```\npip install f2py-jit\n```\n\nFrom source\n```\ngit clone https://framagit.org/coslo/f2py-jit.git\ncd f2py_jit\nmake install\n```\n\nCredits\n-------\nPart of this code is adapted from `numpy.f2py` module by Pearu Peterson, in accordance with the NumPy license.\n\nAuthors\n-------\nDaniele Coslovich: https://www.units.it/daniele.coslovich/\n\n\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "Just-in-time Fortran extension builder for Python",
    "version": "0.10.2",
    "project_urls": {
        "Homepage": "https://framagit.org/coslo/f2py-jit"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6144ddf0432f3ad16cb36153643214579db02a788b16b6396393cb1c716d4515",
                "md5": "7e5292053bd8fe8a0c8488e7ece8fa31",
                "sha256": "fbae1631daa65fc7a67cd017f9a6fc40ff96721ce74aa1fcee0e4f491350f060"
            },
            "downloads": -1,
            "filename": "f2py_jit-0.10.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7e5292053bd8fe8a0c8488e7ece8fa31",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 23861,
            "upload_time": "2023-11-26T14:07:39",
            "upload_time_iso_8601": "2023-11-26T14:07:39.607291Z",
            "url": "https://files.pythonhosted.org/packages/61/44/ddf0432f3ad16cb36153643214579db02a788b16b6396393cb1c716d4515/f2py_jit-0.10.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-26 14:07:39",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "f2py-jit"
}
        
Elapsed time: 0.13597s