Skip to content

[DOC]: Add documentation page for "How to use Environments" #7712

Description

@jrhemstad

Is this a duplicate?

Is this for new documentation, or an update to existing docs?

New

Describe the incorrect/future/missing documentation

As an advanced user of CCCL algorithms, I want to know how to leverage the latest and greatest of new CCCL algorithm innovations that are exposed through the std::execution::environment abstraction for passing additional information to a functional call.

For example, this is used for passing memory resources for a more convenient single-API call for CUB algorithms . But is also used for "requirements", "guarantees", and "tunings".

All of these are important, but conceptually different entities that can be passed through an environment.

This issue can be closed by adding a new documentation page called "How to use Environments" that provides a succinct explanation of what an environment is, how it works, and a taxonomy of the entities we support passing through an environment. At minimum, this should include 1) memory resources 2) tunings 3) requirements 4) guarantees. For each, it should define the category and provide examples.

I should walk away from reading this page and have an understanding of what environments are and the various places I can use them with CCCL APIs.

Work Items

  • Landing page: what an environment is + why environments
  • Taxonomy: memory resources - definition + example
  • Taxonomy: tunings - definition + end-to-end example composing (tracked by
  • Taxonomy: requirements - definition + determinism example; note algorithm-specific ones (DeviceTopK)
  • Taxonomy: guarantees - define + example (should be documented after [libcu++] Adds exec::guarantee and the max_total_num_items guarantee #9278)
  • Fallback defaults when properties are absent
  • Reusing one environment across multiple algorithms

Activity

  1. MatthiasKohl commented on Feb 23, 2026

    @MatthiasKohl

    For tunings, it would be great to have examples on how to correctly pass in policies: in cub specifically, there seem to be two main ways of defining the tuning policies, one with a () call operator (e.g. segmented reduce / transform) and one with a query operator (e.g. scan or select).

    For each of the types, having an end-to-end example would help significantly.

    Plus, examples that I previously saw, often only show the environment with a single argument, but in the general case, for e.g. tuning, at least stream and the tuning policy is required, so it would be good to have the examples working with at least two arguments for environments.

    Finally, there seem to be restrictions on the cu stub functions when using function-scope structs, at least with standard versions of nvcc. It would be good to document those as well.

  2. bernhardmgruber commented on Feb 23, 2026

    @bernhardmgruber
    Contributor

    For tunings, it would be great to have examples on how to correctly pass in policies: in cub specifically, there seem to be two main ways of defining the tuning policies, one with a () call operator (e.g. segmented reduce / transform) and one with a query operator (e.g. scan or select).

    Tunings are not publicly exposed yet, but when they are, they will use a uniform API across all CUB algorithms.

  3. jrhemstad commented on Feb 27, 2026

    @jrhemstad
    CollaboratorAuthor

    @bernhardmgruber is there some easy way we can emit a diagnostic if people pass a tuning into an algorithm invocation that doesn't support tunings?

    Or do we expect all algorithms will supporting tunings once they are publicly available.

  4. bernhardmgruber commented on Feb 27, 2026

    @bernhardmgruber
    Contributor

    @bernhardmgruber is there some easy way we can emit a diagnostic if people pass a tuning into an algorithm invocation that doesn't support tunings?

    We could diagnose this, but we don't want to. People should be able to use a single environment and pass it to multiple algorithms in succession. So any algorithm should ignore from the environment what it does not need.

    Or do we expect all algorithms will supporting tunings once they are publicly available.

    I think each CUB algorithm does have a tuning internally, so yes, they will all eventually have public tuning APIs.

  5. jrhemstad commented on Feb 27, 2026

    @jrhemstad
    CollaboratorAuthor

    People should be able to use a single environment and pass it to multiple algorithms in succession.

    Perhaps, but I think people will care even more about having some form of confirmation of "Did the thing I wanted to happen actually happen?". So we should think about ways we can give that to people.

  6. bernhardmgruber commented on Feb 27, 2026

    @bernhardmgruber
    Contributor

    Right, which is what #7797 investigates.

  7. bernhardmgruber commented on Apr 23, 2026

    @bernhardmgruber
    Contributor

    I am adding the documentation for the tuning API here:

    I intentionally omit any general description of how environments work, how they are created and queried etc. @miscco also asked to document what default values CUB will choose if an environment does not contain a stream, a memory resource, a determinism requirement, etc. This issue here should address this on a dedicated documentation page.

  8. self-assigned this
    on Jun 30, 2026
  9. added a commit that references this issue on Jul 21, 2026
    ec3374b
  10. moved this from Todo to In Progress in CCCLon Jul 21, 2026
  11. added a commit that references this issue on Jul 22, 2026
    c5d573e
  12. moved this from In Progress to In Review in CCCLon Jul 23, 2026
  13. moved this from In Review to Done in CCCLon Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions