Skip to main content

No project description provided

Project description

f2py-jit

pypi version license Binder pipeline status coverage report

Just-in-time compilation of Fortran code in Python via f2py.

Documentation

Quick start

Start from a piece of Fortran code.f90

subroutine hello()
  print*, "Hello world!"
end subroutine

Compile the code, import it and execute it

from f2py_jit import jit
f90 = jit('code.f90')
f90.hello()

Do the same but from a python string containing the source block

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 [This feature is experimental]

f90 = jit('code.f90', inline=True)

Features

  • Compilation of source blocks as python strings
  • Caching of module builds across executions
  • Optional inlining to improve performance (experimental)

Dependencies

  • numpy
  • 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/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

f2py_jit-0.8.5-py2.py3-none-any.whl (23.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file f2py_jit-0.8.5-py2.py3-none-any.whl.

File metadata

  • Download URL: f2py_jit-0.8.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for f2py_jit-0.8.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d54dda120600be0a204a652d2972e5b5089347a830a2844b9123753182eff33f
MD5 0814bb0c067cd377e07a411070e5d90a
BLAKE2b-256 1d18f3ca6b8a4b321b5101d3a8052205a20f3a4dc7219d922e0b864cd215b35f

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page