No project description provided
Project description
f2py-jit
Just-in-time compilation of Fortran code in Python via f2py.
Quick start
Start from a piece of Fortran code.f90
subroutine hello()
print*, "Hello world!"
end subroutine hello
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 hello
"""
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]
from f2py_jit import jit, inline
f90 = jit(inline('code.f90'))
f90.hello()
Documentation
Features
- Compilation of source blocks as python strings
- Caching of modules build across executions
- Optional inlining of Fortran code to improve performance (experimental)
Documentation
Check out the tutorial for more examples and the public API for full details.
The tutorial can be executed live on binder.
Dependencies
- numpy
- Fortran compiler
Installation
The easiest way to install f2py-jit is with pip
pip install f2py-jit
Alternately, you can clone the code repository and install from source
git clone https://framagit.org/coslo/f2py-jit.git
cd f2py_jit
make install
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
Hashes for f2py_jit-0.7.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ac11210b3a9ca30977d3a4501e54952745c771c0e6cb5d90e11e4572b8d8ec0 |
|
MD5 | 0101d806c9d33f53a1ec75cc2e1c59bf |
|
BLAKE2b-256 | 17c6497c1e026ab852e867ed9530064f1486d34a4abb3a596d1f86cfdfdd2749 |