{"id":19659911,"url":"https://github.com/648trindade/adaptive","last_synced_at":"2026-06-14T15:36:11.091Z","repository":{"id":91777465,"uuid":"257142432","full_name":"648trindade/adaptive","owner":"648trindade","description":"Adaptive Scheduler for Parallel Loops in C++/C","archived":false,"fork":false,"pushed_at":"2020-05-12T00:27:13.000Z","size":225,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-10T01:28:13.138Z","etag":null,"topics":["cpp","parallel-computing","parallel-programming","parallelism","scheduler"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/648trindade.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2020-04-20T01:39:37.000Z","updated_at":"2021-05-11T18:49:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2d13d94-a90c-4da1-93fc-fbd1d3b49862","html_url":"https://github.com/648trindade/adaptive","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/648trindade%2Fadaptive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/648trindade%2Fadaptive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/648trindade%2Fadaptive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/648trindade%2Fadaptive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/648trindade","download_url":"https://codeload.github.com/648trindade/adaptive/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240968931,"owners_count":19886398,"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":["cpp","parallel-computing","parallel-programming","parallelism","scheduler"],"created_at":"2024-11-11T15:44:45.016Z","updated_at":"2026-06-14T15:36:06.071Z","avatar_url":"https://github.com/648trindade.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Adaptive\n\n[![Build Status](https://travis-ci.com/648trindade/adaptive.svg?branch=master)](https://travis-ci.com/648trindade/adaptive)\n\nAdaptive is a parallel loop scheduler designed with an adaptive algorithm. Its original purpose is to better balancing parallel irregular workloads and better balancing regular (and irregular) workloads on Asymmetric Multicore Processors (AMP).\n\nThe hybrid adaptive scheduling algorithm uses _work stealing_ in order to balance loads on threads, and uses a THE protocol approach to minimize parallel overhead on concurrent scheduling operations. A deep explanation of how scheduler actually works can be found on the following master thesis (written in portuguese, english paper coming soon):\n\n\u003e Trindade, Rafael G. and Lima, João V. F.. **Escalonador Adaptativo de Laços Paralelos para Processadores Multinúcleo Assimétricos**. Master Thesis. Universidade Federal de Santa Maria. 2020. Santa Maria, RS, Brazil. Available at: http://www.inf.ufsm.br/~rtrindade/docs/dissertacao-rtrindade.pdf.\n\u003e\n\u003e English Title: **An Adaptive Scheduler of Parallel Loops for Asymmetric Multicore Processors**\n\nThe scheduler is based on the following related works:\n\n\u003e M. Durand, F. Broquedis, T. Gautier, and B. Raffin, **An efficient openmp loop scheduler for irregular applications on large-scale NUMA machines**, in OpenMP in the Era of Low Power Devices and Accelerators, A. P. Rendell, B. M. Chapman, and M. S. Muller, Eds. Berlin, Heidelberg: Springer Berlin Heidelberg, 2013, pp. 141–155. [Online]. Available: https://doi.org/10.1007/978-3-642-40698-0_11\n\u003e\n\u003e S. D. K. Mor, **Analysis of synchronizations in greedy-scheduled executions and applications to efficient generation of pseudorandom numbers in parallel**, Thesis, Universidade Federal do Rio Grande do Sul, Porto Alegre, RS, Brazil, nov 2015. [Online]. Available: http://hdl.handle.net/10183/130529\n\u003e\n\u003e D. Traore, J.-L. Roch, N. Maillard, T. Gautier, and J. Bernard, **Deque-free work-optimal parallel STL algorithms**, in Euro-Par 2008 -- Parallel Processing, E. Luque, T. Margalef, and D. Benítez, Eds.Berlin, Heidelberg: Springer Berlin Heidelberg, 2008, pp. 887–897. [Online]. Available: https://doi.org/10.1007/978-3-540-85451-7_95\n\n## API\n\nThe Adaptive's API is based on Thread Building Blocks (TBB) API. We currently support two types of parallel loops:\n\n* Common parallel loops:\n\n```c++\nvoid adapt::parallel_loop(\n    T start, T end, \n    void body(T, T)\n);\n```\n* Reduction parallel loops\n\n```c++\nV adapt::parallel_reduce(\n    T start, T end, \n    V initial, \n    V body(T, T, V), \n    V reductor(V, V)\n);\n```\n\nThe API accepts functions and lambda functions as parameters for `body` and `reductor` arguments.\n\n## Examples\n\nParallelizing a vector filling algorithm\n```c++\nstd::vector\u003cint\u003e vec(256, 0);\n\nadapt::parallel_for(\n    0, 256,\n    [\u0026vec](const int start, const int end) {\n        for (int i = start; i \u003c end; i++)\n            vec[i] = some_function();\n    }\n);\n```\n\nParallelizing a vector sum algorithm (using `std::plus` utility binary function as reductor)\n```c++\nstd::vector\u003cdouble\u003e vec(256, 0.0);\n\n// ... fill vec someway\n\ndouble result = adapt::parallel_reduce(\n    0, 256, 0.0,\n    // body\n    [\u0026vec](const int start, const int end, double initial) {\n        double _result = initial;\n        for (int i = start; i \u003c end; i++)\n            _result += vec[i];\n        return _result;\n    },\n    // reductor\n    std::plus\u003cdouble\u003e();\n);\n```\n\nParallelizing a find minimal value and index algorithm (using a custom reductor -- C++ lambda function)\n```c++\nstd::vector\u003cdouble\u003e vec(256, 0.0);\n\n// ... fill vec someway\n\nstd::pair\u003cint, double\u003e _initial = std::make_pair(0, vec[0]);\n\nstd::pair\u003cint, double\u003e result = adapt::parallel_reduce(\n    1, 256, _initial,\n    // body\n    [\u0026vec](const int start, const int end, std::pair\u003cint, double\u003e initial) {\n        std::pair\u003cint, double\u003e _result = initial;\n        for (int i = start; i \u003c end; i++) {\n            if (vec[i] \u003c _result.second) {\n                _result.first = i;\n                _result.second = vec[i];\n            }\n        }\n        return _result;\n    },\n    // reductor\n    [](const std::pair\u003cint, double\u003e left, const std::pair\u003cint, double\u003e right) {\n        std::pair\u003cint, double\u003e _result = left;\n        if (right.second \u003c _result.second) {\n            _result.first = right.first;\n            _result.second = right.second;\n        }\n        return _result;\n    }\n);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F648trindade%2Fadaptive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F648trindade%2Fadaptive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F648trindade%2Fadaptive/lists"}