Namespaces | Classes | Typedefs | Enumerations | Functions
rapidsmpf::bootstrap Namespace Reference

Namespaces

 detail
 

Classes

struct  Context
 Context information for the current process/rank. More...
 

Typedefs

using Rank = std::int32_t
 Type alias for communicator::Rank.
 

Enumerations

enum class  Backend { AUTO , FILE }
 Backend types for process coordination and bootstrapping. More...
 

Functions

Context init (Backend backend=Backend::AUTO)
 Initialize the bootstrap context from environment variables. More...
 
void broadcast (Context const &ctx, void *data, std::size_t size, Rank root=0)
 Broadcast data from root rank to all other ranks. More...
 
void barrier (Context const &ctx)
 Perform a barrier synchronization across all ranks. More...
 
void put (Context const &ctx, std::string const &key, std::string const &value)
 Store a key-value pair in the coordination backend. More...
 
std::string get (Context const &ctx, std::string const &key, Duration timeout=std::chrono::seconds{30})
 Retrieve a value from the coordination backend. More...
 

Detailed Description

SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. SPDX-License-Identifier: Apache-2.0

Enumeration Type Documentation

◆ Backend

Backend types for process coordination and bootstrapping.

Enumerator
AUTO 

Automatically detect the best backend based on environment.

Detection order:

  1. File-based (default fallback)
FILE 

File-based coordination using a shared directory.

Uses filesystem for rank coordination and address exchange. Works on single-node and multi-node with shared storage (e.g., NFS) via SSH. Requires RAPIDSMPF_RANK, RAPIDSMPF_NRANKS, RAPIDSMPF_COORD_DIR environment variables.

Definition at line 28 of file bootstrap.hpp.

Function Documentation

◆ barrier()

void rapidsmpf::bootstrap::barrier ( Context const &  ctx)

Perform a barrier synchronization across all ranks.

This ensures all ranks reach this point before any rank proceeds.

Parameters
ctxBootstrap context.

◆ broadcast()

void rapidsmpf::bootstrap::broadcast ( Context const &  ctx,
void *  data,
std::size_t  size,
Rank  root = 0 
)

Broadcast data from root rank to all other ranks.

This is a helper function for broadcasting small amounts of data during bootstrapping. It uses the underlying backend's coordination mechanism.

Parameters
ctxBootstrap context.
dataData buffer to broadcast (both input on root, output on others).
sizeSize of data in bytes.
rootRoot rank performing the broadcast (default: 0).

◆ get()

std::string rapidsmpf::bootstrap::get ( Context const &  ctx,
std::string const &  key,
Duration  timeout = std::chrono::seconds{30} 
)

Retrieve a value from the coordination backend.

This function blocks until the key is available or timeout occurs.

Parameters
ctxBootstrap context.
keyKey name to retrieve.
timeoutTimeout duration.
Returns
Value associated with the key.
Exceptions
std::runtime_errorif key not found within timeout.

◆ init()

Context rapidsmpf::bootstrap::init ( Backend  backend = Backend::AUTO)

Initialize the bootstrap context from environment variables.

This function reads environment variables to determine rank, nranks, and backend configuration. It should be called early in the application lifecycle.

Environment variables checked (in order of precedence):

  • RAPIDSMPF_RANK: Explicitly set rank
  • RAPIDSMPF_NRANKS: Explicitly set total rank count
  • RAPIDSMPF_COORD_DIR: File-based coordination directory
Parameters
backendBackend to use (default: AUTO for auto-detection).
Returns
Context object containing rank and coordination information.
Exceptions
std::runtime_errorif environment is not properly configured.
std::cout << "I am rank " << ctx.rank << " of " << ctx.nranks << std::endl;
Context init(Backend backend=Backend::AUTO)
Initialize the bootstrap context from environment variables.

◆ put()

void rapidsmpf::bootstrap::put ( Context const &  ctx,
std::string const &  key,
std::string const &  value 
)

Store a key-value pair in the coordination backend.

This is useful for custom coordination beyond UCXX address exchange.

Parameters
ctxBootstrap context.
keyKey name.
valueValue to store.