Just-in-time Fortran extension builder for Python
Project description
f2py-jit
Just-in-time compilation of Fortran code in Python via f2py.
Check out the documentation for full details.
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 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/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file f2py_jit-0.10.1-py2.py3-none-any.whl
.
File metadata
- Download URL: f2py_jit-0.10.1-py2.py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a70c2f1c09dd6829117b1f75ea031a0adc2d0bbd455048271816b8cac2c4b460 |
|
MD5 | f08fc51186c98191da1ad0bce090dbad |
|
BLAKE2b-256 | 84ee3613d1d4f114e9e08f54aa3401f79785501ac20036ce7b70571b2074838b |