12 #ifndef SST_CORE_CORE_SHAREDREGIONIMPL_H
13 #define SST_CORE_CORE_SHAREDREGIONIMPL_H
15 #include <sst/core/sst_types.h>
23 #include <sst/core/sharedRegion.h>
24 #include <sst/core/serialization/serializable.h>
29 class SharedRegionImpl;
38 ChangeSet(
size_t offset,
size_t length, uint8_t *data = NULL) : offset(offset), length(length), data(data) { }
49 ser & SST::Core::Serialization::array(data,length);
69 RegionMergeInfo(
int rank,
const std::string &key) : rank(rank), key(key) { }
72 virtual bool merge(
RegionInfo *ri) {
return true; }
73 const std::string& getKey()
const {
return key; }
92 length(length), data(data)
96 bool ret = ri->getMerger()->
merge((uint8_t*)ri->getMemory(), (
const uint8_t*)data, length);
102 RegionInfo::RegionMergeInfo::serialize_order(ser);
111 ser & SST::Core::Serialization::array(data,length);
121 std::vector<ChangeSet> changeSets;
127 changeSets(changeSets)
130 return ri->getMerger()->
merge((uint8_t*)ri->getMemory(), ri->getSize(), changeSets);
134 RegionInfo::RegionMergeInfo::serialize_order(ser);
151 std::vector<SharedRegionImpl*> sharers;
155 std::vector<ChangeSet> changesets;
163 RegionInfo() : realSize(0), apparentSize(0), memory(NULL),
164 shareCount(0), publishCount(0), merger(NULL),
165 didBulk(false), initialized(false), ready(false)
168 bool initialize(
const std::string &key,
size_t size, uint8_t initByte,
SharedRegionMerger *mergeObj);
169 bool isInitialized()
const {
return initialized; }
170 bool isReady()
const {
return ready; }
172 SharedRegionImpl* addSharer(SharedRegionManager *manager);
173 void removeSharer(SharedRegionImpl *sri);
176 void modifyRegion(
size_t offset,
size_t length,
const void *data);
179 void updateState(
bool finalize);
181 const std::string& getKey()
const {
return myKey; }
182 void* getMemory() { didBulk =
true;
return memory; }
183 const void* getConstPtr()
const {
return memory; }
184 size_t getSize()
const {
return apparentSize; }
185 size_t getNumSharers()
const {
return shareCount; }
187 bool shouldMerge()
const {
return (NULL != merger); }
188 SharedRegionMerger* getMerger() {
return merger; }
192 void setProtected(
bool readOnly);
202 published(
false), region(region)
205 bool isPublished()
const {
return published; }
206 void setPublished() { published =
true; }
207 RegionInfo* getRegion()
const {
return region; }
216 std::vector<int> tgtRanks;
217 std::vector<char> sendBuffer;
220 std::map<std::string, RegionInfo> regions;
224 void modifyRegion(
SharedRegion *sr,
size_t offset,
size_t length,
const void *data);
232 virtual SharedRegion* getLocalSharedRegion(
const std::string &key,
size_t size, uint8_t initByte = 0);
239 void updateState(
bool finalize);
Definition: sharedRegion.h:77
Definition: sharedRegionImpl.h:212
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:31
Definition: sharedRegionImpl.h:196
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:187
Definition: serializable.h:108
Definition: sharedRegionImpl.h:59
virtual bool merge(uint8_t *target, const uint8_t *newData, size_t size)
Merge the data from 'newData' into 'target'.
Definition: sharedRegion.cc:31
Definition: sharedRegionImpl.h:118
Definition: sharedRegionImpl.h:61
Definition: sharedRegion.h:56
Definition: sharedRegionImpl.h:84