ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
|
Classes | |
struct | write_buffers |
Enumerations | |
enum | MPIIOOutputFields : unsigned int { MPIIO_OUT_NON = 0u , MPIIO_OUT_POS = 1u , MPIIO_OUT_VEL = 2u , MPIIO_OUT_TYP = 4u , MPIIO_OUT_BND = 8u } |
Constants which indicate what to output. More... | |
Functions | |
static bool | fatal_error (char const *msg, std::string const &fn="", std::string const &extra="") |
Fatal error handler. | |
static bool | fatal_error (char const *msg, std::string const &fn, MPI_File *fp, int errnum) |
Fatal error handler that closes an open file and queries the message associated with an MPI error code. | |
template<typename T > | |
static void | mpiio_dump_array (const std::string &fn, T const *arr, std::size_t len, std::size_t pref, MPI_Datatype MPI_T) |
Dump data arr of size len starting from prefix pref of type T using MPI_T as MPI datatype. | |
static unsigned long | mpi_calculate_file_offset (unsigned long n_items) |
Calculate the file offset on the local node. | |
static void | dump_info (std::string const &fn, unsigned fields, BondedInteractionsMap const &bonded_ias) |
Dump the fields and bond information. | |
void | mpi_mpiio_common_write (std::string const &prefix, unsigned fields, BondedInteractionsMap const &bonded_ias, ParticleRange const &particles, write_buffers &buffers) |
Parallel binary output using MPI-IO. | |
static unsigned long | get_num_elem (const std::string &fn, std::size_t elem_sz) |
Get the number of elements in a file by its file size and elem_sz . | |
template<typename T > | |
static void | mpiio_read_array (const std::string &fn, T *arr, std::size_t len, std::size_t pref, MPI_Datatype MPI_T) |
Read a previously dumped array of size len starting from prefix pref of type T using MPI_T as MPI datatype. | |
static unsigned | read_head (const std::string &fn, int rank) |
Read the header file and return the first value. | |
static std::tuple< unsigned long, unsigned long > | read_prefs (const std::string &fn, int rank, int size, unsigned long nglobalpart) |
Read the pref file. | |
void | mpi_mpiio_common_read (std::string const &prefix, unsigned fields, CellStructure &cell_structure) |
Parallel binary input using MPI-IO. | |
enum Mpiio::MPIIOOutputFields : unsigned int |
Constants which indicate what to output.
To indicate the output of multiple fields, OR the corresponding values.
Enumerator | |
---|---|
MPIIO_OUT_NON | |
MPIIO_OUT_POS | |
MPIIO_OUT_VEL | |
MPIIO_OUT_TYP | |
MPIIO_OUT_BND |
Definition at line 41 of file core/io/mpiio/mpiio.hpp.
|
static |
Dump the fields and bond information.
To be called by the head node only.
fn | The filename to write to |
fields | The dumped fields |
bonded_ias | The list of bonds |
Definition at line 189 of file mpiio.cpp.
References BondedInteractionsMap::at(), BondedInteractionsMap::contains(), fatal_error(), BondedInteractionsMap::get_next_key(), number_of_partners(), and BondedInteractionsMap::size().
Referenced by mpi_mpiio_common_write().
|
static |
Fatal error handler that closes an open file and queries the message associated with an MPI error code.
On 1 MPI rank the error is recoverable and an exception is thrown. On more than 1 MPI rank the error is not recoverable.
msg | Custom error message |
fn | File path |
fp | File handle |
errnum | MPI error code |
Definition at line 122 of file mpiio.cpp.
References fatal_error().
|
static |
Fatal error handler.
On 1 MPI rank the error is recoverable and an exception is thrown. On more than 1 MPI rank the error is not recoverable.
msg | Custom error message |
fn | File path |
extra | Extra context |
Definition at line 92 of file mpiio.cpp.
References errexit().
Referenced by dump_info(), fatal_error(), get_num_elem(), mpi_mpiio_common_read(), mpiio_dump_array(), mpiio_read_array(), and read_head().
|
static |
Get the number of elements in a file by its file size and elem_sz
.
I.e. query the file size using stat(2) and divide it by elem_sz
.
fn | The filename |
elem_sz | Size of a single element |
Definition at line 310 of file mpiio.cpp.
References fatal_error().
Referenced by mpi_mpiio_common_read().
|
static |
Calculate the file offset on the local node.
n_items | Number of items on the local node. |
Definition at line 175 of file mpiio.cpp.
Referenced by mpi_mpiio_common_read(), and mpi_mpiio_common_write().
void Mpiio::mpi_mpiio_common_read | ( | std::string const & | prefix, |
unsigned | fields, | ||
CellStructure & | cell_structure | ||
) |
Parallel binary input using MPI-IO.
To be called by all MPI processes. Aborts ESPResSo if an error occurs. On 1 MPI rank, the error is converted to a runtime error and can be recovered.
prefix | Filepath prefix. |
fields | Specifier for which fields to read. |
cell_structure | Bonds to serialize. |
Definition at line 406 of file mpiio.cpp.
References CellStructure::add_particle(), fatal_error(), get_num_elem(), mpi_calculate_file_offset(), MPIIO_OUT_BND, MPIIO_OUT_POS, MPIIO_OUT_TYP, MPIIO_OUT_VEL, read_head(), read_prefs(), and CellStructure::remove_all_particles().
Referenced by ScriptInterface::MPIIO::MPIIOScript::do_call_method().
void Mpiio::mpi_mpiio_common_write | ( | std::string const & | prefix, |
unsigned | fields, | ||
BondedInteractionsMap const & | bonded_ias, | ||
ParticleRange const & | particles, | ||
write_buffers & | buffers | ||
) |
Parallel binary output using MPI-IO.
To be called by all MPI processes. Aborts ESPResSo if an error occurs. On 1 MPI rank, the error is converted to a runtime error and can be recovered by removing any file that may have already been written.
prefix | Filepath prefix. |
fields | Specifier for which fields to dump. |
bonded_ias | Bonds to serialize. |
particles | Range of particles to serialize. |
buffers | Write buffers. |
Definition at line 214 of file mpiio.cpp.
References dump_info(), Mpiio::write_buffers::id, mpi_calculate_file_offset(), MPIIO_OUT_BND, MPIIO_OUT_POS, MPIIO_OUT_TYP, MPIIO_OUT_VEL, Mpiio::write_buffers::pos, ParticleRange::size(), Mpiio::write_buffers::type, and Mpiio::write_buffers::vel.
Referenced by ScriptInterface::MPIIO::MPIIOScript::do_call_method().
|
static |
Dump data arr
of size len
starting from prefix pref
of type T
using MPI_T
as MPI datatype.
Beware, that T
and MPI_T
have to match!
fn | The file name to write to (must not already exist!) |
arr | The array to dump |
len | The number of elements to dump |
pref | The prefix for this process |
MPI_T | The MPI datatype corresponding to the template parameter T |
Definition at line 148 of file mpiio.cpp.
References fatal_error().
|
static |
Read a previously dumped array of size len
starting from prefix pref
of type T
using MPI_T
as MPI datatype.
Beware, that T
and MPI_T
have to match!
fn | The file name to read from |
arr | The array to populate |
len | The number of elements to read |
pref | The prefix for this process |
MPI_T | The MPI datatype corresponding to the template parameter T |
Definition at line 334 of file mpiio.cpp.
References fatal_error().
|
static |
Read the header file and return the first value.
To be called by all processes.
fn | Filename of the head file |
rank | The rank of the current process in MPI_COMM_WORLD |
Definition at line 361 of file mpiio.cpp.
References fatal_error().
Referenced by mpi_mpiio_common_read().
|
static |
Read the pref file.
Needs to be called by all processes.
fn | The file name of the prefs file |
rank | The rank of the current process in MPI_COMM_WORLD |
size | The size of MPI_COMM_WORLD |
nglobalpart | The global amount of particles |
Definition at line 388 of file mpiio.cpp.
Referenced by mpi_mpiio_common_read().