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 90 source contains multiple subroutines calling one another, f2py
will not perform interprocedural optimizations (at least not by default). f2py_jit
can inline the source code before compiling it, and you should get a little performace boost [This feature is experimental, check the results]
from f2py_jit import jit, inline
f90 = jit(inline('code.f90'))
f90.hello()
Features
- Compilation of source blocks as python strings
- Caching of modules build across executions
- Optional inlining of Fortran code to improve performance (experimental)
Dependencies
- numpy
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
File details
Details for the file f2py_jit-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: f2py_jit-0.5.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d13a41b1466b94339d73436b5d5f62ab46d433887e3aae74fcb3726030ff1b6d |
|
MD5 | 1feaeca2c269c1f17b1dd49c93045857 |
|
BLAKE2b-256 | 15d8de6b6cdb1e3d5a274834816a97f6b3cf6750dd94d03312ecf86451b2a211 |