Skip to content

Add environment docs landing page with essential info#10043

Open
gonidelis wants to merge 4 commits into
NVIDIA:mainfrom
gonidelis:env_docs_landing_page
Open

Add environment docs landing page with essential info#10043
gonidelis wants to merge 4 commits into
NVIDIA:mainfrom
gonidelis:env_docs_landing_page

Conversation

@gonidelis

@gonidelis gonidelis commented Jul 21, 2026

Copy link
Copy Markdown
Member

fixes #7712

Adds docs landing page for Environments as discussed in #10013 (comment)

It doesn't go into deep details (e.g CPOs, last sub-section offers fertile ground for that). It provides an overview with

a) a strong definition and
b) minimal usable examples on environment features extracted from our real compilable tests

Pics that showcase the generated HTML page:

image image image image image image

@gonidelis
gonidelis requested a review from a team as a code owner July 21, 2026 10:42
@gonidelis
gonidelis requested a review from griwes July 21, 2026 10:42
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Jul 21, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Jul 21, 2026
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Documentation
    • Added comprehensive guidance on CUB execution environments, including stream selection, determinism requirements, tuning policies, and memory resource handling.
    • Explained how to construct, compose, and reuse environment objects across multiple device-wide algorithm calls.
    • Clarified device-wide API availability and wording alongside environment-based overloads.
    • Updated determinism and “requesting a guarantee” documentation, including compile-time rejection for unsupported requests.
    • Added a warning that policy selectors must be stateless and default-constructible/copyable.
    • Updated the CUB documentation index to include the new environment topic.

Walkthrough

Changes

Documents CUB execution environments, including construction, composition, configurable properties, defaults, reuse, and related documentation links. The new page is added to the CUB documentation index, determinism and device-wide API text are updated, tuning constraints are clarified, and a test’s formatting is adjusted.

CUB execution environments

Layer / File(s) Summary
Environment concept and construction
docs/cub/environment.rst, docs/cub/device_wide.rst
Introduces execution environments, their construction, composition, reuse, and relationship to CUB device-wide API forms.
Environment properties and defaults
docs/cub/environment.rst, docs/cub/determinism.rst, docs/cub/tuning.rst, cub/test/catch2_test_device_merge_env_api.cu
Documents determinism guarantees, tuning selector constraints, memory resources, fallback values, compile-time rejection of unsupported guarantees, and formats the related test.
Documentation navigation and references
docs/cub/index.rst, docs/cub/environment.rst, docs/cub/device_wide.rst
Adds the environment page to the CUB index and links related execution-environment, determinism, tuning, and device-wide documentation.

Possibly related PRs

  • NVIDIA/cccl#10102: Adds and links closely related CUB execution-environment documentation.

Suggested reviewers: griwes, miscco, bernhardmgruber


Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a7959ff3-e8a4-4b6d-af2a-67e6ba08a857

📥 Commits

Reviewing files that changed from the base of the PR and between 505719e and e8d4bda.

📒 Files selected for processing (3)
  • docs/cub/determinism.rst
  • docs/cub/environment.rst
  • docs/cub/index.rst

Comment thread docs/cub/environment.rst Outdated
@gonidelis
gonidelis requested a review from a team as a code owner July 23, 2026 07:13
@gonidelis
gonidelis requested a review from miscco July 23, 2026 07:13
Comment thread docs/cub/environment.rst Outdated
Comment thread docs/cub/environment.rst Outdated
Comment thread docs/cub/environment.rst
result.begin(),
cuda::std::less{},
cuda::execution::tune(MergePolicySelector{}));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's on purpose. it is very unreadable in the example block chunk. Unless there is a specific reason I would like to keep it.

@bernhardmgruber bernhardmgruber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great work!

Comment thread docs/cub/environment.rst Outdated
Comment thread docs/cub/environment.rst Outdated
Comment thread docs/cub/environment.rst Outdated
Comment thread docs/cub/environment.rst Outdated
Comment thread docs/cub/environment.rst Outdated
Comment thread docs/cub/environment.rst
Comment on lines +193 to +195
auto stream = cuda::stream{cuda::devices[0]};
auto pool = cuda::device_default_memory_pool(cuda::devices[0]);
auto env = cuda::std::execution::env{cuda::stream_ref{stream}, pool};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this would work as well:

Suggested change
auto stream = cuda::stream{cuda::devices[0]};
auto pool = cuda::device_default_memory_pool(cuda::devices[0]);
auto env = cuda::std::execution::env{cuda::stream_ref{stream}, pool};
auto stream = cuda::stream{cuda::devices[0]};
auto pool = cuda::device_default_memory_pool(cuda::devices[0]);
auto env = cuda::std::execution::env{std::move(stream), pool};

I think this would create a non-copyable environment (since the stream cannot be copied), but it would work with CUB.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested it. It works after we moved all environment parameters to const& in cub::DeviceReduce.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the example calls stream.sync() at the end, would that work fine on a moved-on stream?

Comment thread docs/cub/environment.rst Outdated
Comment thread docs/cub/environment.rst Outdated
Comment thread docs/cub/environment.rst Outdated
Comment thread docs/cub/environment.rst Outdated
- drop the term "environment overload"
- cross-link the environments page from the device-wide docs
- frame determinism as one example of a requirement
- move the policy-selector statelessness warning to the tuning page
- clarify that a policy selector only applies to algorithms matching its policy type

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4fd10a48-f1a3-461a-822b-e2c45c01eeaf

📥 Commits

Reviewing files that changed from the base of the PR and between a2b23f1 and 0961c02.

📒 Files selected for processing (3)
  • docs/cub/device_wide.rst
  • docs/cub/environment.rst
  • docs/cub/tuning.rst
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/cub/environment.rst

Comment thread docs/cub/tuning.rst
@gonidelis gonidelis changed the title [WIP] Add environment docs landing page with essential info Add environment docs landing page with essential info Jul 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 6h 24m: Pass: 100%/242 | Total: 2d 03h | Max: 48m 43s | Hits: 99%/152220

See results here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

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

2 participants