{"id":13439541,"url":"https://github.com/NVIDIA/cub","last_synced_at":"2025-03-20T08:31:36.039Z","repository":{"id":6972070,"uuid":"8225159","full_name":"NVIDIA/cub","owner":"NVIDIA","description":"[ARCHIVED] Cooperative primitives for CUDA C++. See https://github.com/NVIDIA/cccl ","archived":true,"fork":false,"pushed_at":"2023-10-09T17:44:21.000Z","size":18369,"stargazers_count":1672,"open_issues_count":7,"forks_count":447,"subscribers_count":90,"default_branch":"main","last_synced_at":"2024-09-26T22:01:56.363Z","etag":null,"topics":["algorithms","cpp","cpp11","cpp14","cpp17","cpp20","cub","cuda","cxx","cxx11","cxx14","cxx17","cxx20","gpu","nvidia","nvidia-hpc-sdk"],"latest_commit_sha":null,"homepage":"","language":"Cuda","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"cztomczak/cef2go","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NVIDIA.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.TXT","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2013-02-15T20:01:28.000Z","updated_at":"2024-09-24T10:22:24.000Z","dependencies_parsed_at":"2023-02-18T00:46:05.921Z","dependency_job_id":"7dea74bc-6af8-4458-ad22-8a1e3458b4bb","html_url":"https://github.com/NVIDIA/cub","commit_stats":{"total_commits":1384,"total_committers":67,"mean_commits":20.65671641791045,"dds":0.5765895953757225,"last_synced_commit":"a9c11ec8ac2612d28e21799245300ebdef6832d2"},"previous_names":[],"tags_count":85,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NVIDIA%2Fcub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NVIDIA%2Fcub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NVIDIA%2Fcub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NVIDIA%2Fcub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NVIDIA","download_url":"https://codeload.github.com/NVIDIA/cub/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221739736,"owners_count":16872779,"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":["algorithms","cpp","cpp11","cpp14","cpp17","cpp20","cub","cuda","cxx","cxx11","cxx14","cxx17","cxx20","gpu","nvidia","nvidia-hpc-sdk"],"created_at":"2024-07-31T03:01:14.926Z","updated_at":"2024-10-27T22:31:14.970Z","avatar_url":"https://github.com/NVIDIA.png","language":"Cuda","readme":":warning: **The CUB repository has been archived and is now part of the unified [nvidia/cccl repository](https://github.com/nvidia/cccl). See the [announcement here](https://github.com/NVIDIA/cccl/discussions/520) for more information. Please visit the new repository for the latest updates.** :warning:\n\n\u003chr\u003e\n\u003ch3\u003eAbout CUB\u003c/h3\u003e\n\nCUB provides state-of-the-art, reusable software components for every layer\nof the CUDA programming model:\n- [\u003cb\u003e\u003cem\u003eDevice-wide primitives\u003c/em\u003e\u003c/b\u003e](https://nvlabs.github.io/cub/group___device_module.html)\n  - Sort, prefix scan, reduction, histogram, etc.\n  - Compatible with CUDA dynamic parallelism\n- [\u003cb\u003e\u003cem\u003eBlock-wide \"collective\" primitives\u003c/em\u003e\u003c/b\u003e](https://nvlabs.github.io/cub/group___block_module.html)\n  - I/O, sort, prefix scan, reduction, histogram, etc.\n  - Compatible with arbitrary thread block sizes and types\n- [\u003cb\u003e\u003cem\u003eWarp-wide \"collective\" primitives\u003c/em\u003e\u003c/b\u003e](https://nvlabs.github.io/cub/group___warp_module.html)\n  - Warp-wide prefix scan, reduction, etc.\n  - Safe and architecture-specific\n- [\u003cb\u003e\u003cem\u003eThread and resource utilities\u003c/em\u003e\u003c/b\u003e](https://nvlabs.github.io/cub/group___util_io.html)\n  - PTX intrinsics, device reflection, texture-caching iterators, caching memory allocators, etc.\n\n![Orientation of collective primitives within the CUDA software stack](http://nvlabs.github.io/cub/cub_overview.png)\n\nCUB is included in the NVIDIA HPC SDK and the CUDA Toolkit.\n\nWe recommend the [CUB Project Website](http://nvlabs.github.io/cub) for further information and examples.\n\n\u003cbr\u003e\u003chr\u003e\n\u003ch3\u003eA Simple Example\u003c/h3\u003e\n\n```cpp\n#include \u003ccub/cub.cuh\u003e\n\n// Block-sorting CUDA kernel\n__global__ void BlockSortKernel(int *d_in, int *d_out)\n{\n     using namespace cub;\n\n     // Specialize BlockRadixSort, BlockLoad, and BlockStore for 128 threads\n     // owning 16 integer items each\n     typedef BlockRadixSort\u003cint, 128, 16\u003e                     BlockRadixSort;\n     typedef BlockLoad\u003cint, 128, 16, BLOCK_LOAD_TRANSPOSE\u003e   BlockLoad;\n     typedef BlockStore\u003cint, 128, 16, BLOCK_STORE_TRANSPOSE\u003e BlockStore;\n\n     // Allocate shared memory\n     __shared__ union {\n         typename BlockRadixSort::TempStorage  sort;\n         typename BlockLoad::TempStorage       load;\n         typename BlockStore::TempStorage      store;\n     } temp_storage;\n\n     int block_offset = blockIdx.x * (128 * 16);\t  // OffsetT for this block's ment\n\n     // Obtain a segment of 2048 consecutive keys that are blocked across threads\n     int thread_keys[16];\n     BlockLoad(temp_storage.load).Load(d_in + block_offset, thread_keys);\n     __syncthreads();\n\n     // Collectively sort the keys\n     BlockRadixSort(temp_storage.sort).Sort(thread_keys);\n     __syncthreads();\n\n     // Store the sorted segment\n     BlockStore(temp_storage.store).Store(d_out + block_offset, thread_keys);\n}\n```\n\nEach thread block uses `cub::BlockRadixSort` to collectively sort\nits own input segment.  The class is specialized by the\ndata type being sorted, by the number of threads per block, by the number of\nkeys per thread, and implicitly by the targeted compilation architecture.\n\nThe `cub::BlockLoad` and `cub::BlockStore` classes are similarly specialized.\nFurthermore, to provide coalesced accesses to device memory, these primitives are\nconfigured to access memory using a striped access pattern (where consecutive threads\nsimultaneously access consecutive items) and then \u003cem\u003etranspose\u003c/em\u003e the keys into\na [\u003cem\u003eblocked arrangement\u003c/em\u003e](index.html#sec4sec3) of elements across threads.\n\nOnce specialized, these classes expose opaque `TempStorage` member types.\nThe thread block uses these storage types to statically allocate the union of\nshared memory needed by the thread block.  (Alternatively these storage types\ncould be aliased to global memory allocations).\n\n\u003cbr\u003e\u003chr\u003e\n\u003ch3\u003eSupported Compilers\u003c/h3\u003e\n\nCUB is regularly tested using the specified versions of the following\ncompilers. Unsupported versions may emit deprecation warnings, which can be\nsilenced by defining CUB_IGNORE_DEPRECATED_COMPILER during compilation.\n\n- NVCC 11.0+\n- GCC 5+\n- Clang 7+\n- MSVC 2019+ (19.20/16.0/14.20)\n\n\u003cbr\u003e\u003chr\u003e\n\u003ch3\u003eReleases\u003c/h3\u003e\n\nCUB is distributed with the NVIDIA HPC SDK and the CUDA Toolkit in addition\nto GitHub.\n\nSee the [changelog](CHANGELOG.md) for details about specific releases.\n\n| CUB Release               | Included In                             |\n| ------------------------- | --------------------------------------- |\n| 2.0.1                     | CUDA Toolkit 12.0                       |\n| 2.0.0                     | TBD                                     |\n| 1.17.2                    | TBD                                     |\n| 1.17.1                    | TBD                                     |\n| 1.17.0                    | TBD                                     |\n| 1.16.0                    | TBD                                     |\n| 1.15.0                    | NVIDIA HPC SDK 22.1 \u0026 CUDA Toolkit 11.6 |\n| 1.14.0                    | NVIDIA HPC SDK 21.9                     |\n| 1.13.1                    | CUDA Toolkit 11.5                       |\n| 1.13.0                    | NVIDIA HPC SDK 21.7                     |\n| 1.12.1                    | CUDA Toolkit 11.4                       |\n| 1.12.0                    | NVIDIA HPC SDK 21.3                     |\n| 1.11.0                    | CUDA Toolkit 11.3                       |\n| 1.10.0                    | NVIDIA HPC SDK 20.9 \u0026 CUDA Toolkit 11.2 |\n| 1.9.10-1                  | NVIDIA HPC SDK 20.7 \u0026 CUDA Toolkit 11.1 |\n| 1.9.10                    | NVIDIA HPC SDK 20.5                     |\n| 1.9.9                     | CUDA Toolkit 11.0                       |\n| 1.9.8-1                   | NVIDIA HPC SDK 20.3                     |\n| 1.9.8                     | CUDA Toolkit 11.0 Early Access          |\n| 1.9.8                     | CUDA 11.0 Early Access                  |\n| 1.8.0                     |                                         |\n| 1.7.5                     | Thrust 1.9.2                            |\n| 1.7.4                     | Thrust 1.9.1-2                          |\n| 1.7.3                     |                                         |\n| 1.7.2                     |                                         |\n| 1.7.1                     |                                         |\n| 1.7.0                     | Thrust 1.9.0-5                          |\n| 1.6.4                     |                                         |\n| 1.6.3                     |                                         |\n| 1.6.2 (previously 1.5.5)  |                                         |\n| 1.6.1 (previously 1.5.4)  |                                         |\n| 1.6.0 (previously 1.5.3)  |                                         |\n| 1.5.2                     |                                         |\n| 1.5.1                     |                                         |\n| 1.5.0                     |                                         |\n| 1.4.1                     |                                         |\n| 1.4.0                     |                                         |\n| 1.3.2                     |                                         |\n| 1.3.1                     |                                         |\n| 1.3.0                     |                                         |\n| 1.2.3                     |                                         |\n| 1.2.2                     |                                         |\n| 1.2.0                     |                                         |\n| 1.1.1                     |                                         |\n| 1.0.2                     |                                         |\n| 1.0.1                     |                                         |\n| 0.9.4                     |                                         |\n| 0.9.2                     |                                         |\n| 0.9.1                     |                                         |\n| 0.9.0                     |                                         |\n\n\u003cbr\u003e\u003chr\u003e\n\u003ch3\u003eDevelopment Process\u003c/h3\u003e\n\nCUB and Thrust depend on each other. It is recommended to clone Thrust\nand build CUB as a component of Thrust.\n\nCUB uses the [CMake build system](https://cmake.org/) to build unit tests,\nexamples, and header tests. To build CUB as a developer, the following\nrecipe should be followed:\n\n```bash\n# Clone Thrust and CUB from Github. CUB is located in Thrust's\n# `dependencies/cub` submodule.\ngit clone --recursive https://github.com/NVIDIA/thrust.git\ncd thrust\n\n# Create build directory:\nmkdir build\ncd build\n\n# Configure -- use one of the following:\ncmake -DTHRUST_INCLUDE_CUB_CMAKE=ON ..   # Command line interface.\nccmake -DTHRUST_INCLUDE_CUB_CMAKE=ON ..  # ncurses GUI (Linux only)\ncmake-gui  # Graphical UI, set source/build directories and options in the app\n\n# Build:\ncmake --build . -j \u003cnum jobs\u003e   # invokes make (or ninja, etc)\n\n# Run tests and examples:\nctest\n```\n\nBy default, the C++14 standard is targeted, but this can be changed in CMake.\nMore information on configuring your CUB build and creating a pull request is\nfound in [CONTRIBUTING.md](CONTRIBUTING.md).\n\n\u003cbr\u003e\u003chr\u003e\n\u003ch3\u003eOpen Source License\u003c/h3\u003e\n\nCUB is available under the \"New BSD\" open-source license:\n\n```\nCopyright (c) 2010-2011, Duane Merrill.  All rights reserved.\nCopyright (c) 2011-2018, NVIDIA CORPORATION.  All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n   *  Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n   *  Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n   *  Neither the name of the NVIDIA CORPORATION nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n```\n","funding_links":[],"categories":["Cuda","CUDA Tools Libraries, and Frameworks","Graphic Libraries \u0026 Renderers","CUDA Tools","Tools"],"sub_categories":["viii. Linear Regression","Data Management","Interfaces","Mesh networks"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNVIDIA%2Fcub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNVIDIA%2Fcub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNVIDIA%2Fcub/lists"}