{"id":17120141,"url":"https://github.com/syllo/acr","last_synced_at":"2025-03-24T02:23:39.436Z","repository":{"id":70771601,"uuid":"50985881","full_name":"Syllo/acr","owner":"Syllo","description":"Adaptative Code refinement","archived":false,"fork":false,"pushed_at":"2019-11-29T10:39:49.000Z","size":436,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-29T08:30:08.735Z","etag":null,"topics":["refinement"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Syllo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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":"2016-02-03T08:37:19.000Z","updated_at":"2021-10-19T17:53:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"f2c076c8-1681-4e22-afdf-b17de78014f1","html_url":"https://github.com/Syllo/acr","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/Syllo%2Facr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Syllo%2Facr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Syllo%2Facr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Syllo%2Facr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Syllo","download_url":"https://codeload.github.com/Syllo/acr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245196554,"owners_count":20576052,"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":["refinement"],"created_at":"2024-10-14T17:58:59.275Z","updated_at":"2025-03-24T02:23:39.410Z","avatar_url":"https://github.com/Syllo.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Adaptative Code Refinement\n==========================\n\nOverview\n--------\n\nACR is a compiler technique combining code instrumentation and a runtime library\nwhich will automaticaly optimize a computation kernel at runtime by analysing\nthe dataset.\n\n### How does it works?\n\nBy instrumenting your code with easy to use pragmas, you will provide the tool\nwith enouth information for it to do it's job.\n\nGiven the following stencil kernel doing a mean in a \"plus\" shape:\n~~~{.c}\ndouble data[M][N];\n\nfor (int k = 0; k \u003c P; ++k)\n  for (int i = 0; i \u003c M-2; ++i)\n    for (int j = 0; j \u003c N-2; ++j)\n      data[i+1][j+1] +=\n        (data[i][j+1] + data[i+1][j] + data[i+1][j+2] + data[i+2][j+1]) / 4.;\n~~~\n\nPretend this kernel, a 2D Von Neumann neighbourhood applied P times, is part of\na simulation to smoothen the data after an other algorithm and that both are\ncalled many times.\n\nIf the neighbourhood of the data is between a range of delta you have chosen\nwisely, you obviously does not need to smoothen them further. This is where ACR\nshines, you can ask him to monitor the \"data\" array and change the value of the\n\"P\" parameter. This way you can lower the computation overhead by doing less\npass of this algorithm where it does not matter that much.\n\nSo the by adding the following pragmas, the kernel will automatically generate\nan optimized kernel depending on the data.\n\n~~~{.c}\ndouble data[M][N];\n\n#pragma acr grid(25)\n#pragma acr monitor(double data[i][j], avg, data_to_strategy)\n#pragma acr alternative high (parameter, P = 5)\n#pragma acr alternative low  (parameter, P = 1)\n#pragma acr strategy direct (0, high)\n#pragma acr strategy direct (1, low)\nfor (int k = 0; k \u003c P; ++k)\n  for (int i = 0; i \u003c M-2; ++i)\n    for (int j = 0; j \u003c N-2; ++j)\n      data[i+1][j+1] +=\n        (data[i][j+1] + data[i+1][j] + data[i+1][j+2] + data[i+2][j+1]) / 4.;\n~~~\n\nThe data_to_strategy is a function matching the data value to a strategy unsigned\ninteger one.\n\nBuild\n-----\n\n~~~ {.bash}\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake\n~~~\n\nDocumentation\n-------------\n\nMake sure [Doxygen](http://doxygen.org) is installed on your system.\n\n- Fedora\n  ~~~{.bash}\n  sudo dnf install doxygen\n  ~~~\n- ArchLinux\n  ~~~{.bash}\n  sudo pacman -S doxygen\n  ~~~\n- Debian / Ubuntu\n  ~~~{.bash}\n  sudo apt-get install doxygen\n  ~~~\n\nTo build the documentation:\n\n~~~ {.bash}\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake doxygen\n~~~\n\nAfter that you will find the generated documentation as ``html`` or ``latex``\nformat in the ``doc`` folder.\n\nLicense\n-------\n\nCopyright (C) 2016 Maxime Schmitt\n\nACR is free software: you can redistribute it and/or modify it under the terms\nof the GNU Lesser General Public License as published by the Free Software\nFoundation, either version 3 of the License, or (at your option) any later\nversion.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A\nPARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with\nthis program. If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyllo%2Facr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyllo%2Facr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyllo%2Facr/lists"}