00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef SST_CORE_SYNCD_H
00013 #define SST_CORE_SYNCD_H
00014
00015 #include "sst/core/sst_types.h"
00016 #include <sst/core/serialization.h>
00017
00018 #include <map>
00019
00020 #include "sst/core/action.h"
00021
00022 namespace SST {
00023
00024 class SyncQueue;
00025
00026
00027 class ActivityQueue;
00028 class Link;
00029 class TimeConverter;
00030 class Exit;
00031 class Event;
00032
00033
00034
00035
00036
00037
00038
00039 class SyncBase : public Action {
00040 public:
00041
00042 SyncBase() {}
00043 ~SyncBase() {}
00044
00045
00046 virtual ActivityQueue* registerLink(int rank, LinkId_t link_id, Link* link) = 0;
00047
00048
00049
00050
00051 virtual int exchangeLinkInitData(int msg_count) = 0;
00052
00053 virtual void finalizeLinkConfigurations() = 0;
00054
00055 virtual void setExit(Exit* ex) { exit = ex; }
00056 virtual void setMaxPeriod(TimeConverter* period);
00057
00058 void print(const std::string& header, Output &out) const;
00059
00060 virtual uint64_t getDataSize() const = 0;
00061
00062 protected:
00063 Exit* exit;
00064 TimeConverter* max_period;
00065
00066 void sendInitData_sync(Link* link, Event* init_data);
00067 void finalizeConfiguration(Link* link);
00068
00069
00070 private:
00071 friend class boost::serialization::access;
00072 template<class Archive>
00073 void serialize(Archive & ar, const unsigned int version);
00074 };
00075
00076
00077
00078 class SyncD : public SyncBase {
00079 public:
00080
00081
00082 SyncD();
00083 ~SyncD();
00084
00085
00086 ActivityQueue* registerLink(int rank, LinkId_t link_id, Link* link);
00087 void execute(void);
00088
00089
00090 int exchangeLinkInitData(int msg_count);
00091
00092 void finalizeLinkConfigurations();
00093
00094 uint64_t getDataSize() const;
00095
00096 private:
00097 struct comm_pair {
00098 SyncQueue* squeue;
00099 char* rbuf;
00100 uint32_t local_size;
00101 uint32_t remote_size;
00102 };
00103
00104
00105 typedef std::map<int, comm_pair > comm_map_t;
00106 typedef std::map<LinkId_t, Link*> link_map_t;
00107
00108
00109 comm_map_t comm_map;
00110 link_map_t link_map;
00111
00112 friend class boost::serialization::access;
00113 template<class Archive>
00114 void serialize(Archive & ar, const unsigned int version);
00115 };
00116 }
00117
00118 BOOST_CLASS_EXPORT_KEY(SST::SyncBase)
00119
00120 #endif // SST_CORE_SYNC_H