pyccel/pyccel
Python extension language using accelerators
Featured achievements
The project's latest awards
#1 Repository of the month
#1 Repository of the month
#1 Repository of the month
Pyccel : write Python code, get Fortran speed
Pyccel stands for Python extension language using accelerators.
The aim of Pyccel is to provide a simple way to generate automatically, parallel low level code. The main uses would be:
- Convert a Python code (or project) into a Fortran or C code.
- Accelerate Python functions by converting them to Fortran or C functions.
Pyccel can be viewed as:
- Python-to-Fortran/C converter
- a compiler for a Domain Specific Language with Python syntax
Pyccel comes with a selection of extensions allowing you to convert calls to some specific Python packages to Fortran/C. The following packages will be (partially) covered:
numpyscipy
Pyccel's acceleration capabilities lead to much faster code. Comparisons of Python vs Pyccel or other tools can be found in the benchmarks repository.
The results for the devel branch currently show the following performance on Python 3.10:
If you are eager to try Pyccel out, we recommend reading our quick-start guide.
Citing Pyccel
If Pyccel has been significant in your research, and you would like to acknowledge the project in your academic publication, we would ask that you cite the following paper:
Bourne, Güçlü, Hadjout and Ratnani (2023). Pyccel: a Python-to-X transpiler for scientific high-performance computing. Journal of Open Source Software, 8(83), 4991, https://doi.org/10.21105/joss.04991
The associated bibtex can be found here.
Installation
Pyccel has a few system requirements to ensure that the system where it is installed is capable of compiling Fortran code. These requirements are detailed in the documentation. Once all requirements are satisfied, we recommend installing Pyccel into a Python virtual environment, which can be created with venv. Once the Python virtual environment is ready and activated, Pyccel can be easily installed using pip, the Python package installer. The simple command
pip install pyccel
will download the latest release of Pyccel from PyPI, the Python package index. Alternative installation methods such as installing from source, or installing with a docker, are described in the documentation.
Testing
It is good practice to test that Pyccel works as intended on the machine where it is installed.
To this end Pyccel provides an extended test suite which can be downloaded from the official repository.
Assuming the Python virtual environment is in the directory <ENV-PATH>, we activate it with
source <ENV-PATH>/bin/activate
and install the test component of the Pyccel package:
pip install "pyccel[test]"
This installs a few additional Python packages which are necessary for running the unit tests and getting a coverage report.
The recommended way of running the unit tests is simply using the command line tool pyccel test which is installed with Pyccel.
This runs all unit tests using Pytest under the hood.
Alternatively, if more fine-grained control over which tests are run is desired, e.g. for debugging local modifications to Pyccel, Pytest can be called directly using the commands provided in the documentation.
Environment variables affecting Pyccel's behaviour
Pyccel's behaviour is affected by some environment variables:
PYCCEL_DEFAULT_COMPILER: Changes the default compiler fromGNUto a new compiler family or JSON compiler configuration file.PYCCEL_CONFIG_HOME: Changes the default location for new compiler families from~/.pyccel.PYCCEL_ERROR_MODE: Can be set to 'developer' or 'user' to control the default verbosity of the errors.
Contributing
We welcome any and all contributions.
There are many ways to help with the Pyccel project which are more or less involved. A summary can be found in the documentation.
We can also be contacted via the Pyccel Discord Server.
Similar Projects
Discover other similar projects and AI models.
:octocat: 分享 GitHub 上有趣、入门级的开源项目。Share interesting, entry-level open source projects on GitHub.
Reverse engineer anything with agents, from app behavior down to native binaries.
The 30 Days of Python programming challenge is a step-by-step guide to learn the Python programming language in 30 days. This challenge may take more than 100 days. Follow your own pace. These videos may help too: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
DSL and compiler framework for automated finite-differences and stencil computation
Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.
The definitive list that answers "I want to do X in Python, which tool should I use?"