![]() |
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. | |
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 196 of file mpiio.cpp.
References BondedInteractionsMap::at(), BondedInteractionsMap::contains(), fatal_error(), BondedInteractionsMap::get_next_key(), number_of_partners(), BondedInteractionsMap::size(), and stream.
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 129 of file mpiio.cpp.
References fatal_error(), and stream.
|
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 96 of file mpiio.cpp.
References errexit(), and stream.
Referenced by dump_info(), fatal_error(), get_num_elem(), mpi_mpiio_common_read(), mpiio_dump_array(), mpiio_read_array(), and read_head().
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 317 of file mpiio.cpp.
References fatal_error(), and stream.
Referenced by mpi_mpiio_common_read().
Calculate the file offset on the local node.
| n_items | Number of items on the local node. |
Definition at line 182 of file mpiio.cpp.
References stream.
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 413 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(), CellStructure::remove_all_particles(), and stream.
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 221 of file mpiio.cpp.
References dump_info(), mpi_calculate_file_offset(), MPIIO_OUT_BND, MPIIO_OUT_POS, MPIIO_OUT_TYP, MPIIO_OUT_VEL, ParticleRange::size(), and stream.
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 155 of file mpiio.cpp.
References fatal_error(), and stream.
|
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 341 of file mpiio.cpp.
References fatal_error(), and stream.
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 368 of file mpiio.cpp.
References fatal_error(), and stream.
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 395 of file mpiio.cpp.
References stream.
Referenced by mpi_mpiio_common_read().