Sparse-checkout from NVIDIA/cccl main branch to complete cccl_upstream: Added: - python/cuda_cccl/ (226 files) — Python bindings for device-level algorithms Critical for muh toolchain: cuda.compute.reduce_into, scan, radix_sort, etc. Includes 204 .py files with full test coverage for all 27 algorithms - ci/ (163 files) — Build/test infrastructure build_cub.sh, test_cub.sh, build_and_test_targets.sh, matrix.yaml Directly maps to our [INFRA-CI] and [INFRA-BUILD] items - .agent/skills/ (7 files) — NVIDIA's own agent skills for CCCL cccl-style/SKILL.md, cccl-test/SKILL.md, sass-diff/SKILL.md - docs/ (491 files) — Official CCCL documentation CI references, CMake guides, Python compute docs, libcudacxx PTX docs - test/ (12 files) — Top-level integration tests (cuda_smoke, stdpar) - Root configs: .clang-format, .clang-tidy, CONTRIBUTING.md, pyproject.toml - CLAUDE.md symlink → AGENTS.md (NVIDIA's standard) cccl_upstream now mirrors full NVIDIA/cccl structure: Before: 42M (cub + thrust + libcudacxx + cudax + c + examples + benchmarks) After: 53M (+python +ci +docs +.agent +test +configs) This completes the CCCL base needed for: - [muh-bench] items: ci/util/build_and_test_targets.sh for targeted builds - [CCCL-verify] items: python/cuda_cccl/tests/ as reference implementations - [CCCL-test] items: ci/test_cub.sh, ci/test_thrust.sh - Agent workflow: .agent/skills/ for consistent style and test patterns
89 lines
2.3 KiB
ReStructuredText
89 lines
2.3 KiB
ReStructuredText
.. _thrust-module-api-iterators:
|
|
|
|
Iterators
|
|
===========
|
|
|
|
Thrust provides a rich collection of iterators that extend beyond the C++ standard library.
|
|
|
|
.. important::
|
|
|
|
Many Thrust iterators have direct replacements in libcu++,
|
|
which are newer and thus fix some of the shortcomings of Thrust's iterators.
|
|
They should generally be preferred. See :ref:`libcudacxx-extended-api-iterators` for more.
|
|
|
|
|
|
Fancy iterators
|
|
-------------------------
|
|
|
|
Thrust provides the following fancy iterators:
|
|
|
|
.. toctree::
|
|
:glob:
|
|
:maxdepth: 1
|
|
|
|
api/group__fancyiterator_*
|
|
|
|
|
|
Iterator traits
|
|
-------------------------
|
|
|
|
Thrust offers the following traits to inspect iterators:
|
|
|
|
.. toctree::
|
|
:glob:
|
|
:maxdepth: 1
|
|
|
|
api/group__iterator__traits_*
|
|
|
|
Iterator tags
|
|
-------------------------
|
|
|
|
Thrust provides the following iterator category tags:
|
|
|
|
.. toctree::
|
|
:glob:
|
|
:maxdepth: 1
|
|
|
|
api/group__iterator__tags_*
|
|
|
|
Additionally, the following utilities for working with iterator category tags are provided:
|
|
|
|
.. toctree::
|
|
:glob:
|
|
:maxdepth: 1
|
|
|
|
api/group__iterator__tag__utilities_*
|
|
|
|
Thrust provides the following iterator traversal tags:
|
|
|
|
.. toctree::
|
|
:glob:
|
|
:maxdepth: 1
|
|
|
|
api/structthrust*__traversal__tag
|
|
|
|
|
|
Iterator model
|
|
-------------------------
|
|
|
|
Thrust's iterators extend the C++ standard library iterator model and were inspired by Boost.Iterator.
|
|
In the C++ standard library, iterators are mostly distinguished by their iterator category (before C++20),
|
|
and their iterator concept (since C++20).
|
|
This is governed by the nested ``iterator_category`` and ``iterator_concept`` types, respectively,
|
|
which in standard C++ are one of:
|
|
|
|
- ``input_iterator_tag``
|
|
- ``output_iterator_tag``
|
|
- ``forward_iterator_tag``
|
|
- ``bidirectional_iterator_tag``
|
|
- ``random_access_iterator_tag``
|
|
- ``contiguous_iterator_tag`` (since C++20)
|
|
|
|
Thrust extends this model by introducing the notion of an iterator traversal and an iterator system.
|
|
In order to fit into the existing schema of iterators,
|
|
it encodes this additional information into the ``iterator_category``,
|
|
which is no longer one of the standard tags listed above,
|
|
but a templated type carrying the iterator tag, iterator traversal and iterator system.
|
|
This information can be extracted using the :cpp:class:`thrust::iterator_traversal <thrust::iterator_traversal>`
|
|
and :cpp:class:`thrust::iterator_system <thrust::iterator_system>` traits.
|