Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
841414e
Add RMM User Guide (draft from docs-overhaul branch)
bdice Apr 2, 2026
2a1f4b8
Fix user guide C++ examples to use modern resource_ref API
bdice Apr 2, 2026
0466c81
Remove autodoc section for deleted rmm.pylibrmm.cuda_stream module
bdice Apr 2, 2026
5a2bbaa
Align user guide with 26.06 migration: compiled lib, stream args, val…
bdice Apr 3, 2026
b8d0e98
Revise choosing_memory_resources page for performance-first framing
bdice Apr 3, 2026
c00a8c8
Replace incomplete Available Resources table with links to choosing g…
bdice Apr 3, 2026
91fb555
Add Python API reference link to Available Resources section
bdice Apr 3, 2026
03de6a4
Merge Per-Device Resources into Multi-Device Usage, add Python API link
bdice Apr 3, 2026
4b7edb6
Replace hardcoded system requirements with link to RAPIDS Platform Su…
bdice Apr 3, 2026
6ea60a8
Consolidate duplicate conda environment setup in build-from-source in…
bdice Apr 3, 2026
fc681f1
Use 26.06
bdice Apr 3, 2026
d4d8ea6
Match scope of C++/Python basic examples, add allocation to CuPy inte…
bdice Apr 3, 2026
5a51696
Rename base to base_mr in logging.md examples
bdice Apr 3, 2026
db54ca6
Merge branch 'staging' into docs-overhaul
bdice Apr 6, 2026
c44bbbf
Delete pool_allocators.md, add pool-doesn't-shrink note to choosing g…
bdice Apr 11, 2026
5c9afd8
Fix CudaAsyncMR description and multi-library claims in choosing guide
bdice Apr 12, 2026
32aefaa
Fix Python stream API: use rmm.pylibrmm.stream.Stream, remove context…
bdice Apr 12, 2026
e97b713
Fix stream-ordered allocation factual errors: pointer validity, resou…
bdice Apr 12, 2026
b999401
Rework guide.md examples to use explicit resource passing
bdice Apr 12, 2026
f767142
Restructure logging.md with tabbed code blocks and explicit resource …
bdice Apr 12, 2026
66296b4
Reduce managed_memory.md: remove CUDA-general content, explicit resou…
bdice Apr 12, 2026
4f14530
Reduce stream_ordered_allocation.md: explicit resources, cross-stream…
bdice Apr 12, 2026
704cb53
Polish introduction.md: reduce bold, fix CCCL statement, explicit res…
bdice Apr 13, 2026
0a634e0
Add Sphinx cross-references, explicit resource passing, and minor fix…
bdice Apr 13, 2026
2f9d48c
Extract user guide code examples into runnable source files with lite…
bdice Apr 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cpp/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ This folder contains examples to demonstrate librmm use cases. Running `build.sh
Current examples:

- Basic: demonstrates memory resource construction and allocating a `device_uvector` on a stream.
- Docs: code examples from the [user guide](../../docs/user_guide/), included via `literalinclude` directives.
3 changes: 2 additions & 1 deletion cpp/examples/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0

# librmm examples build script
Expand Down Expand Up @@ -58,3 +58,4 @@ build_example() {
}

build_example basic
build_example docs
39 changes: 39 additions & 0 deletions cpp/examples/docs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# cmake-format: off
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
# cmake-format: on

cmake_minimum_required(VERSION 3.30.4)

include(../set_cuda_architecture.cmake)

# initialize CUDA architectures
rapids_cuda_init_architectures(docs_examples)

project(
docs_examples
VERSION 0.0.1
LANGUAGES CXX CUDA)

include(../fetch_dependencies.cmake)

include(rapids-cmake)
rapids_cmake_build_type("Release")

# One executable per user guide page
set(DOCS_CUDA_EXAMPLES guide stream_ordered_allocation managed_memory)
set(DOCS_CXX_EXAMPLES introduction choosing_memory_resources logging installation)

foreach(example ${DOCS_CUDA_EXAMPLES})
add_executable(docs_${example} src/${example}.cu)
target_link_libraries(docs_${example} PRIVATE rmm::rmm)
target_compile_features(docs_${example} PRIVATE cxx_std_17)
install(TARGETS docs_${example} DESTINATION bin/examples/librmm)
endforeach()

foreach(example ${DOCS_CXX_EXAMPLES})
add_executable(docs_${example} src/${example}.cpp)
target_link_libraries(docs_${example} PRIVATE rmm::rmm)
target_compile_features(docs_${example} PRIVATE cxx_std_17)
install(TARGETS docs_${example} DESTINATION bin/examples/librmm)
endforeach()
72 changes: 72 additions & 0 deletions cpp/examples/docs/src/choosing_memory_resources.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

// Code examples for docs/user_guide/choosing_memory_resources.md
//
// Include directives that appear inside function bodies are intentional:
// they are no-ops (headers use #pragma once) and exist so that
// literalinclude snippets display the includes alongside the code.

#include <rmm/aligned.hpp>
#include <rmm/cuda_device.hpp>
#include <rmm/cuda_stream.hpp>
#include <rmm/device_buffer.hpp>
#include <rmm/mr/cuda_async_memory_resource.hpp>
#include <rmm/mr/managed_memory_resource.hpp>
#include <rmm/mr/pool_memory_resource.hpp>
#include <rmm/mr/prefetch_resource_adaptor.hpp>

#include <cassert>
#include <iostream>

void recommended_default()
{
// clang-format off
// [recommended-default]
#include <rmm/mr/cuda_async_memory_resource.hpp>
#include <rmm/device_buffer.hpp>

rmm::mr::cuda_async_memory_resource mr;
rmm::cuda_stream stream;
rmm::device_buffer buffer(1024, stream.view(), mr);
// [/recommended-default]
// clang-format on

assert(buffer.size() == 1024);
}

void managed_pool_prefetch()
{
// clang-format off
// [managed-pool-prefetch]
#include <rmm/mr/managed_memory_resource.hpp>
#include <rmm/mr/pool_memory_resource.hpp>
#include <rmm/mr/prefetch_resource_adaptor.hpp>
#include <rmm/aligned.hpp>
#include <rmm/cuda_device.hpp>

// Use 80% of GPU memory, rounded down to nearest 256 bytes
auto [free_memory, total_memory] = rmm::available_device_memory();
auto pool_size = rmm::align_down(static_cast<std::size_t>(total_memory * 0.8), 256);

rmm::mr::managed_memory_resource managed_mr;
rmm::mr::pool_memory_resource pool_mr{managed_mr, pool_size};
rmm::mr::prefetch_resource_adaptor prefetch_mr{pool_mr};
// [/managed-pool-prefetch]
// clang-format on

rmm::cuda_stream stream;
rmm::device_buffer buffer(1024, stream.view(), prefetch_mr);
assert(buffer.size() == 1024);
}

int main()
{
recommended_default();
managed_pool_prefetch();

std::cout << "All choosing_memory_resources examples passed.\n";
return 0;
}
Loading
Loading