{"id":17494198,"url":"https://github.com/maxstrange/pyacc","last_synced_at":"2025-04-22T22:28:35.957Z","repository":{"id":88193740,"uuid":"79051264","full_name":"MaxStrange/pyACC","owner":"MaxStrange","description":"OpenACC for Python","archived":false,"fork":false,"pushed_at":"2019-07-17T18:47:58.000Z","size":188,"stargazers_count":20,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-17T13:33:27.043Z","etag":null,"topics":["openacc","parallelize","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MaxStrange.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-01-15T18:32:35.000Z","updated_at":"2023-04-19T08:12:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"689fc89d-5cb7-479f-8f3f-13291198e4d4","html_url":"https://github.com/MaxStrange/pyACC","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxStrange%2FpyACC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxStrange%2FpyACC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxStrange%2FpyACC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxStrange%2FpyACC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MaxStrange","download_url":"https://codeload.github.com/MaxStrange/pyACC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250333572,"owners_count":21413415,"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":["openacc","parallelize","python"],"created_at":"2024-10-19T13:05:40.552Z","updated_at":"2025-04-22T22:28:35.949Z","avatar_url":"https://github.com/MaxStrange.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyACC\n\n[![Build Status](https://travis-ci.org/MaxStrange/pyACC.svg?branch=master)](https://travis-ci.org/MaxStrange/pyACC)\n\nOpenACC for Python\n\nRhymes with \"kayak\".\n\nEver wanted to write OpenACC in Python? Neither have I, but I figured it would\nbe fun to program a way to do it. BTW, if you actually want functionality that is similar\nto OpenACC (i.e., super easy speed up of possibly already existing code), but in Python,\ntake a look at [Numba](https://github.com/numba/numba), which this project will be using\nfor GPU-acceleration.\n\nThe idea is that you can use Python metaprogramming to accomplish the same\nthing as OpenACC compiler directives. E.g.:\n\n```python\n@acc()\ndef do_something(data, ret):\n    #pragma acc parallel loop copyout=ret[0:len(data)]\n    for d in data:\n        ret.append(d ** 2)\n```\n\nAt least, that's the idea. Currently, I've only written a bare minimum proof of concept.\n\n## Purpose\n\nThis project aims to create a fully compliant implementation of the OpenACC 2.7 standard,\nbut in Python, instead of C/C++ or Fortran. Currently, a host-side back end uses multiprocessing\nand exposes only one level of parallelism.\n\n## How does it work?\n\nHow can OpenACC work in Python, you ask? Let me tell you! OpenACC in C/C++ works via compiler pragmas,\nwhich means that the compiler is responsible for generating code that takes advantage of\nhardware accelerators.\n\nIn Python, there isn't really much of a compilation phase; indeed, part of the draw of Python is\nhow easy it is to iterate on code implementations, which is partly enabled by removing the separate\ncompilation step in the C/C++ workflow. So, instead of adding a new compilation step to OpenACC Python,\nI've simply used Python's introspective abilities to make it OpenACC compliant.\n\nSpecifically, the user decorates a function with `@acc()` and comments the code in that function\nwith `#pragma acc parallel whatever` just like they would in C/C++ OpenACC. When the Python code\nis running, any time the `@acc()`-decorated function is called, this library hooks the function call,\nscans the source code of the decorated function, rewrites it according to the comments,\nimports the rewritten code, and calls the rewritten function instead of the user-created one.\nThis means there is a significant overhead of just-in-time compilation every time an `@acc()`-decorated\nfunction is called, however, for large enough input sizes, this should not matter.\n\n## Status\n\nThis project is mostly for fun, though I am hoping to squeeze as much performance out of it as I can,\nand I would welcome contributions too. I'm working on it entirely in my spare time (of which I have little),\nand I try to work on other things as well, so this is unlikely to be usable any time soon. Though\nI hope to have a host-side back end example up and running soon.\n\n## Installation\n\nThis project is tested on Python 3.5, 3.6, and 3.7. It is not pip-installable right now. It can\nbe tested by following the directions in .travis.yml.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxstrange%2Fpyacc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxstrange%2Fpyacc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxstrange%2Fpyacc/lists"}