MADNESS
0.10.1
|
Base class for input and output parallel archives. More...
#include <parallel_archive.h>
Public Member Functions | |
template<typename X = Archive> | |
BaseParallelArchive (typename std::enable_if_t< std::is_same< X, BinaryFstreamInputArchive >::value||std::is_same< X, BinaryFstreamOutputArchive >::value, int > nio=0) | |
Default constructor. More... | |
BaseParallelArchive (World &world, Archive &ar, int nio) | |
template<typename objT > | |
void | broadcast (objT &obj, ProcessID root) const |
Same as world.gop.broadcast_serializable(obj, root) . More... | |
void | close () |
Closes the parallel archive. More... | |
bool | dofence () const |
Check if we should fence around a read/write operation. More... | |
World * | get_world () const |
Returns a pointer to the world. More... | |
ProcessID | io_node (ProcessID rank) const |
Returns the process doing I/O for given node. More... | |
bool | is_io_node () const |
Returns true if this node is doing physical I/O. More... | |
Archive & | local_archive () const |
Returns a reference to the local archive. More... | |
ProcessID | my_io_node () const |
Returns the process doing I/O for this node. More... | |
int | num_io_clients () const |
Returns the number of I/O clients for this node, including self (zero if not an I/O node). More... | |
template<typename X = Archive> | |
std::enable_if_t< std::is_same< X, BinaryFstreamInputArchive >::value||std::is_same< X, BinaryFstreamOutputArchive >::value, void > | open (World &world, const char *filename, int nwriter=1) |
Opens the parallel archive. More... | |
void | remove () |
Removes the files associated with the current archive. More... | |
void | set_dofence (bool dofence) |
Set the flag for fencing around a read/write operation. More... | |
void | set_nclient (World &world) |
Static Public Member Functions | |
template<typename X = Archive> | |
static std::enable_if_t< std::is_same< X, BinaryFstreamInputArchive >::value||std::is_same< X, BinaryFstreamOutputArchive >::value, bool > | exists (World &world, const char *filename) |
Returns true if the named, unopened archive exists on disk with read access. More... | |
template<typename X = Archive> | |
static std::enable_if_t< std::is_same< X, BinaryFstreamInputArchive >::value||std::is_same< X, BinaryFstreamOutputArchive >::value, void > | remove (World &world, const char *filename) |
Deletes the files associated with the archive of the given name. More... | |
Static Public Attributes | |
static const bool | is_parallel_archive = true |
Mark this class as a parallel archive. More... | |
Private Attributes | |
Archive | ar |
The local archive. More... | |
bool | do_fence =true |
If true (default), a read/write of parallel objects fences before and after I/O. More... | |
char | fname [256] |
Name of the archive. More... | |
int | nclient |
Number of clients of this node, including self. Zero if not I/O node. More... | |
int | nio |
Number of I/O nodes (always includes node zero). More... | |
World * | world |
The world. More... | |
Base class for input and output parallel archives.
Archive | The local archive. Only tested for BinaryFstreamInputArchive and BinaryFstreamOutputArchive . |
BaseArchive
?
|
inline |
|
inline |
Default constructor.
|
inline |
Same as world.gop.broadcast_serializable(obj, root)
.
objT | Type of object to broadcast. |
[in] | obj | The object to broadcast. |
[in] | root | The root process for broadcasting. |
References madness::WorldGopInterface::broadcast_serializable(), madness::archive::BaseParallelArchive< Archive >::get_world(), and madness::World::gop.
Referenced by madness::archive::ArchiveImpl< ParallelInputArchive< localarchiveT >, archive_array< T > >::wrap_load(), and madness::archive::ArchiveImpl< ParallelInputArchive< localarchiveT >, T >::wrap_load().
|
inline |
Closes the parallel archive.
References madness::archive::BaseParallelArchive< Archive >::ar, madness::archive::BaseParallelArchive< Archive >::is_io_node(), MADNESS_CHECK, and madness::archive::BaseParallelArchive< Archive >::world.
Referenced by test13(), test_io(), and test_serialize().
|
inline |
Check if we should fence around a read/write operation.
References madness::archive::BaseParallelArchive< Archive >::do_fence.
Referenced by madness::archive::ArchiveLoadImpl< ParallelInputArchive< localarchiveT >, WorldContainer< keyT, valueT > >::load(), madness::archive::BaseParallelArchive< Archive >::set_dofence(), and madness::archive::ArchiveStoreImpl< ParallelOutputArchive< localarchiveT >, WorldContainer< keyT, valueT > >::store().
|
inlinestatic |
Returns true if the named, unopened archive exists on disk with read access.
This is a collective operation.
[in] | world | The world. |
[in] | filename | Name of the file. |
References madness::WorldGopInterface::broadcast(), bufsize, madness::filename, madness::World::gop, MADNESS_CHECK, madness::World::rank(), status, and madness::archive::BaseParallelArchive< Archive >::world.
Referenced by madness::archive::BaseParallelArchive< Archive >::open().
|
inline |
Returns a pointer to the world.
References MADNESS_CHECK, and madness::archive::BaseParallelArchive< Archive >::world.
Referenced by madness::archive::BaseParallelArchive< Archive >::broadcast(), madness::archive::ArchiveLoadImpl< ParallelInputArchive< archiveT >, CCPairFunction< T, NDIM > >::load(), madness::archive::ArchiveLoadImpl< ParallelInputArchive< archiveT >, Function< T, NDIM > >::load(), madness::archive::ArchiveLoadImpl< ParallelInputArchive< localarchiveT >, WorldContainer< keyT, valueT > >::load(), madness::archive::ArchiveStoreImpl< ParallelOutputArchive< ContainerRecordOutputArchive >, WorldContainer< keyT, valueT > >::store(), madness::archive::ArchiveStoreImpl< ParallelOutputArchive< localarchiveT >, WorldContainer< keyT, valueT > >::store(), madness::archive::ArchiveStoreImpl< ParallelOutputArchive< VectorOutputArchive >, WorldContainer< keyT, valueT > >::store(), madness::archive::ArchiveImpl< ParallelInputArchive< localarchiveT >, archive_array< T > >::wrap_load(), madness::archive::ArchiveImpl< ParallelInputArchive< localarchiveT >, T >::wrap_load(), madness::archive::ArchiveImpl< ParallelOutputArchive< localarchiveT >, archive_array< T > >::wrap_store(), and madness::archive::ArchiveImpl< ParallelOutputArchive< localarchiveT >, T >::wrap_store().
|
inline |
Returns the process doing I/O for given node.
Currently assigned in a round-robin fashion to the first nio
processes, except on IBM BG/P where we use every 64th.
[in] | rank | The node to check. |
rank
. References madness::archive::BaseParallelArchive< Archive >::nio.
Referenced by madness::archive::BaseParallelArchive< Archive >::my_io_node(), madness::archive::BaseParallelArchive< Archive >::set_nclient(), and madness::archive::ArchiveStoreImpl< ParallelOutputArchive< localarchiveT >, WorldContainer< keyT, valueT > >::store().
|
inline |
Returns true if this node is doing physical I/O.
References MADNESS_CHECK, madness::archive::BaseParallelArchive< Archive >::my_io_node(), madness::World::rank(), and madness::archive::BaseParallelArchive< Archive >::world.
Referenced by madness::archive::BaseParallelArchive< Archive >::close(), madness::archive::ParallelOutputArchive< localarchiveT >::flush(), madness::archive::ArchiveLoadImpl< ParallelInputArchive< localarchiveT >, WorldContainer< keyT, valueT > >::load(), madness::archive::BaseParallelArchive< Archive >::local_archive(), madness::archive::BaseParallelArchive< Archive >::open(), and madness::archive::ArchiveStoreImpl< ParallelOutputArchive< localarchiveT >, WorldContainer< keyT, valueT > >::store().
|
inline |
Returns a reference to the local archive.
MadnessException | If not an I/O node. |
References madness::archive::BaseParallelArchive< Archive >::ar, madness::archive::BaseParallelArchive< Archive >::is_io_node(), MADNESS_CHECK, and madness::archive::BaseParallelArchive< Archive >::world.
Referenced by madness::archive::ParallelOutputArchive< localarchiveT >::flush(), madness::archive::ArchiveLoadImpl< ParallelInputArchive< localarchiveT >, WorldContainer< keyT, valueT > >::load(), madness::archive::ArchiveStoreImpl< ParallelOutputArchive< ContainerRecordOutputArchive >, WorldContainer< keyT, valueT > >::store(), madness::archive::ArchiveStoreImpl< ParallelOutputArchive< localarchiveT >, WorldContainer< keyT, valueT > >::store(), madness::archive::ArchiveStoreImpl< ParallelOutputArchive< VectorOutputArchive >, WorldContainer< keyT, valueT > >::store(), madness::archive::ArchiveImpl< ParallelInputArchive< localarchiveT >, archive_array< T > >::wrap_load(), madness::archive::ArchiveImpl< ParallelInputArchive< localarchiveT >, T >::wrap_load(), madness::archive::ArchiveImpl< ParallelOutputArchive< localarchiveT >, archive_array< T > >::wrap_store(), and madness::archive::ArchiveImpl< ParallelOutputArchive< localarchiveT >, T >::wrap_store().
|
inline |
Returns the process doing I/O for this node.
References madness::archive::BaseParallelArchive< Archive >::io_node(), MADNESS_CHECK, madness::World::rank(), and madness::archive::BaseParallelArchive< Archive >::world.
Referenced by madness::archive::BaseParallelArchive< Archive >::is_io_node(), and madness::archive::ArchiveStoreImpl< ParallelOutputArchive< localarchiveT >, WorldContainer< keyT, valueT > >::store().
|
inline |
Returns the number of I/O clients for this node, including self (zero if not an I/O node).
References MADNESS_CHECK, madness::archive::BaseParallelArchive< Archive >::nclient, and madness::archive::BaseParallelArchive< Archive >::world.
Referenced by madness::archive::ArchiveStoreImpl< ParallelOutputArchive< localarchiveT >, WorldContainer< keyT, valueT > >::store().
|
inline |
Opens the parallel archive.
ionode
s is adjusted to to be the same as the number that wrote the original archive. Presently, we don't have logic to handle reading an archive using fewer processes originally used to write it. If you want to fix this have a look in worlddc.h for the only spot that currently needs changing to make that work.[in] | world | The world. |
[in] | filename | Name of the file. |
[in] | nwriter | The number of writers. |
References madness::archive::BaseParallelArchive< Archive >::ar, madness::WorldGopInterface::broadcast(), bufsize, madness::archive::BaseParallelArchive< Archive >::exists(), madness::filename, madness::archive::BaseParallelArchive< Archive >::fname, madness::World::gop, madness::archive::BaseParallelArchive< Archive >::is_io_node(), MADNESS_CHECK, madness::archive::BaseParallelArchive< Archive >::nio, madness::World::rank(), madness::archive::BaseParallelArchive< Archive >::set_nclient(), madness::World::size(), and madness::archive::BaseParallelArchive< Archive >::world.
Referenced by madness::archive::ParallelInputArchive< localarchiveT >::ParallelInputArchive(), madness::archive::ParallelOutputArchive< localarchiveT >::ParallelOutputArchive(), and test13().
|
inline |
Removes the files associated with the current archive.
References madness::archive::BaseParallelArchive< Archive >::fname, MADNESS_CHECK, and madness::archive::BaseParallelArchive< Archive >::world.
Referenced by madness::archive::BaseParallelArchive< Archive >::remove().
|
inlinestatic |
Deletes the files associated with the archive of the given name.
Presently assumes a shared file system since process zero does the deleting.
[in] | world | The world. |
[in] | filename | Base name of the file. |
References bufsize, madness::filename, MADNESS_CHECK, p(), madness::World::rank(), madness::archive::BaseParallelArchive< Archive >::remove(), madness::World::size(), and madness::archive::BaseParallelArchive< Archive >::world.
|
inline |
Set the flag for fencing around a read/write operation.
[in] | dofence | True if we should fence; false otherwise. |
References madness::archive::BaseParallelArchive< Archive >::dofence().
|
inline |
References madness::archive::BaseParallelArchive< Archive >::io_node(), me, madness::archive::BaseParallelArchive< Archive >::nclient, p(), madness::World::rank(), madness::World::size(), and madness::archive::BaseParallelArchive< Archive >::world.
Referenced by madness::archive::BaseParallelArchive< Archive >::BaseParallelArchive(), and madness::archive::BaseParallelArchive< Archive >::open().
|
mutableprivate |
|
private |
If true (default), a read/write of parallel objects fences before and after I/O.
Referenced by madness::archive::BaseParallelArchive< Archive >::dofence().
|
private |
|
static |
Mark this class as a parallel archive.
|
private |
Number of clients of this node, including self. Zero if not I/O node.
Referenced by madness::archive::BaseParallelArchive< Archive >::num_io_clients(), and madness::archive::BaseParallelArchive< Archive >::set_nclient().
|
private |
Number of I/O nodes (always includes node zero).
Referenced by madness::archive::BaseParallelArchive< Archive >::io_node(), and madness::archive::BaseParallelArchive< Archive >::open().
|
private |
The world.
Referenced by madness::archive::BaseParallelArchive< Archive >::BaseParallelArchive(), madness::archive::BaseParallelArchive< Archive >::close(), madness::archive::BaseParallelArchive< Archive >::exists(), madness::archive::BaseParallelArchive< Archive >::get_world(), madness::archive::BaseParallelArchive< Archive >::is_io_node(), madness::archive::BaseParallelArchive< Archive >::local_archive(), madness::archive::BaseParallelArchive< Archive >::my_io_node(), madness::archive::BaseParallelArchive< Archive >::num_io_clients(), madness::archive::BaseParallelArchive< Archive >::open(), madness::archive::BaseParallelArchive< Archive >::remove(), and madness::archive::BaseParallelArchive< Archive >::set_nclient().