https://github.com/pyccel/pyccel Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Issues - + Integrations - + GitHub Sponsors - + Customer stories- * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Education - [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} pyccel / pyccel Public * Notifications * Star 118 * Fork 11 Python extension language using accelerators MIT License 118 stars 11 forks Star Notifications * Code * Issues 101 * Pull requests 10 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 33 branches 31 tags Code Latest commit @EmilyBourne EmilyBourne Allow for instructions in a module (#949) ... f4d919e Sep 16, 2021 Allow for instructions in a module (#949) All statements which are not in a function are collected into an initialisation function. All statements which are bookmarked by `if __name__ == '__main__'` are placed into a program. This program is printed in a separate file to the module to ensure everything can be compiled. Fixes #739, fixes #740 and fixes #653. **Commit Summary** - Add .lock files to `.gitignore` - Add `AsName.__repr__` function - Allow `CodeBlock.insert2body` to insert multiple objects - Add `init_func`, `free_func` and `program` to `Module` class - Add `InProgram` class to represent `__name__ == '__main__'` - Remove `ParserResult` which stored a `Module` and a `Program`, now (as in python) everything is in `Module` - Add `is_private` property to `Variable` - Fix compiling to include the fact that a file can have a program target and a module/shared library target - Add `if __name__ == '__main__'` to all tests which generate executables - Add `_print_Deallocate` to `FCodePrinter` to ensure modules can be deallocated - Add test to pyccel/ folder to ensure that modules are correctly initialised when they are imported f4d919e Git stats * 2,677 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github Allow for instructions in a module (#949) Sep 16, 2021 bugs [REPORT BUG] arrays in functions May 8, 2018 doc Devel ast (#266) May 4, 2020 inprogress add tests for preprocess Apr 21, 2018 obsolete Remove unnecessary dependencies (#379) Aug 5, 2020 pyccel Allow for instructions in a module (#949) Sep 16, 2021 samples Use pythonic syntax in OpenMP pragmas (#523) Dec 3, 2020 tests Allow for instructions in a module (#949) Sep 16, 2021 tutorial Clean compilation (#928) Aug 6, 2021 .codacy.yml Use correct precision when printing integers (#446) Oct 1, 2020 .gitignore Allow for instructions in a module (#949) Sep 16, 2021 .pylintrc Unravel loops when necessary (#623) Feb 16, 2021 .travis.yml Remove f2py (#527) Nov 10, 2020 AUTHORS Update authors and add copyright (#592) Dec 17, 2020 CHANGES doc Dec 11, 2017 LICENSE Update authors and add copyright (#592) Dec 17, 2020 MANIFEST.in Enable including of Pyccel internal libraries (#562) Dec 11, 2020 README.rst Do not require that there is a comment before an else block (#837) May 18, 2021 TODO.rst pure functions Oct 26, 2018 bandit.yml Pickle header files' parser (#554) Nov 30, 2020 pytest.ini Speed up unit tests by running them in parallel with pytest-xdist (# 807) Mar 22, 2021 setup.py Speed up unit tests by running them in parallel with pytest-xdist (# 807) Mar 22, 2021 View code [ ] Welcome to Pyccel Pyccel Installation Methods Requirements Linux Debian/Ubuntu/Mint Linux Fedora/CentOS/RHEL Mac OS X Windows Installation From PyPi From sources Additional packages Testing Pyccel Container Images README.rst Welcome to Pyccel build status Codacy Badge 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: 1. Convert a Python code (or project) into a Fortran or C code. 2. 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 covered (partially): * numpy * scipy * mpi4py * h5py (not available yet) If you are eager to try Pyccel out, we recommend reading our quick-start guide! Pyccel Installation Methods Pyccel can be installed on virtually any machine that provides Python 3, the pip package manager, a C/Fortran compiler, and an Internet connection. Some advanced features of Pyccel require additional non-Python libraries to be installed, for which we provide detailed instructions below. Alternatively, Pyccel can be deployed through a Linux Docker image that contains all dependencies, and which can be setup with any version of Pyccel. For more information, please read the section on Pyccel container images. Requirements First of all, Pyccel requires a working Fortran/C compiler For Fortran it supports * GFortran * Intel(r) Fortran Compiler * PGI Fortran For C it supports * GCC * Intel(r) Compiler * PGI In order to perform fast linear algebra calculations, Pyccel uses the following libraries: * BLAS (Basic Linear Algebra Subprograms) * LAPACK (Linear Algebra PACKage) Finally, Pyccel supports distributed-memory parallel programming through the Message Passing Interface (MPI) standard; hence it requires an MPI library like * Open-MPI * MPICH * Intel(r) MPI Library We recommend using GFortran/GCC and Open-MPI. Pyccel also depends on several Python3 packages, which are automatically downloaded by pip, the Python Package Installer, during the installation process. In addition to these, unit tests require the scipy, mpi4py, pytest and coverage packages, while building the documentation requires Sphinx . Linux Debian/Ubuntu/Mint To install all requirements on a Linux Ubuntu machine, just use APT, the Advanced Package Tool: sudo apt update sudo apt install gcc sudo apt install gfortran sudo apt install libblas-dev liblapack-dev sudo apt install libopenmpi-dev openmpi-bin Linux Fedora/CentOS/RHEL Install all requirements using the DNF software package manager: su dnf check-update dnf install gcc dnf install gfortran dnf install blas-devel lapack-devel dnf install openmpi-devel exit Similar commands work on Linux openSUSE, just replace dnf with zypper. Mac OS X On an Apple Macintosh machine we recommend using Homebrew : brew update brew install gcc brew install openblas brew install lapack brew install open-mpi This requires that the Command Line Tools (CLT) for Xcode are installed. Windows Support for Windows is still experimental, and the installation of all requirements is more cumbersome. We recommend using Chocolatey < https://chocolatey.org/> to speed up the process, and we provide commands that work in a git-bash shell. In an Administrator prompt install git-bash (if needed), a Python3 Anaconda distribution, and a GCC compiler: choco install git choco install anaconda3 choco install mingw Download x64 BLAS and LAPACK DLLs from https://icl.cs.utk.edu/ lapack-for-windows/lapack/: WEB_ADDRESS=https://icl.cs.utk.edu/lapack-for-windows/libraries/VisualStudio/3.7.0/Dynamic-MINGW/Win64 LIBRARY_DIR=/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib curl $WEB_ADDRESS/libblas.dll -o $LIBRARY_DIR/libblas.dll curl $WEB_ADDRESS/liblapack.dll -o $LIBRARY_DIR/liblapack.dll Generate static MS C runtime library from corresponding dynamic link library: cd "$LIBRARY_DIR" cp $SYSTEMROOT/SysWOW64/vcruntime140.dll . gendef vcruntime140.dll dlltool -d vcruntime140.def -l libmsvcr140.a -D vcruntime140.dll cd - Download MS MPI runtime and SDK, then install MPI: WEB_ADDRESS=https://github.com/microsoft/Microsoft-MPI/releases/download/v10.1.1 curl -L $WEB_ADDRESS/msmpisetup.exe -o msmpisetup.exe curl -L $WEB_ADDRESS/msmpisdk.msi -o msmpisdk.msi ./msmpisetup.exe msiexec //i msmpisdk.msi At this point, close and reopen your terminal to refresh all environment variables! In Administrator git-bash, generate mpi.mod for gfortran according to https://abhilashreddy.com/writing/3/mpi_instructions.html: cd "$MSMPI_INC" sed -i 's/mpifptr.h/x64\/mpifptr.h/g' mpi.f90 sed -i 's/mpifptr.h/x64\/mpifptr.h/g' mpif.h gfortran -c -D_WIN64 -D INT_PTR_KIND\(\)=8 -fno-range-check mpi.f90 cd - Generate static libmsmpi.a from msmpi.dll: cd "$MSMPI_LIB64" cp $SYSTEMROOT/SysWOW64/msmpi.dll . gendef msmpi.dll dlltool -d msmpi.def -l libmsmpi.a -D msmpi.dll cd - Before installing Pyccel and using it, the Anaconda environment should be activated with: source /c/tools/Anaconda3/etc/profile.d/conda.sh conda activate On Windows and/or Anaconda Python, use pip instead of pip3 for the Installation of pyccel below. Installation From PyPi Simply run, for a user-specific installation: pip3 install --user pyccel or: sudo pip3 install pyccel for a system-wide installation. From sources * Standard mode: git clone git@github.com:pyccel/pyccel.git cd pyccel pip3 install --user . * Development mode: git clone git@github.com:pyccel/pyccel.git cd pyccel pip3 install --user -e . this will install a python library pyccel and a binary called pyccel. Any required Python packages will be installed automatically from PyPI. Additional packages In order to run the unit tests and to get a coverage report, a few additional Python packages should be installed:: pip3 install --user scipy pip3 install --user mpi4py pip3 install --user tblib pip3 install --user pytest pip3 install --user astunparse pip3 install --user coverage Most of the unit tests can also be run in parallel. This can be done by installing one additional package: pip3 install --user pytest-xdist Testing To test your Pyccel installation please run the script tests/ run_tests_py3.sh (Unix), or tests/run_tests.bat (Windows). Continuous testing runs on github actions: Pyccel Container Images Pyccel container images are available through both Docker Hub (docker.io) and the GitHub Container Registry (ghcr.io). The images: * are based on ubuntu:latest * use distro packaged python3, gcc, gfortran, blas and openmpi * support all pyccel releases except the legacy "0.1" Image tags match pyccel releases. In order to implement your pyccel accelerated code, you can use a host based volume during the pyccel container creation. For example: docker pull pyccel/pyccel:v1.0.0 docker run -it -v $PWD:/data:rw pyccel/pyccel:v1.0.0 bash If you are using SELinux, you will need to set the right context for your host based volume. Alternatively you may have docker or podman set the context using -v $PWD:/data:rwz instead of -v $PWD:/data:rw . About Python extension language using accelerators Topics fortran hpc dsl openmp mpi sympy openacc Resources Readme License MIT License Releases 31 v1.3.1: Update compilation configuration (#938) Latest Aug 24, 2021 + 30 releases Packages 0 No packages published Contributors 17 * @ratnania * @saidctb * @ratnani * @EmilyBourne * @yguclu * @MostafaMamouni * @MenoIy * @krystophny * @saniQQ * @nhamidn * @rakati + 6 contributors Languages * Python 92.1% * CMake 4.9% * C 2.8% * Other 0.2% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.