|
MADNESS 0.10.1
|
cloud class More...
#include <cloud.h>
Classes | |
| struct | cloudtimer |
| struct | DistributeFunctor |
| functor to distribute/rank/node-replicate a function, passed in as a pointer to WorldObjectBase More... | |
| struct | is_tuple |
| struct | is_tuple< std::tuple< T... > > |
| struct | is_vector |
| struct | is_vector< std::vector< Q > > |
Public Types | |
| typedef std::any | cached_objT |
| typedef std::map< keyT, cached_objT > | cacheT |
| template<typename T > | |
| using | has_cloud_serialize = madness::meta::is_detected< member_cloud_serialize_t, T > |
| using | keyT = madness::archive::ContainerRecordOutputArchive::keyT |
| template<typename T > | |
| using | member_cloud_serialize_t = decltype(std::declval< T >().cloud_store(std::declval< World & >(), std::declval< Cloud & >())) |
| typedef Recordlist< keyT > | recordlistT |
| enum | StoragePolicy { StoreFunction , StoreFunctionPointer } |
| using | valueT = std::vector< unsigned char > |
Public Member Functions | |
| Cloud (madness::World &universe) | |
| ~Cloud () | |
| void | clear () |
| void | clear_cache (World &subworld) |
| void | clear_timings () |
| template<typename T > | |
| T | consuming_load (madness::World &world, recordlistT &recordlist) const |
| similar to load, but will consume the recordlist | |
| void | distribute_targets (const DistributionType dt=Distributed) |
| distribute/node/rank replicate the targets of all world objects stored in the cloud | |
| template<typename T > | |
| std::enable_if< is_vector< T >::value, T >::type | do_load (World &world, recordlistT &recordlist) const |
| template<typename T > | |
| std::enable_if<!is_vector< T >::value, T >::type | do_load (World &world, recordlistT &recordlist) const |
| template<typename T > | |
| T | forward_load (madness::World &world, recordlistT &recordlist) const |
| load a single object from the cloud, recordlist is consumed while loading elements | |
| nlohmann::json | gather_memory_statistics (World &universe) const |
| get size of the cloud container | |
| nlohmann::json | gather_timings (World &universe) const |
| DistributionType | get_replication_policy () const |
| is the cloud container replicated: per rank, per node, or distributed | |
| nlohmann::json | get_statistics (World &world) const |
| return a json object with the cloud settings and statistics | |
| StoragePolicy | get_storing_policy () const |
| storing policy refers to storing functions or pointers to functions | |
| template<typename T > | |
| T | load (madness::World &world, const recordlistT recordlist) const |
| load a single object from the cloud, recordlist is kept unchanged | |
| template<typename T > | |
| T | load_tuple (madness::World &world, recordlistT &recordlist) const |
| void | print_size (World &universe) |
| void | print_timings (World &universe) const |
| backwards compatibility | |
| void | replicate (const std::size_t chunk_size=INT_MAX) |
| void | replicate_according_to_policy (const std::size_t chunk_size=INT_MAX) |
| void | replicate_per_node (const std::size_t chunk_size=INT_MAX) |
| void | set_debug (bool value) |
| void | set_fence (bool value) |
| void | set_force_load_from_cache (bool value) |
| void | set_replication_policy (const DistributionType value) |
| is the cloud container replicated: per rank, per node, or distributed | |
| void | set_storing_policy (const StoragePolicy value) |
| storing policy refers to storing functions or pointers to functions | |
| template<typename T > | |
| recordlistT | store (madness::World &world, const T &source) |
| template<typename T > | |
| recordlistT | store_other (madness::World &world, const std::vector< T > &source) |
| template<typename... Ts> | |
| recordlistT | store_tuple (World &world, const std::tuple< Ts... > &input) |
| store a tuple in multiple records | |
| bool | validate_replication_policy () const |
Static Public Member Functions | |
| static void | print_memory_statistics (const nlohmann::json stats) |
| static void | print_timings (const nlohmann::json timings) |
Public Attributes | |
| std::atomic< long > | copy_time =0l |
| std::atomic< long > | target_replication_time =0l |
| std::list< WorldObjectBase * > | world_object_base_list |
Private Types | |
| template<typename T > | |
| using | is_parallel_serializable_object = std::is_base_of< archive::ParallelSerializableObject, T > |
| template<typename T > | |
| using | is_world_constructible = std::is_constructible< T, World & > |
Private Member Functions | |
| template<typename T > | |
| T | allocator (World &world) const |
| template<typename T > | |
| void | cache (madness::World &world, const T &obj, const keyT &record) const |
| bool | is_cached (const keyT &key) const |
| bool | is_in_container (const keyT &key) const |
| checks if a (universe) container record is used | |
| template<typename T > | |
| T | load_from_cache (madness::World &world, const keyT &record) const |
| load an object from the cache, record is unchanged | |
| template<typename T > | |
| recordlistT | store_other (madness::World &world, const T &source) |
Private Attributes | |
| std::atomic< long > | cache_reads =0l |
| std::atomic< long > | cache_stores =0l |
| cacheT | cached_objects |
| DistributionType | cloud_replication_policy = Distributed |
| cloud is a container: replication policy for the cloud container: distributed, node-replicated, rank-replicated | |
| madness::WorldContainer< keyT, valueT > | container |
| bool | debug = false |
| prints debug output | |
| bool | dofence = true |
| fences after load/store | |
| bool | force_load_from_cache = false |
| forces load from cache (mainly for debugging) | |
| bool | is_replicated =false |
| if contents of the container are replicated | |
| recordlistT | local_list_of_container_keys |
| std::atomic< long > | reading_time =0l |
| std::atomic< long > | replication_time =0l |
| StoragePolicy | storage_policy = StoreFunctionPointer |
| are the functions (WorldObjects) stored in the cloud or only pointers to them | |
| bool | use_cache =true |
| std::atomic< long > | writing_time =0l |
| std::atomic< long > | writing_time1 =0l |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const StoragePolicy &sp) |
| std::string | to_string (const StoragePolicy sp) |
cloud class
store and load data to/from the cloud into arbitrary worlds
Distributed data is always bound to a certain world. If it needs to be present in another world it can be serialized to the cloud and deserialized from there again. For an example see test_cloud.cc
Data is stored into a distributed container living in the universe. During storing a (replicated) list of records is returned that can be used to find the data in the container. If a combined object (a vector, tuple, etc) is stored a list of records will be generated. When loading the data from the world the record list will be used to deserialize all stored objects.
Note that there must be a fence after the destruction of subworld containers, as in:
create subworlds { dcT(subworld) do work } subworld.gop.fence();
| typedef std::any madness::Cloud::cached_objT |
| typedef std::map<keyT, cached_objT> madness::Cloud::cacheT |
| using madness::Cloud::has_cloud_serialize = madness::meta::is_detected<member_cloud_serialize_t, T> |
|
private |
|
private |
| using madness::Cloud::member_cloud_serialize_t = decltype(std::declval<T>().cloud_store(std::declval<World&>(), std::declval<Cloud&>())) |
| typedef Recordlist<keyT> madness::Cloud::recordlistT |
| using madness::Cloud::valueT = std::vector<unsigned char> |
|
inline |
| [in] | universe | the universe world |
|
inline |
References cached_objects, local_list_of_container_keys, and madness::print().
References T().
|
inlineprivate |
References cached_objects.
|
inline |
References container.
Referenced by madness::MacroTaskQ::run_all(), and test_custom_serialization().
|
inline |
References cached_objects, madness::WorldGopInterface::fence(), madness::World::gop, and local_list_of_container_keys.
Referenced by chunk_example(), main(), madness::MacroTaskQ::run_all(), simple_example(), test_copy_function_from_other_world_through_cloud(), test_pointer_to_funcimpl(), test_replication_policy(), test_tuple(), and test_twice().
|
inline |
References cache_reads, cache_stores, copy_time, reading_time, replication_time, target_replication_time, writing_time, and writing_time1.
Referenced by test_twice().
|
inline |
similar to load, but will consume the recordlist
| [in] | world | the subworld the objects are loaded to |
| [in] | recordlist | the list of records where the objects are stored |
References reading_time.
Referenced by madness::MacroTask< taskT >::MacroTaskInternal::get_output().
|
inline |
distribute/node/rank replicate the targets of all world objects stored in the cloud
References madness::WorldGopInterface::fence(), madness::World::gop, and world_object_base_list.
Referenced by madness::MacroTaskQ::run_all().
|
inline |
load a single object from the cloud, pop record from recordlist
| [in,out] | world | destination world |
| [in,out] | recordlist | list of records to load from (reduced by the first element) |
References madness::cache, container, debug, force_load_from_cache, madness::World::id(), is_cached(), is_replicated, MADNESS_CHECK, MADNESS_EXCEPTION, madness::print(), storage_policy, StoreFunctionPointer, T(), target(), and use_cache.
|
inline |
load a single object from the cloud, recordlist is consumed while loading elements
Referenced by madness::CCIntermediatePotentials::cloud_load(), madness::Info::cloud_load(), madness::CCPair::cloud_load(), custom_serialize_tester::cloud_load(), and load_tuple().
|
inline |
get size of the cloud container
References container, madness::get_rss_usage_in_GB(), madness::World::gop, madness::WorldGopInterface::max(), madness::WorldGopInterface::min(), and madness::WorldGopInterface::sum().
Referenced by get_statistics(), print_size(), test_copy_function_from_other_world_through_cloud(), and test_replication_policy().
|
inline |
References cache_reads, cache_stores, copy_time, madness::World::gop, madness::WorldGopInterface::max(), reading_time, replication_time, madness::World::size(), madness::WorldGopInterface::sum(), target_replication_time, and writing_time.
Referenced by get_statistics(), print_timings(), madness::MacroTaskQ::run_all(), and test_twice().
|
inline |
is the cloud container replicated: per rank, per node, or distributed
References cloud_replication_policy.
Referenced by madness::MacroTaskQ::run_all().
|
inline |
return a json object with the cloud settings and statistics
References cached_objects, cloud_replication_policy, gather_memory_statistics(), gather_timings(), is_replicated, storage_policy, and to_string.
Referenced by madness::MacroTaskQ::run_all().
|
inline |
storing policy refers to storing functions or pointers to functions
References storage_policy.
|
inlineprivate |
References cached_objects.
Referenced by do_load().
|
inlineprivate |
checks if a (universe) container record is used
currently implemented with a local copy of the recordlist, might be reimplemented with container.find(), which would include blocking communication.
References local_list_of_container_keys.
Referenced by store_other().
|
inline |
load a single object from the cloud, recordlist is kept unchanged
| [in] | world | the subworld the objects are loaded to |
| [in] | recordlist | the list of records where the objects are stored |
References reading_time.
Referenced by chunk_example(), main(), madness::MacroTask< taskT >::MacroTaskInternal::run(), simple_example(), test_copy_function_from_other_world_through_cloud(), test_custom_serialization(), test_custom_worldobject(), test_pointer_to_funcimpl(), test_replication_policy(), test_tuple(), and test_twice().
|
inlineprivate |
load an object from the cache, record is unchanged
References cache_reads, cached_objects, debug, madness::World::id(), MADNESS_EXCEPTION, madness::print(), madness::World::rank(), T(), and target().
|
inline |
load a tuple from the cloud, pop records from recordlist
| [in,out] | world | destination world |
| [in,out] | recordlist | list of records to load from (reduced by the first few elements) |
References debug, forward_load(), madness::World::id(), madness::name(), T(), target(), and madness::type().
|
inlinestatic |
References madness::print(), and stats.
Referenced by madness::MacroTaskQ::run_all().
|
inline |
References gather_memory_statistics(), is_replicated, madness::print(), madness::World::rank(), madness::World::size(), and stats.
Referenced by madness::MacroTaskQ::run_all().
|
inlinestatic |
References madness::print().
|
inline |
backwards compatibility
References gather_timings(), and madness::print_timings.
Referenced by madness::MacroTaskQ::run_all(), and test_twice().
|
inline |
References madness::WorldMpiInterface::Bcast(), container, madness::cpu_time(), debug, madness::WorldGopInterface::fence(), madness::WorldContainer< keyT, valueT, hashfunT >::find(), madness::World::gop, is_replicated, MADNESS_CHECK, MADNESS_CHECK_THROW, madness::World::mpi, MPI_BYTE, madness::print(), madness::World::rank(), replication_time, and madness::World::size().
Referenced by chunk_example(), replicate_according_to_policy(), and madness::MacroTaskQ::run_all().
|
inline |
References cloud_replication_policy, container, madness::Distributed, MADNESS_EXCEPTION, madness::NodeReplicated, madness::RankReplicated, replicate(), and replicate_per_node().
Referenced by test_replication_policy().
|
inline |
References container, madness::cpu_time(), debug, madness::WorldGopInterface::fence(), madness::World::gop, is_replicated, MADNESS_CHECK_THROW, MADNESS_EXCEPTION, madness::print(), madness::World::rank(), and replication_time.
Referenced by replicate_according_to_policy(), and madness::MacroTaskQ::run_all().
|
inline |
References debug.
Referenced by test_custom_serialization(), test_custom_worldobject(), and test_tuple().
|
inline |
References dofence.
|
inline |
References force_load_from_cache.
Referenced by main(), test_custom_worldobject(), and test_tuple().
|
inline |
is the cloud container replicated: per rank, per node, or distributed
References cloud_replication_policy, madness::RankReplicated, and use_cache.
Referenced by madness::MacroTaskQ::MacroTaskQ(), and test_replication_policy().
|
inline |
storing policy refers to storing functions or pointers to functions
References storage_policy.
Referenced by madness::MacroTaskQ::MacroTaskQ(), simple_example(), test_copy_function_from_other_world_through_cloud(), and test_replication_policy().
|
inline |
| [in] | world | presumably the universe |
References dofence, madness::WorldGopInterface::fence(), madness::World::gop, is_replicated, MADNESS_EXCEPTION, madness::print(), source(), store_other(), store_tuple(), and writing_time.
Referenced by chunk_example(), madness::CCIntermediatePotentials::cloud_store(), madness::Info::cloud_store(), madness::CCPair::cloud_store(), custom_serialize_tester::cloud_store(), main(), madness::MacroTask< taskT >::prepare_output_records(), simple_example(), store_tuple(), test_copy_function_from_other_world_through_cloud(), test_custom_serialization(), test_custom_worldobject(), test_pointer_to_funcimpl(), test_replication_policy(), test_tuple(), and test_twice().
|
inline |
|
inlineprivate |
References cache_stores, madness::Recordlist< keyT >::compute_record(), container, debug, dofence, madness::WorldGopInterface::fence(), madness::World::gop, is_in_container(), local_list_of_container_keys, madness::print(), madness::World::rank(), source(), storage_policy, StoreFunctionPointer, T(), madness::type_name< T >::value(), world_object_base_list, and writing_time1.
Referenced by store(), and store_other().
|
inline |
|
inline |
References cloud_replication_policy, container, and madness::validate_distribution_type().
Referenced by test_replication_policy().
|
friend |
|
friend |
Referenced by get_statistics().
|
mutableprivate |
Referenced by clear_timings(), gather_timings(), and load_from_cache().
|
mutableprivate |
Referenced by clear_timings(), gather_timings(), and store_other().
|
private |
Referenced by ~Cloud(), cache(), clear_cache(), get_statistics(), is_cached(), and load_from_cache().
|
private |
cloud is a container: replication policy for the cloud container: distributed, node-replicated, rank-replicated
Referenced by get_replication_policy(), get_statistics(), replicate_according_to_policy(), set_replication_policy(), and validate_replication_policy().
|
mutableprivate |
|
mutable |
Referenced by clear_timings(), gather_timings(), and madness::MacroTask< taskT >::MacroTaskInternal::run().
|
private |
prints debug output
Referenced by do_load(), load_from_cache(), load_tuple(), replicate(), replicate_per_node(), set_debug(), store_other(), and store_other().
|
private |
fences after load/store
Referenced by set_fence(), store(), store_other(), and store_other().
|
private |
forces load from cache (mainly for debugging)
Referenced by do_load(), and set_force_load_from_cache().
|
private |
if contents of the container are replicated
Referenced by do_load(), get_statistics(), print_size(), replicate(), replicate_per_node(), and store().
|
private |
Referenced by ~Cloud(), clear_cache(), is_in_container(), and store_other().
|
mutableprivate |
Referenced by clear_timings(), consuming_load(), gather_timings(), and load().
|
mutableprivate |
Referenced by clear_timings(), gather_timings(), replicate(), and replicate_per_node().
|
private |
are the functions (WorldObjects) stored in the cloud or only pointers to them
Referenced by do_load(), get_statistics(), get_storing_policy(), set_storing_policy(), and store_other().
|
mutable |
Referenced by clear_timings(), gather_timings(), and madness::MacroTaskQ::run_all().
|
private |
Referenced by do_load(), and set_replication_policy().
| std::list<WorldObjectBase*> madness::Cloud::world_object_base_list |
Referenced by distribute_targets(), madness::MacroTaskQ::run_all(), and store_other().
|
mutableprivate |
Referenced by clear_timings(), gather_timings(), and store().
|
mutableprivate |
Referenced by clear_timings(), and store_other().