Public Member Functions | List of all members
rapidsmpf::bootstrap::detail::FileBackend Class Reference

File-based coordination backend implementation. More...

#include <file_backend.hpp>

Inheritance diagram for rapidsmpf::bootstrap::detail::FileBackend:
rapidsmpf::bootstrap::detail::Backend

Public Member Functions

 FileBackend (Context ctx)
 Construct a file backend. More...
 
void put (std::string const &key, std::string const &value) override
 Store a key-value pair (rank 0 only). More...
 
std::string get (std::string const &key, Duration timeout) override
 Retrieve a value, blocking until available or timeout occurs. More...
 
void barrier () override
 Perform a barrier synchronization. More...
 
void sync () override
 Ensure all previous put() operations are globally visible. More...
 
- Public Member Functions inherited from rapidsmpf::bootstrap::detail::Backend
 Backend (Backend const &)=delete
 
Backendoperator= (Backend const &)=delete
 
 Backend (Backend &&)=delete
 
Backendoperator= (Backend &&)=delete
 

Detailed Description

File-based coordination backend implementation.

This class implements coordination using a shared directory on the filesystem. It creates lock files and data files to coordinate between ranks.

Directory structure:

<coord_dir>/
├── rank_<N>_alive # Created by each rank to signal presence
├── kv/
│ ├── <key1> # Key-value pairs
│ └── <key2>
└── barriers/
└── barrier_<N> # Barrier synchronization

Definition at line 33 of file file_backend.hpp.

Constructor & Destructor Documentation

◆ FileBackend()

rapidsmpf::bootstrap::detail::FileBackend::FileBackend ( Context  ctx)
explicit

Construct a file backend.

Parameters
ctxBootstrap context containing rank and coordination directory.

Member Function Documentation

◆ barrier()

void rapidsmpf::bootstrap::detail::FileBackend::barrier ( )
overridevirtual

Perform a barrier synchronization.

All ranks must call this before any rank proceeds.

Implements rapidsmpf::bootstrap::detail::Backend.

◆ get()

std::string rapidsmpf::bootstrap::detail::FileBackend::get ( std::string const &  key,
Duration  timeout 
)
overridevirtual

Retrieve a value, blocking until available or timeout occurs.

Any rank (including rank 0) can call this method to retrieve values that were published by rank 0 via put() and synchronized with sync().

Parameters
keyKey name.
timeoutTimeout duration.
Returns
Value associated with key.
Exceptions
std::runtime_errorif key not found within timeout.

Implements rapidsmpf::bootstrap::detail::Backend.

◆ put()

void rapidsmpf::bootstrap::detail::FileBackend::put ( std::string const &  key,
std::string const &  value 
)
overridevirtual

Store a key-value pair (rank 0 only).

Only rank 0 should call this method. The key-value pair is committed immediately and made visible to all ranks (including rank 0) after a collective sync(). Non-root ranks should only use get() to retrieve values published by rank 0.

Parameters
keyKey name.
valueValue to store.
Exceptions
std::runtime_errorif called by non-zero rank.

Implements rapidsmpf::bootstrap::detail::Backend.

◆ sync()

void rapidsmpf::bootstrap::detail::FileBackend::sync ( )
overridevirtual

Ensure all previous put() operations are globally visible.

Implements rapidsmpf::bootstrap::detail::Backend.


The documentation for this class was generated from the following file: