{"id":17632751,"url":"https://github.com/pypr/compyle","last_synced_at":"2025-04-04T23:08:23.212Z","repository":{"id":33620626,"uuid":"160086953","full_name":"pypr/compyle","owner":"pypr","description":"Execute a subset of Python on HPC platforms","archived":false,"fork":false,"pushed_at":"2025-03-20T17:50:47.000Z","size":547,"stargazers_count":69,"open_issues_count":7,"forks_count":14,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-28T22:13:34.721Z","etag":null,"topics":["cuda","cython","high-performance-computing","opencl","openmp","python","transpile"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pypr.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-02T19:54:41.000Z","updated_at":"2025-03-20T17:50:52.000Z","dependencies_parsed_at":"2023-01-15T01:41:16.978Z","dependency_job_id":"483490aa-0a8d-4b65-b203-322903c947cf","html_url":"https://github.com/pypr/compyle","commit_stats":{"total_commits":346,"total_committers":13,"mean_commits":"26.615384615384617","dds":0.5173410404624277,"last_synced_commit":"e6584827c2d45b0ee792500a0f9b10b59976782c"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pypr%2Fcompyle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pypr%2Fcompyle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pypr%2Fcompyle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pypr%2Fcompyle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pypr","download_url":"https://codeload.github.com/pypr/compyle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247261606,"owners_count":20910108,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cuda","cython","high-performance-computing","opencl","openmp","python","transpile"],"created_at":"2024-10-23T01:45:32.301Z","updated_at":"2025-04-04T23:08:23.196Z","avatar_url":"https://github.com/pypr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Compyle: execute a subset of Python on HPC platforms\n======================================================\n\n|CI Status| |Coverage Status| |Documentation Status|\n\n\n.. |CI Status| image:: https://github.com/pypr/compyle/actions/workflows/tests.yml/badge.svg\n    :target: https://github.com/pypr/compyle/actions/workflows/tests.yml\n.. |Documentation Status| image:: https://readthedocs.org/projects/compyle/badge/?version=latest\n    :target: https://compyle.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n.. |Coverage Status| image:: https://codecov.io/gh/pypr/compyle/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/pypr/compyle\n\nCompyle allows users to execute a restricted subset of Python (almost similar\nto C) on a variety of HPC platforms. Currently we support multi-core CPU\nexecution using Cython, and for GPU devices we use OpenCL or CUDA.\n\nUsers start with code implemented in a very restricted Python syntax, this code\nis then automatically transpiled, compiled and executed to run on either one CPU\ncore, or multiple CPU cores (via OpenMP_) or on a GPU. Compyle offers\nsource-to-source transpilation, making it a very convenient tool for writing HPC\nlibraries.\n\nSome simple yet powerful parallel utilities are provided which can allow you\nto solve a remarkably large number of interesting HPC problems. Compyle also\nfeatures JIT transpilation making it easy to use.\n\nDocumentation and learning material is also available in the form of:\n\n- Documentation at: https://compyle.readthedocs.io\n\n- An introduction to compyle in the context of writing a parallel molecular\n  dynamics simulator is in our `SciPy 2020 paper\n  \u003chttp://conference.scipy.org/proceedings/scipy2020/compyle_pr_ab.html\u003e`_.\n\n- `Compyle poster presentation \u003chttps://docs.google.com/presentation/d/1LS9XO5pQXz8G5d27RP5oWLFxUA-Fr5OvfVUGsgg86TQ/edit#slide=id.p\u003e`_\n\n- You may also try Compyle online for free on a `Google Colab notebook`_.\n\nWhile Compyle seems simple it is not a toy and is used heavily by the PySPH_\nproject where Compyle has its origins.\n\n.. _PySPH: https://github.com/pypr/pysph\n.. _Google Colab notebook: https://colab.research.google.com/drive/1SGRiArYXV1LEkZtUeg9j0qQ21MDqQR2U?usp=sharing\n\n\nInstallation\n-------------\n\nCompyle is itself largely pure Python but depends on numpy_ and requires\neither Cython_ or PyOpenCL_ or PyCUDA_ along with the respective backends of a\nC/C++ compiler, OpenCL and CUDA. If you are only going to execute code on a\nCPU then all you need is Cython.\n\nYou should be able to install Compyle by doing::\n\n  $ pip install compyle\n\n\n.. _PyOpenCL: https://documen.tician.de/pyopencl/\n.. _OpenCL: https://www.khronos.org/opencl/\n.. _Cython: http://www.cython.org\n.. _numpy: http://www.numpy.org\n.. _OpenMP: http://openmp.org/\n.. _PyCUDA: https://documen.tician.de/pycuda/\n\nA simple example\n----------------\n\nHere is a very simple example::\n\n   from compyle.api import Elementwise, annotate, wrap, get_config\n   import numpy as np\n\n   @annotate\n   def axpb(i, x, y, a, b):\n       y[i] = a*sin(x[i]) + b\n\n   x = np.linspace(0, 1, 10000)\n   y = np.zeros_like(x)\n   a, b = 2.0, 3.0\n\n   backend = 'cython'\n   get_config().use_openmp = True\n   x, y = wrap(x, y, backend=backend)\n   e = Elementwise(axpb, backend=backend)\n   e(x, y, a, b)\n\nThis will execute the elementwise operation in parallel using OpenMP with\nCython. The code is auto-generated, compiled and called for you transparently.\nThe first time this runs, it will take a bit of time to compile everything but\nthe next time, this is cached and will run much faster.\n\nIf you just change the ``backend = 'opencl'``, the same exact code will be\nexecuted using PyOpenCL_ and if you change the backend to ``'cuda'``, it will\nexecute via CUDA without any other changes to your code. This is obviously a\nvery trivial example, there are more complex examples available as well.\n\n\nExamples\n---------\n\nSome simple examples and benchmarks are available in the `examples\n\u003chttps://github.com/pypr/compyle/tree/master/examples\u003e`_ directory.\n\nYou may also run these examples on the `Google Colab notebook`_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpypr%2Fcompyle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpypr%2Fcompyle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpypr%2Fcompyle/lists"}