Metall  v0.28
A persistent memory allocator for data-centric analytics
metall::utility::metall_mpi_adaptor Class Reference

A utility class for using Metall with MPI This is an experimental implementation. More...

#include </home/runner/work/metall/metall/include/metall/utility/metall_mpi_adaptor.hpp>

Public Types

using manager_type = metall::manager
 Metall manager type. More...
 

Public Member Functions

 metall_mpi_adaptor (metall::open_only_t, const std::string &root_dir_prefix, const MPI_Comm &comm=MPI_COMM_WORLD)
 Opens an existing Metall datastore. More...
 
 metall_mpi_adaptor (metall::open_read_only_t, const std::string &root_dir_prefix, const MPI_Comm &comm=MPI_COMM_WORLD)
 Opens an existing Metall datastore with the read-only mode. More...
 
 metall_mpi_adaptor (metall::create_only_t, const std::string &root_dir_prefix, const MPI_Comm &comm=MPI_COMM_WORLD, bool overwrite=false)
 Creates a new Metall datastore. More...
 
 metall_mpi_adaptor (metall::create_only_t, const std::string &root_dir_prefix, const std::size_t capacity, const MPI_Comm &comm=MPI_COMM_WORLD, bool overwrite=false)
 Creates a new Metall datastore. More...
 
 ~metall_mpi_adaptor ()
 Destructor that globally synchronizes the close operations of all sub-Metall datastores. More...
 
manager_typeget_local_manager ()
 Returns the Metall manager object of the process. More...
 
const manager_typeget_local_manager () const
 Returns the Metall manager object of the process. More...
 
std::string root_dir_path () const
 Returns the root path of a Metall datastore. More...
 
std::string local_dir_path () const
 Returns the path of the sub-Metall datastore of the process. More...
 
bool snapshot (const std::string &destination_dir_path, bool overwrite=false)
 Take a snapshot of the current Metall datastore to another location. More...
 

Static Public Member Functions

static std::string local_dir_path (const std::string &root_dir_prefix, const int mpi_rank)
 Returns the path of a Metall datastore of a MPI rank. More...
 
static bool copy (const std::string &source_dir_path, const std::string &destination_dir_path, const MPI_Comm &comm=MPI_COMM_WORLD, bool overwrite=false)
 Copies a Metall datastore to another location. The behavior of copying a data store that is open without the read-only mode is undefined. More...
 
static bool remove (const std::string &root_dir_prefix, const MPI_Comm &comm=MPI_COMM_WORLD)
 Removes Metall datastore. More...
 
static int partitions (const std::string &root_dir_prefix, const MPI_Comm &comm=MPI_COMM_WORLD)
 Returns the number of partition of a Metall datastore. More...
 
static bool consistent (const std::string &root_dir_prefix, const MPI_Comm &comm=MPI_COMM_WORLD)
 Checks if all local datastores are consistent. More...
 

Detailed Description

A utility class for using Metall with MPI This is an experimental implementation.

Member Typedef Documentation

◆ manager_type

Constructor & Destructor Documentation

◆ metall_mpi_adaptor() [1/4]

metall::utility::metall_mpi_adaptor::metall_mpi_adaptor ( metall::open_only_t  ,
const std::string &  root_dir_prefix,
const MPI_Comm &  comm = MPI_COMM_WORLD 
)
inline

Opens an existing Metall datastore.

Parameters
root_dir_prefixA root directory path of a Metall datastore.
commA MPI communicator.

◆ metall_mpi_adaptor() [2/4]

metall::utility::metall_mpi_adaptor::metall_mpi_adaptor ( metall::open_read_only_t  ,
const std::string &  root_dir_prefix,
const MPI_Comm &  comm = MPI_COMM_WORLD 
)
inline

Opens an existing Metall datastore with the read-only mode.

Parameters
root_dir_prefixA root directory path of a Metall datastore.
commA MPI communicator.

◆ metall_mpi_adaptor() [3/4]

metall::utility::metall_mpi_adaptor::metall_mpi_adaptor ( metall::create_only_t  ,
const std::string &  root_dir_prefix,
const MPI_Comm &  comm = MPI_COMM_WORLD,
bool  overwrite = false 
)
inline

Creates a new Metall datastore.

Parameters
root_dir_prefixA root directory path of a Metall datastore. The same name of file or directory must not exist.
commA MPI communicator.
overwriteIf true, overwrite an existing datastore. This mode does not overwrite an existing datastore if it is not Metall datastore created by the same number of MPI processes.

◆ metall_mpi_adaptor() [4/4]

