12 #ifndef SST_CORE_CORE_SHAREDREGIONIMPL_H
13 #define SST_CORE_CORE_SHAREDREGIONIMPL_H
15 #include "sst/core/sst_types.h"
16 #include "sst/core/warnmacros.h"
23 #include "sst/core/sharedRegion.h"
24 #include "sst/core/serialization/serializable.h"
28 class SharedRegionImpl;
37 ChangeSet(
size_t offset,
size_t length, uint8_t *data =
nullptr) : offset(offset), length(length), data(data) { }
48 ser & SST::Core::Serialization::array(data,length);
68 RegionMergeInfo(
int rank,
const std::string& key) : rank(rank), key(key) { }
71 virtual bool merge(
RegionInfo *UNUSED(ri)) {
return true; }
72 const std::string& getKey()
const {
return key; }
91 length(length), data(data)
95 bool ret = ri->getMerger()->
merge((uint8_t*)ri->getMemory(), (
const uint8_t*)data, length);
101 RegionInfo::RegionMergeInfo::serialize_order(ser);
110 ser & SST::Core::Serialization::array(data,length);
120 std::vector<ChangeSet> changeSets;
126 changeSets(changeSets)
129 return ri->getMerger()->
merge((uint8_t*)ri->getMemory(), ri->getSize(), changeSets);
133 RegionInfo::RegionMergeInfo::serialize_order(ser);
150 std::vector<SharedRegionImpl*> sharers;
154 std::vector<ChangeSet> changesets;
162 RegionInfo() : realSize(0), apparentSize(0), memory(nullptr),
163 shareCount(0), publishCount(0), merger(nullptr),
164 didBulk(false), initialized(false), ready(false)
167 bool initialize(
const std::string& key,
size_t size, uint8_t initByte,
SharedRegionMerger *mergeObj);
168 bool isInitialized()
const {
return initialized; }
169 bool isReady()
const {
return ready; }
171 SharedRegionImpl* addSharer(SharedRegionManager *manager);
172 void removeSharer(SharedRegionImpl *sri);
175 void modifyRegion(
size_t offset,
size_t length,
const void *data);
178 void updateState(
bool finalize);
180 const std::string& getKey()
const {
return myKey; }
181 void* getMemory() { didBulk =
true;
return memory; }
182 const void* getConstPtr()
const {
return memory; }
183 size_t getSize()
const {
return apparentSize; }
184 size_t getNumSharers()
const {
return shareCount; }
186 bool shouldMerge()
const {
return (
nullptr != merger); }
187 SharedRegionMerger* getMerger() {
return merger; }
191 void setProtected(
bool readOnly);
201 published(
false), region(region)
204 bool isPublished()
const {
return published; }
205 void setPublished() { published =
true; }
206 RegionInfo* getRegion()
const {
return region; }
215 std::vector<int> tgtRanks;
216 std::vector<char> sendBuffer;
219 std::map<std::string, RegionInfo> regions;
223 void modifyRegion(
SharedRegion *sr,
size_t offset,
size_t length,
const void *data)
override;
225 const void* getConstPtr(
const SharedRegion *sr)
const override;
231 virtual SharedRegion* getLocalSharedRegion(
const std::string& key,
size_t size, uint8_t initByte = 0)
override;
232 virtual SharedRegion* getGlobalSharedRegion(
const std::string& key,
size_t size,
SharedRegionMerger *merger =
nullptr, uint8_t initByte = 0)
override;
235 virtual bool isRegionReady(
const SharedRegion*)
override;
236 virtual void shutdownSharedRegion(
SharedRegion*)
override;
238 void updateState(
bool finalize)
override;
Definition: sharedRegion.h:81
Definition: sharedRegionImpl.h:211
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:35
Definition: sharedRegionImpl.h:30
Definition: sharedRegionImpl.h:195
Utility class to define how to merge multiple pieces of shared memory regions Useful in the multi-MPI...
Definition: sharedRegion.h:30
RegionMergeInfo * getMergeInfo()
Returns the size of the data to be transferred.
Definition: sharedRegion.cc:189
Definition: serializable.h:109
Definition: sharedRegionImpl.h:58
virtual bool merge(uint8_t *target, const uint8_t *newData, size_t size)
Merge the data from 'newData' into 'target'.
Definition: sharedRegionImpl.h:117
Definition: sharedRegionImpl.h:60
Definition: sharedRegion.h:60
Definition: sharedRegionImpl.h:83