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> 24 #include <sst/core/sharedRegion.h> 25 #include <sst/core/serialization/serializable.h> 30 class SharedRegionImpl;
39 ChangeSet(
size_t offset,
size_t length, uint8_t *data = NULL) : offset(offset), length(length), data(data) { }
50 ser & SST::Core::Serialization::array(data,length);
70 RegionMergeInfo(
int rank,
const std::string &key) : rank(rank), key(key) { }
73 virtual bool merge(
RegionInfo *UNUSED(ri)) {
return true; }
74 const std::string& getKey()
const {
return key; }
93 length(length), data(data)
97 bool ret = ri->getMerger()->
merge((uint8_t*)ri->getMemory(), (
const uint8_t*)data, length);
103 RegionInfo::RegionMergeInfo::serialize_order(ser);
112 ser & SST::Core::Serialization::array(data,length);
122 std::vector<ChangeSet> changeSets;
128 changeSets(changeSets)
131 return ri->getMerger()->
merge((uint8_t*)ri->getMemory(), ri->getSize(), changeSets);
135 RegionInfo::RegionMergeInfo::serialize_order(ser);
152 std::vector<SharedRegionImpl*> sharers;
156 std::vector<ChangeSet> changesets;
164 RegionInfo() : realSize(0), apparentSize(0), memory(NULL),
165 shareCount(0), publishCount(0), merger(NULL),
166 didBulk(
false), initialized(
false), ready(
false)
169 bool initialize(
const std::string &key,
size_t size, uint8_t initByte,
SharedRegionMerger *mergeObj);
170 bool isInitialized()
const {
return initialized; }
171 bool isReady()
const {
return ready; }
177 void modifyRegion(
size_t offset,
size_t length,
const void *data);
180 void updateState(
bool finalize);
182 const std::string& getKey()
const {
return myKey; }
183 void* getMemory() { didBulk =
true;
return memory; }
184 const void* getConstPtr()
const {
return memory; }
185 size_t getSize()
const {
return apparentSize; }
186 size_t getNumSharers()
const {
return shareCount; }
188 bool shouldMerge()
const {
return (NULL != merger); }
193 void setProtected(
bool readOnly);
203 published(
false), region(region)
206 bool isPublished()
const {
return published; }
207 void setPublished() { published =
true; }
208 RegionInfo* getRegion()
const {
return region; }
217 std::vector<int> tgtRanks;
218 std::vector<char> sendBuffer;
221 std::map<std::string, RegionInfo> regions;
225 void modifyRegion(
SharedRegion *sr,
size_t offset,
size_t length,
const void *data)
override;
227 const void* getConstPtr(
const SharedRegion *sr)
const override;
233 virtual SharedRegion* getLocalSharedRegion(
const std::string &key,
size_t size, uint8_t initByte = 0)
override;
234 virtual SharedRegion* getGlobalSharedRegion(
const std::string &key,
size_t size,
SharedRegionMerger *merger = NULL, uint8_t initByte = 0)
override;
237 virtual bool isRegionReady(
const SharedRegion*)
override;
238 virtual void shutdownSharedRegion(
SharedRegion*)
override;
240 void updateState(
bool finalize)
override;
Definition: sharedRegion.h:77
Definition: sharedRegionImpl.h:213
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:32
Definition: sharedRegionImpl.h:197
Utility class to define how to merge multiple pieces of shared memory regions Useful in the multi-MPI...
Definition: sharedRegion.h:30
Definition: serializable.h:109
Definition: sharedRegionImpl.h:60
virtual bool merge(uint8_t *target, const uint8_t *newData, size_t size)
Merge the data from 'newData' into 'target'.
Definition: sharedRegionImpl.h:119
Definition: sharedRegionImpl.h:62
Definition: sharedRegion.h:56
Definition: sharedRegionImpl.h:85