metall::utility::metall_mpi_adaptor::metall_mpi_adaptor ( metall::create_only_t  ,
const std::string &  root_dir_prefix,
const std::size_t  capacity,
const MPI_Comm &  comm = MPI_COMM_WORLD,
bool  overwrite = false 
)
inline

Creates a new Metall datastore.

Parameters
root_dir_prefixA root directory path of a Metall datastore. The same name of file or directory must not exist.
capacityThe max capacity of the datastore.
commA MPI communicator.
overwriteIf true, overwrite an existing datastore. This mode does not overwrite an existing datastore if it is not Metall datastore created by the same number of MPI processes.

◆ ~metall_mpi_adaptor()

metall::utility::metall_mpi_adaptor::~metall_mpi_adaptor ( )
inline

Destructor that globally synchronizes the close operations of all sub-Metall datastores.

Member Function Documentation

◆ get_local_manager() [1/2]

manager_type& metall::utility::metall_mpi_adaptor::get_local_manager ( )
inline

Returns the Metall manager object of the process.

Returns
A reference to a Metall manager object.

◆ get_local_manager() [2/2]

const manager_type& metall::utility::metall_mpi_adaptor::get_local_manager ( ) const
inline

Returns the Metall manager object of the process.

Returns
A reference to a Metall manager object.

◆ root_dir_path()

std::string metall::utility::metall_mpi_adaptor::root_dir_path ( ) const
inline

Returns the root path of a Metall datastore.

Returns
A root path of a Metall datastore.

◆ local_dir_path() [1/2]

std::string metall::utility::metall_mpi_adaptor::local_dir_path ( ) const
inline

Returns the path of the sub-Metall datastore of the process.

Returns
A path of a sub-Metall datastore.

◆ local_dir_path() [2/2]

static std::string metall::utility::metall_mpi_adaptor::local_dir_path ( const std::string &  root_dir_prefix,
const int  mpi_rank 
)
inlinestatic

Returns the path of a Metall datastore of a MPI rank.

Parameters
root_dir_prefixA root directory path.
mpi_rankA MPI rank.
Returns
A path of a Metall datastore.

◆ copy()

static bool metall::utility::metall_mpi_adaptor::copy ( const std::string &  source_dir_path,
const std::string &  destination_dir_path,
const MPI_Comm &  comm = MPI_COMM_WORLD,
bool  overwrite = false 
)
inlinestatic

Copies a Metall datastore to another location. The behavior of copying a data store that is open without the read-only mode is undefined.

Parameters
source_dir_pathA path to a source datastore.
destination_dir_pathA path to a destination datastore.
commA MPI communicator.
overwriteIf true, overwrite an existing datastore. This mode does not overwrite an existing datastore if it is not Metall datastore created by the same number of MPI processes.
Returns
Returns true if all processes success; otherwise, returns false.

◆ snapshot()

bool metall::utility::metall_mpi_adaptor::snapshot ( const std::string &  destination_dir_path,
bool  overwrite = false 
)
inline

Take a snapshot of the current Metall datastore to another location.

Parameters
destination_dir_pathA path to a destination datastore.
overwriteIf true, overwrite an existing datastore. This mode does not overwrite an existing datastore if it is not Metall datastore created by the same number of MPI processes.
Returns
Returns true if all processes success; otherwise, returns false.

◆ remove()

static bool metall::utility::metall_mpi_adaptor::remove ( const std::string &  root_dir_prefix,
const MPI_Comm &  comm = MPI_COMM_WORLD 
)
inlinestatic

Removes Metall datastore.

Parameters
root_dir_prefixA root directory path of datastore.
commA MPI communicator.
Returns
Returns true if all processes success; otherwise, returns false. If there is no directory with the given name, returns true.

◆ partitions()

static int metall::utility::metall_mpi_adaptor::partitions ( const std::string &  root_dir_prefix,
const MPI_Comm &  comm = MPI_COMM_WORLD 
)
inlinestatic

Returns the number of partition of a Metall datastore.

Parameters
root_dir_prefixA root directory path of datastore.
commA MPI communicator.
Returns
The number of partitions of a Metall datastore.

◆ consistent()

static bool metall::utility::metall_mpi_adaptor::consistent ( const std::string &  root_dir_prefix,
const MPI_Comm &  comm = MPI_COMM_WORLD 
)
inlinestatic

Checks if all local datastores are consistent.

Parameters
root_dir_prefixA root directory path of datastore.
commA MPI communicator.
Returns
Returns true if all datastores are consistent; otherwise, returns false.

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