{"id":23951426,"url":"https://github.com/psteinb/compass","last_synced_at":"2025-08-04T16:43:19.320Z","repository":{"id":145284996,"uuid":"81312594","full_name":"psteinb/compass","owner":"psteinb","description":"drop-in header-only C++ library to detect hardware capabilities at runtime and at compiletime","archived":false,"fork":false,"pushed_at":"2018-10-02T09:37:09.000Z","size":193,"stargazers_count":17,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-21T22:02:27.838Z","etag":null,"topics":["c-plus-plus","cpp-library","hardware-architectures","hardware-libraries","header-only"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/psteinb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2017-02-08T09:35:52.000Z","updated_at":"2023-09-30T18:13:55.000Z","dependencies_parsed_at":"2023-04-21T09:46:45.180Z","dependency_job_id":null,"html_url":"https://github.com/psteinb/compass","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/psteinb/compass","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psteinb%2Fcompass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psteinb%2Fcompass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psteinb%2Fcompass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psteinb%2Fcompass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/psteinb","download_url":"https://codeload.github.com/psteinb/compass/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psteinb%2Fcompass/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268723620,"owners_count":24296663,"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","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["c-plus-plus","cpp-library","hardware-architectures","hardware-libraries","header-only"],"created_at":"2025-01-06T12:59:47.278Z","updated_at":"2025-08-04T16:43:19.278Z","avatar_url":"https://github.com/psteinb.png","language":"C++","readme":"[![Build Status](https://travis-ci.org/psteinb/compass.svg?branch=master)](https://travis-ci.org/psteinb/compass)\n[![Build status](https://ci.appveyor.com/api/projects/status/dvgk88ynuuvx1ldi/branch/master?svg=true)](https://ci.appveyor.com/project/psteinb/compass/branch/master)\n[![pipeline status](https://git.mpi-cbg.de/steinbac/compass-github-pull/badges/master/pipeline.svg)](https://git.mpi-cbg.de/steinbac/compass-github-pull/commits/master)\n\n# compass \n\nA drop-in header-only C++ library to detect hardware capabilities at runtime and at compiletime.\n\n## How to use it?\n\nYou have 2 options:\n\n1. you can just copy the contents of `single_include` (or `include` if you like to have multiple folders and source code files)  into your project and off you go\n\n2. you use the cmake build infrastructure to put compass in a desired folder\n\n    - on *NIX platforms and macOS/OSX\n    ```\n    $ cd repo\n    $ mkdir build \u0026\u0026 cd build\n    $ cmake -DCMAKE_INSTALL_PREFIX=/path/where/compass/needs/to/go ..\n    $ make \u0026\u0026 ctest\n    $ make install #depending on the contents of CMAKE_INSTALL_PREFIX, you may use sudo\n    ```\n\n    - on Windows platforms (assuming that `cmake` is in your `PATH`)\n\t```\n\t\u003e cd repo\n\t\u003e mkdir build\n\t\u003e cd build\n\t\u003e cmake.exe -G \"Visual Studio 14 2015 Win64\" ..\n\t\u003e cmake.exe --build . --target ALL_BUILD --config Release\n\t\u003e ctest.exe -C Release\n\t```\n\n(3.) tests should only be run on the hardware where `cmake` was called. `CMakeLists.txt` is trying hard to detect the hardware features at `cmake` invocation. They are then included in the unit test suite. \n\n## Compass API\n\nHere is a minimal code example that tries to detect SSE4 at runtime:\n\n```\n#include \u003ciostream\u003e\n#include \"compass.hpp\"\n\nusing namespace compass;\n\nint main(int argc, char** argv){\n\n    if(runtime::has(feature::sse4()))\n        std::cout \u003c\u003c \"SSE4 found!!\\n\";\n    else\n        std::cout \u003c\u003c \"This is an old machine. I hope I don't break anything.\\n\";\n        \n    return 0;\n\n}\n\n```\n\nif you want to learn more supported features, check this [test file](tests/test_machine.cpp).\n\n## Help needed \n\nThis project is quite small, so here is your chance to boost open-source to the benefit of the entire C++ community.\n\n- [ ] code review the model to extend compass for new compilers/platforms/OSes\n- [ ] code review the model to extend compass for new features\n- [ ] is thread-safety an issue of the current implementation ?\n- [ ] contribute for adding Intel compiler on x86\n- [ ] contribute for GPUs (nvcc)\n- [ ] extend support for OpenPower (gcc) if you have according hardware available\n- [ ] contribute for ARM (gcc/clang) if you have according hardware available\n\nA good place to start and to see what is needed, is llvm [`Host.cpp`](http://llvm.org/docs/doxygen/html/Host_8cpp_source.html) file.\n\n## License\n\nThis project is licensed under the BSD 3-clause open source license. See [LICENSE](LICENSE) for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsteinb%2Fcompass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsteinb%2Fcompass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsteinb%2Fcompass/lists"}