diff --git a/src/sst/core/baseComponent.cc b/src/sst/core/baseComponent.cc index 3c6cfabec..6b9be5b9e 100644 --- a/src/sst/core/baseComponent.cc +++ b/src/sst/core/baseComponent.cc @@ -814,8 +814,13 @@ BaseComponent::getComponentProfileTools(const std::string& point) void BaseComponent::serialize_order(SST::Core::Serialization::serializer& ser) { + //printf("basecomponent = %p\n", my_info); + printf("BaseComponent->serialize_order %d\n", __LINE__); ser& my_info; + printf("BaseComponent->serialize_order %d\n", __LINE__); ser& isExtension; + printf("BaseComponent->serialize_order %d\n", __LINE__); + if ( ser.mode() == SST::Core::Serialization::serializer::UNPACK ) { sim_ = Simulation_impl::getSimulation(); } } diff --git a/src/sst/core/component.h b/src/sst/core/component.h index 9c70ad679..0b2f55e58 100644 --- a/src/sst/core/component.h +++ b/src/sst/core/component.h @@ -92,15 +92,15 @@ class Component : public BaseComponent */ void primaryComponentOKToEndSim(); + void serialize_order(SST::Core::Serialization::serializer& ser) override; + ImplementSerializable(SST::Component) + protected: friend class SubComponent; -private: // For Serialization only Component(); - ImplementSerializable(SST::Component) - void serialize_order(SST::Core::Serialization::serializer& ser) override; }; } // namespace SST diff --git a/src/sst/core/componentInfo.cc b/src/sst/core/componentInfo.cc index 255271f57..bdcb5d6ff 100644 --- a/src/sst/core/componentInfo.cc +++ b/src/sst/core/componentInfo.cc @@ -186,12 +186,19 @@ ComponentInfo::~ComponentInfo() void ComponentInfo::serialize_order(SST::Core::Serialization::serializer& ser) { + printf("componentInfo->serialize_order id %d\n", __LINE__); ser& const_cast(id); + printf("componentInfo->serialize_order parent_info %d\n", __LINE__); ser& parent_info; + printf("componentInfo->serialize_order name %d\n", __LINE__); ser& const_cast(name); + printf("componentInfo->serialize_type %d\n", __LINE__); ser& const_cast(type); + printf("componentInfo->serialize_order link_map %d\n", __LINE__); ser& link_map; + printf("componentInfo->serialize_order component %d\n", __LINE__); ser& component; + printf("componentInfo->serialize_order defaultTimeBase %d\n", __LINE__); // Not used after construction, no need to serialize // ser& params; @@ -201,6 +208,7 @@ ComponentInfo::serialize_order(SST::Core::Serialization::serializer& ser) // ser& allStatConfig; // ser& statLoadLevel; // ser& coordinates; + printf("componentInfo->serialize_order subcomponent stuff %d\n", __LINE__); ser& subIDIndex; ser& const_cast(slot_name); ser& slot_num; diff --git a/src/sst/core/componentInfo.h b/src/sst/core/componentInfo.h index ed643d436..c1dd481e5 100644 --- a/src/sst/core/componentInfo.h +++ b/src/sst/core/componentInfo.h @@ -308,6 +308,11 @@ class ComponentInfoMap } dataByID.clear(); } + + size_t size() + { + return dataByID.size(); + } }; } // namespace SST diff --git a/src/sst/core/exit.cc b/src/sst/core/exit.cc index b72f19024..7bbc7bbf9 100644 --- a/src/sst/core/exit.cc +++ b/src/sst/core/exit.cc @@ -186,4 +186,27 @@ Exit::check() // } } +void +Exit::serialize_order(SST::Core::Serialization::serializer& ser) +{ + Action::serialize_order(ser); + + ser& num_threads; + + if (ser.mode() == SST::Core::Serialization::serializer::UNPACK) { + m_thread_counts = new unsigned int[num_threads]; + } + + for (int i = 0; i < num_threads; i++) { + ser& m_thread_counts[i]; + } + + ser& m_refCount; + ser& global_count; + ser& m_idSet; + ser& end_time; + ser& single_rank; + + } + } // namespace SST diff --git a/src/sst/core/exit.h b/src/sst/core/exit.h index 3876f7be4..0939a2d36 100644 --- a/src/sst/core/exit.h +++ b/src/sst/core/exit.h @@ -95,20 +95,7 @@ class Exit : public Action * TODO to enable different partitioning on restart, will need to associate m_thread_counts and * m_idSet back to components so that a new Exit event can be generated on restart */ - void serialize_order(SST::Core::Serialization::serializer& ser) override - { - Action::serialize_order(ser); - ser& num_threads; - for ( unsigned int i = 0; i < m_refCount; i++ ) { - ser& m_thread_counts[i]; - } - ser& m_refCount; - ser& global_count; - ser& m_idSet; - ser& end_time; - ser& single_rank; - // TBD spinlock -> can re-create - } + void serialize_order(SST::Core::Serialization::serializer& ser) override; ImplementSerializable(SST::Exit) private: Exit() {} // for serialization only diff --git a/src/sst/core/heartbeat.cc b/src/sst/core/heartbeat.cc index bc868f4fc..0593078d8 100644 --- a/src/sst/core/heartbeat.cc +++ b/src/sst/core/heartbeat.cc @@ -116,4 +116,12 @@ SimulatorHeartbeat::execute(void) } } +void SimulatorHeartbeat::serialize_order(SST::Core::Serialization::serializer& ser) +{ + Action::serialize_order(ser); + ser& rank; + ser& m_period; + ser& lastTime; +} + } // namespace SST diff --git a/src/sst/core/heartbeat.h b/src/sst/core/heartbeat.h index 50762dfed..417802061 100644 --- a/src/sst/core/heartbeat.h +++ b/src/sst/core/heartbeat.h @@ -38,9 +38,12 @@ class SimulatorHeartbeat : public Action SimulatorHeartbeat(Config* cfg, int this_rank, Simulation_impl* sim, TimeConverter* period); ~SimulatorHeartbeat(); - NotSerializable(SST::SimulatorHeartbeat) + void serialize_order(SST::Core::Serialization::serializer& ser) override; + ImplementSerializable(SST::SimulatorHeartbeat) - private : SimulatorHeartbeat() {}; +private : + + SimulatorHeartbeat() {}; SimulatorHeartbeat(const SimulatorHeartbeat&); void operator=(SimulatorHeartbeat const&); diff --git a/src/sst/core/link.cc b/src/sst/core/link.cc index b7bad66dd..380a85320 100644 --- a/src/sst/core/link.cc +++ b/src/sst/core/link.cc @@ -41,6 +41,7 @@ SST::Core::Serialization::serialize_impl::operator()(Link*& s, SST::Core: // 1 - Link // 2 - SelfLink int16_t type; + printf("Link->serialize_impl %d\n", __LINE__); switch ( ser.mode() ) { case serializer::SIZER: @@ -144,15 +145,19 @@ SST::Core::Serialization::serialize_impl::operator()(Link*& s, SST::Core: } break; case serializer::UNPACK: + printf("link->serialize_order UNPACK type %d\n", __LINE__); ser& type; // If we put in a nullptr, return a nullptr if ( type == 0 ) { + printf("link->serialize_order UNPACK type=0 %d\n", __LINE__); s = nullptr; return; } if ( type == 2 ) { + printf("link->serialize_order UNPACK type=1 %d\n", __LINE__); + // Self link s = new SelfLink(); @@ -180,11 +185,14 @@ SST::Core::Serialization::serialize_impl::operator()(Link*& s, SST::Core: // ser & s->profile_tools; } else { + printf("link->serialize_order UNPACK type=2 %d\n", __LINE__); + // Regular link // Pull out the tags for the two links uintptr_t my_tag; uintptr_t pair_tag; + printf("link->serialize_order UNPACK tags %d\n", __LINE__); ser& my_tag; ser& pair_tag; @@ -203,6 +211,8 @@ SST::Core::Serialization::serialize_impl::operator()(Link*& s, SST::Core: link_tracker[my_tag] = s; } + printf("link->serialize_order UNPACK %d\n", __LINE__); + ser & s->type; ser & s->mode; ser & s->tag; @@ -234,12 +244,14 @@ SST::Core::Serialization::serialize_impl::operator()(Link*& s, SST::Core: // no need to serialize // Need to recreate the send_queue - if ( s->pair_link->type == Link::SYNC ) { + /*if ( s->pair_link->type == Link::SYNC ) { // TODO: Need to reregister with the SyncManager } - else { + else {*/ + printf("link->serialize_order UNPACK %d\n", __LINE__); + s->send_queue = Simulation_impl::getSimulation()->getTimeVortex(); - } + //} // Profile tools not yet supported // ser & s->profile_tools; diff --git a/src/sst/core/linkMap.h b/src/sst/core/linkMap.h index f17fa9a02..5e55b29b1 100644 --- a/src/sst/core/linkMap.h +++ b/src/sst/core/linkMap.h @@ -36,8 +36,12 @@ class LinkMap void serialize_order(SST::Core::Serialization::serializer& ser) { + + printf("LinkMap->serialize_order %d\n", __LINE__); ser& linkMap; + printf("LinkMap->serialize_order, %zu %d\n", __LINE__); ser& selfPorts; + printf("LinkMap->serialize_order, %zu %d\n", __LINE__); } diff --git a/src/sst/core/main.cc b/src/sst/core/main.cc index 1c895a729..d9c25c2a6 100644 --- a/src/sst/core/main.cc +++ b/src/sst/core/main.cc @@ -633,6 +633,8 @@ start_simulation(uint32_t tid, SimThreadInfo_t& info, Core::ThreadSafe::Barrier& else { // Do restart stuff printf("Made it to restart section\n"); + sim->restart(info.config); + exit(-1); } /* Run Simulation */ sim->run(); diff --git a/src/sst/core/serialization/serializable.cc b/src/sst/core/serialization/serializable.cc index b85bb30da..97e55f7ed 100644 --- a/src/sst/core/serialization/serializable.cc +++ b/src/sst/core/serialization/serializable.cc @@ -63,6 +63,7 @@ serializable_factory::add_builder(serializable_builder* builder, const char* nam abort(); } current = builder; + printf("%s, %" PRIu32 "\n", name, hash); return hash; } diff --git a/src/sst/core/serialization/serialize.h b/src/sst/core/serialization/serialize.h index 664d82f79..c3bf4ce58 100644 --- a/src/sst/core/serialization/serialize.h +++ b/src/sst/core/serialization/serialize.h @@ -53,6 +53,10 @@ class serialize_impl // If it falls through to the default, let's check to see if it's // a non-polymorphic class and try to call serialize_order if constexpr ( std::is_class_v> && !std::is_polymorphic_v> ) { + if (ser.mode() == serializer::UNPACK) { + t = new typename std::remove_pointer::type(); + ser.report_new_pointer(reinterpret_cast(t)); + } t->serialize_order(ser); } else { diff --git a/src/sst/core/serialization/serialize_priority_queue.h b/src/sst/core/serialization/serialize_priority_queue.h index 6dae9bd3d..13bb86e99 100644 --- a/src/sst/core/serialization/serialize_priority_queue.h +++ b/src/sst/core/serialization/serialize_priority_queue.h @@ -67,8 +67,10 @@ class serialize> { size_t size; ser.unpack(size); + printf("Unpack priority queue, size = %zu\n", size); for ( size_t i = 0; i < size; ++i ) { T t = {}; + printf("Attempt serialization of item %zu\n", i); ser& t; v.push(t); } diff --git a/src/sst/core/serialization/serialize_vector.h b/src/sst/core/serialization/serialize_vector.h index 4f6739109..683ae6ebe 100644 --- a/src/sst/core/serialization/serialize_vector.h +++ b/src/sst/core/serialization/serialize_vector.h @@ -43,16 +43,20 @@ class serialize> } case serializer::UNPACK: { + printf("serialize_vector UNPACK %d\n", __LINE__); size_t s; ser.unpack(s); + printf("serialize_vector UNPACK size =%zu, %d\n", s, __LINE__); v.resize(s); break; } } - + + printf("serialize_vector UNPACK %d\n", __LINE__); for ( size_t i = 0; i < v.size(); ++i ) { ser& v[i]; } + printf("serialize_vector UNPACK %d\n", __LINE__); } }; diff --git a/src/sst/core/simulation.cc b/src/sst/core/simulation.cc index cad4fbdb2..36ea8a1e7 100644 --- a/src/sst/core/simulation.cc +++ b/src/sst/core/simulation.cc @@ -41,6 +41,7 @@ #include #include +#include #define SST_SIMTIME_MAX 0xffffffffffffffff @@ -1248,88 +1249,327 @@ void Simulation_impl::checkpoint() { sim_output.output("Checkpoint triggered at time %" PRIu64 "\n", currentSimCycle); + printSimulationState(); + std::string checkpoint_filename = "sst_checkpoint_" + std::to_string(checkpoint_id) + ".bin"; + checkpoint_id++; - printf("Printing original TV, size = %" PRIu64 "\n", timeVortex->getCurrentDepth()); - timeVortex->dbg_print(sim_output); + std::ofstream fs(checkpoint_filename, std::ios::out | std::ios::binary); SST::Core::Serialization::serializer ser; ser.enable_pointer_tracking(); + + size_t size, buffer_size; + char* buffer; - // Get the size + /* Serialize loaded libraries */ ser.start_sizing(); + std::set libnames; + factory->getLoadedLibraryNames(libnames); + ser& libnames; + + size = ser.size(); + buffer_size = size; + buffer = new char[size]; + + ser.start_packing(buffer, size); + ser& libnames; + + printf("Writing library blob: %zu bytes\n", size); + fs.write(reinterpret_cast(&size), sizeof(size)); + fs.write(buffer, size); + + /* Serialize simulation_impl */ + // Size buffer + ser.start_sizing(); + ser& num_ranks; + ser& my_rank; + ser& currentSimCycle; + //ser& threadMinPartTC; + ser& minPart; + ser& minPartTC; + ser& interThreadLatencies; + ser& interThreadMinLatency; + ser& endSim; + ser& independent; + //ser& sim_output; + ser& runMode; + ser& currentPriority; + ser& endSimCycle; + ser& output_directory; + // Actions that may also be in TV + ser& m_exit; + ser& syncManager; + ser& m_heartbeat; + // Last, get the timevortex ser& timeVortex; - size_t size = ser.size(); - char* buffer = new char[size + 10]; + size = ser.size(); + if (size > buffer_size) { + delete [] buffer; + buffer_size = size; + buffer = new char[buffer_size]; + } - // Serialize + // Pack buffer ser.start_packing(buffer, size); + ser& num_ranks; + ser& my_rank; + ser& currentSimCycle; + //ser& threadMinPartTC; + ser& minPart; + ser& minPartTC; + ser& interThreadLatencies; + ser& interThreadMinLatency; + ser& endSim; + ser& independent; + //ser& sim_output; + ser& runMode; + ser& currentPriority; + ser& endSimCycle; + ser& output_directory; + // Actions that may also be in TV + ser& m_exit; + ser& syncManager; + ser& m_heartbeat; + // Last, get the timevortex ser& timeVortex; - // Unpack into a new thing - Params p; - TimeVortex* test_tv; + // Write buffer to file + printf("Writing global blob: %zu bytes\n", size); + fs.write(reinterpret_cast(&size), sizeof(size)); + fs.write(buffer, size); + + size = compInfoMap.size(); + printf("Writing %zu components\n", size); + fs.write(reinterpret_cast(&size), sizeof(size)); + + // Serialize component blobs individually + for (auto comp = compInfoMap.begin(); comp != compInfoMap.end(); comp++ ) + { + printf("Writing component...\n"); + ser.start_sizing(); + ComponentInfo* compinfo = *comp; + ser& compinfo; + size = ser.size(); + + if (buffer_size < size) { + delete [] buffer; + buffer = new char[size]; + buffer_size = size; + } + + ser.start_packing(buffer, size); + ser& compinfo; + + printf("Writing component blob: %zu bytes\n", size); + fs.write(reinterpret_cast(&size), sizeof(size)); + fs.write(buffer, size); + } + + fs.close(); + delete [] buffer; + + /* + * Still needs to be added to checkpoint: + * - static SharedRegionManager* sharedRegionManager; + * - SST::Statistics::StatisticProcessingEngine stat_engine; + * - oneShotMap_t oneShotMap; + * - Output sim_output; + * + * The rest will be recreated at restart or is not needed for checkpoint. + * + * Recreated: + * clockMap_t clockMap; + * static std::unordered_map instanceMap; + * static std::vector instanceVec; + * TimeLord timeLord; + * + * Not saved or reset to default anyways at restart + * static std::atomic untimed_msg_count; + * ShutdownMode_t shutdown_mode; + * bool wireUpFinished; + * Activity* current_activity; + * unsigned int untimed_phase; + * volatile sig_atomic_t lastRecvdSignal; + * std::map profile_tools; + * std::map> profiler_map; + * double run_phase_start_time; + * double run_phase_total_time; + * double init_phase_start_time; + * double init_phase_total_time; + * double complete_phase_start_time; + * double complete_phase_total_time; + * std::map link_restart_tracking; + * std::map event_handler_restart_tracking; + * CheckpointAction* m_checkpoint; + */ +} + +void +Simulation_impl::restart(Config* cfg) +{ + size_t size, buffer_size; + char* buffer; + SST::Core::Serialization::serializer ser; + ser.enable_pointer_tracking(); + std::ifstream fs(cfg->configFile(), std::ios::binary); + + /* Begin deserialization, libraries */ + fs.read(reinterpret_cast(&size), sizeof(size)); + printf("Reading library blob: %zu bytes\n", size); + + buffer_size = size; + buffer = new char[buffer_size]; + fs.read(buffer, size); ser.start_unpacking(buffer, size); - ser& test_tv; - printf("Printing new TV\n"); - test_tv->dbg_print(sim_output); + std::set libnames; + ser& libnames; + for (auto lib : libnames) + { + printf("Restart load lib %s\n", lib.c_str()); + } + + /* Load libraries before anything else */ + factory->loadUnloadedLibraries(libnames); + /* Now get the global blob */ + fs.read(reinterpret_cast(&size), sizeof(size)); + printf("Reading global blob: %zu bytes\n", size); + if (size > buffer_size) { + delete [] buffer; + buffer_size = size; + buffer = new char[buffer_size]; + } + fs.read(buffer, size); + + ser.start_unpacking(buffer, size); + + ser& num_ranks; + ser& my_rank; + ser& currentSimCycle; + printf("simcycle: %" PRIu64 "\n", currentSimCycle); + //ser& threadMinPartTC; + ser& minPart; + ser& minPartTC; + ser& interThreadLatencies; + ser& interThreadMinLatency; + ser& endSim; + ser& independent; + printf("minpartc: %" PRIu64 "\n", minPartTC->getFactor()); + //ser& sim_output; + ser& runMode; + ser& currentPriority; + ser& endSimCycle; + ser& output_directory; + printf("outdir: %s\n", output_directory.c_str()); + // Actions that may also be in TV + ser& m_exit; + printf("here3.1, %s\n", m_exit->toString().c_str()); + ser& syncManager; + printf("here3.2\n"); + ser& m_heartbeat; + printf("here3.3\n"); + // Last, get the timevortex + ser& timeVortex; + printf("here4\n"); + + /* Extract components */ + size_t compCount; + fs.read(reinterpret_cast(&compCount), sizeof(compCount)); + printf("Reading %zu components\n", compCount); + + // Deserialize component blobs individually + for (size_t comp = 0; comp < compCount; comp++) + { + fs.read(reinterpret_cast(&size), sizeof(size)); + printf("Reading component blob: %zu bytes\n", size); + if (size > buffer_size) { + delete [] buffer; + buffer_size = size; + buffer = new char[buffer_size]; + } + fs.read(buffer, size); + ser.start_unpacking(buffer, size); + ComponentInfo* compInfo = new ComponentInfo(); + ser& compInfo; + compInfoMap.insert(compInfo); + } + + fs.close(); + delete [] buffer; + + printSimulationState(); +} + +void +Simulation_impl::printSimulationState() +{ + std::string tmp_str = ""; + sim_output.output("Printing simulation state\n"); + + sim_output.output("num_ranks: %" PRIu32 ", %" PRIu32 "\n", num_ranks.rank, num_ranks.thread); + sim_output.output("my_rank: %" PRIu32 ", %" PRIu32 "\n", my_rank.rank, my_rank.thread); + sim_output.output("currentSimCycle: %" PRIu64 "\n", currentSimCycle); + //sim_output.output("threadMinPartTC: %" PRIu64 "\n", threadMinPartTC->getFactor()); + sim_output.output("minPart: %" PRIu64 "\n", minPart); + sim_output.output("minPartTC: %" PRIu64 "\n", minPartTC->getFactor()); + for (auto i : interThreadLatencies) { + tmp_str = tmp_str + " " + std::to_string(i); + } + tmp_str += " "; + sim_output.output("interThreadLatencies: [%s]\n", tmp_str.c_str()); + sim_output.output("interThreadMinlatency: %" PRIu64 "\n", interThreadMinLatency); + sim_output.output("endSim: %s\n", endSim ? "true" : "false"); + sim_output.output("independent: %s\n", independent ? "true" : "false"); + sim_output.output("runMode: %d\n", (int)runMode); + sim_output.output("currentPriority: %d\n", currentPriority); + sim_output.output("endSimCycle: %" PRIu64 "\n", endSimCycle); + sim_output.output("output_directory: %s\n", output_directory.c_str()); + sim_output.output("m_exit: %s\n", m_exit == nullptr ? "nullptr" : m_exit->toString().c_str()); + sim_output.output("syncManager: %s\n", syncManager == nullptr ? "nullptr" : syncManager->toString().c_str()); + sim_output.output("heartbeat: %s\n", m_heartbeat == nullptr ? "nullptr" : m_heartbeat->toString().c_str()); + sim_output.output("\nTimeVortex\n"); + timeVortex->dbg_print(sim_output); + + sim_output.output("\n\nPrinting re-generated state:\n"); + + //clockMap + //oneShotMap + sim_output.output("shutdown_mode: %d\n", (int)shutdown_mode); + sim_output.output("wireUpFinished: %s\n", wireUpFinished ? "true" : "false"); + //timeLord + //instanceMap + //instanceVec + + sim_output.output("\n\nPrinting ComponentInfoMap:\n"); + for (auto comp = compInfoMap.begin(); comp != compInfoMap.end(); comp++) + { + (*comp)->test_printComponentInfoHierarchy(); + (*comp)->getComponent()->printStatus(sim_output); + } /* - * State to checkpoint: - TimeVortex* timeVortex; - yes but do it later - TimeConverter* threadMinPartTC; - yes? - Activity* current_activity; - no - static SimTime_t minPart; - yes - static TimeConverter* minPartTC; - yes - std::vector interThreadLatencies; - yes - SimTime_t interThreadMinLatency; - yes - SyncManager* syncManager; - yes - ComponentInfoMap compInfoMap; - yes - clockMap_t clockMap; - yes - oneShotMap_t oneShotMap; - yes, eventually - static Exit* m_exit; - yes - SimulatorHeartbeat* m_heartbeat; - yes - bool endSim; - yes - bool independent; - yes - static std::atomic untimed_msg_count; - no, only valid in untimed phases? - unsigned int untimed_phase; - no, only valid in untimed phases? - volatile sig_atomic_t lastRecvdSignal; - no - ShutdownMode_t shutdown_mode; - not sure if we need this - bool wireUpFinished; - yes - static TimeLord timeLord; - yes - static Output sim_output; - yes - SST::Statistics::StatisticProcessingEngine stat_engine; - yes but not now - std::map profile_tools; - no - std::map> profiler_map; - no - SimulationRunMode runMode; - yes?? - SimTime_t currentSimCycle; - yes - int currentPriority; - yes - SimTime_t endSimCycle; - i guess but probably don't need it - RankInfo my_rank; - yes - RankInfo num_ranks; - yes - std::string output_directory; - yes - static SharedRegionManager* sharedRegionManager; - yes... - - double run_phase_start_time; - no - double run_phase_total_time; - no - double init_phase_start_time; - no - double init_phase_total_time; - no - double complete_phase_start_time; - no - double complete_phase_total_time; - no - - static std::unordered_map instanceMap; - no - static std::vector instanceVec; - no - - std::map link_restart_tracking; - no - std::map event_handler_restart_tracking; - no - CheckpointAction* m_checkpoint; - no - */ - // Checkpointing! - // Create serializer - // SST::Core::Serialization::serializer ser; - // ser.enable_pointer_tracking(); + * Not printing YET + * - stat engine + * - sharedRegionManager + * + * Not printing + * - current_activity + * - untimed_msg_count + * - untimed_phase + * - lastRecvdSignal + * - profile_tools + * - profiler_map + * - run_phase_start_time + * - run_phase_total_time + * - init_phase_start_time + * - init_phase_total_time + * - complete_phase_start_time + * - complete_phase_total_time + + */ + } void diff --git a/src/sst/core/simulation_impl.h b/src/sst/core/simulation_impl.h index 5a6cf324c..e5b96b524 100644 --- a/src/sst/core/simulation_impl.h +++ b/src/sst/core/simulation_impl.h @@ -303,7 +303,7 @@ class Simulation_impl : public Simulation // To enable main to set up globals friend int ::main(int argc, char** argv); - // Simulation_impl() {} + Simulation_impl() {} Simulation_impl(Config* config, RankInfo my_rank, RankInfo num_ranks); Simulation_impl(Simulation_impl const&); // Don't Implement void operator=(Simulation_impl const&); // Don't implement @@ -314,6 +314,7 @@ class Simulation_impl : public Simulation TimeConverter* minPartToTC(SimTime_t cycles) const; void checkpoint(); + void restart(Config* config); /** Factory used to generate the simulation components */ static Factory* factory; @@ -355,7 +356,7 @@ class Simulation_impl : public Simulation TimeVortex* timeVortex; std::string timeVortexType; - TimeConverter* threadMinPartTC; + TimeConverter* threadMinPartTC; // Unused...? Activity* current_activity; static SimTime_t minPart; static TimeConverter* minPartTC; @@ -367,7 +368,7 @@ class Simulation_impl : public Simulation clockMap_t clockMap; oneShotMap_t oneShotMap; static Exit* m_exit; - SimulatorHeartbeat* m_heartbeat; + SimulatorHeartbeat* m_heartbeat = nullptr; bool endSim; bool independent; // true if no links leave thread (i.e. no syncs required) static std::atomic untimed_msg_count; @@ -510,8 +511,10 @@ class Simulation_impl : public Simulation /******** Checkpoint/restart tracking data structures ***********/ std::map link_restart_tracking; std::map event_handler_restart_tracking; - CheckpointAction* m_checkpoint; + CheckpointAction* m_checkpoint = nullptr; + uint32_t checkpoint_id = 0; + void printSimulationState(); friend void wait_my_turn_start(); friend void wait_my_turn_end(); diff --git a/src/sst/core/sync/syncManager.cc b/src/sst/core/sync/syncManager.cc index e9ef77ad2..6b3d00b9f 100644 --- a/src/sst/core/sync/syncManager.cc +++ b/src/sst/core/sync/syncManager.cc @@ -295,6 +295,11 @@ SyncManager::SyncManager( setPriority(SYNCPRIORITY); } +SyncManager::SyncManager() +{ + sim = Simulation_impl::getSimulation(); +} + SyncManager::~SyncManager() {} /** Register a Link which this Sync Object is responsible for */ @@ -461,16 +466,22 @@ SyncManager::addProfileTool(Profile::SyncProfileTool* tool) void SyncManager::serialize_order(SST::Core::Serialization::serializer& ser) { + printf("Zero part OK..."); + Action::serialize_order(ser); // AHHHHHHHHHHHHHHHHH ser& rank; // const causes problems ser& num_ranks; // const again + printf("First part OK..."); ser& next_rankSync; ser& threadSync; + printf("Second part OK..."); + ser& next_sync_type; ser& min_part; + printf("Third part OK...?!"); // No need to serialize // RankExecBarrier diff --git a/src/sst/core/sync/syncManager.h b/src/sst/core/sync/syncManager.h index 8bac59e8d..fa2c45af6 100644 --- a/src/sst/core/sync/syncManager.h +++ b/src/sst/core/sync/syncManager.h @@ -135,7 +135,7 @@ class SyncManager : public Action SyncManager( const RankInfo& rank, const RankInfo& num_ranks, TimeConverter* minPartTC, SimTime_t min_part, const std::vector& interThreadLatencies); - SyncManager() {} // For serialization only + SyncManager(); // For serialization only virtual ~SyncManager(); /** Register a Link which this Sync Object is responsible for */ diff --git a/src/sst/core/testElements/coreTest_Checkpoint.cc b/src/sst/core/testElements/coreTest_Checkpoint.cc index 68f4cebec..6b3308472 100644 --- a/src/sst/core/testElements/coreTest_Checkpoint.cc +++ b/src/sst/core/testElements/coreTest_Checkpoint.cc @@ -28,8 +28,10 @@ coreTestCheckpoint::coreTestCheckpoint(ComponentId_t id, Params& params) : Compo registerAsPrimaryComponent(); primaryComponentDoNotEndSim(); - link = configureLink("port", new Event::Handler(this, &coreTestCheckpoint::handleEvent)); + link = configureLink("port", new Event::Handler2(this)); sst_assert(link, CALL_INFO, -1, "Could not configure link"); + + testString = params.find("teststring", ""); } coreTestCheckpoint::~coreTestCheckpoint() {} @@ -57,4 +59,22 @@ coreTestCheckpoint::handleEvent(Event* ev) } +void +coreTestCheckpoint::printStatus(Output& out) +{ + out.output("Component Status: %s, %p, %" PRIu32 ", %s\n", + getName().c_str(), link, counter, testString.c_str()); +} + + +void +coreTestCheckpoint::serialize_order(SST::Core::Serialization::serializer& ser) +{ + SST::Component::serialize_order(ser); + ser& link; + ser& counter; +} + + + // Element Libarary / Serialization stuff diff --git a/src/sst/core/testElements/coreTest_Checkpoint.h b/src/sst/core/testElements/coreTest_Checkpoint.h index de7508fe7..4a554d8ec 100644 --- a/src/sst/core/testElements/coreTest_Checkpoint.h +++ b/src/sst/core/testElements/coreTest_Checkpoint.h @@ -68,6 +68,7 @@ class coreTestCheckpoint : public SST::Component SST_ELI_DOCUMENT_PARAMS( { "starter", "Whether this component initiates the ping-pong", "T"}, { "count", "Number of times to bounce the message back and forth", "1000" }, + { "teststring", "A test string", ""} ) SST_ELI_DOCUMENT_PORTS( @@ -78,12 +79,21 @@ class coreTestCheckpoint : public SST::Component ~coreTestCheckpoint(); void setup(); + + void printStatus(Output& out) override; + + // Serialization functions and macro + coreTestCheckpoint() : Component() {} // For serialization only + void serialize_order(SST::Core::Serialization::serializer& ser) override; + ImplementSerializable(SST::CoreTestCheckpoint::coreTestCheckpoint) private: void handleEvent(SST::Event* ev); SST::Link* link; - uint32_t counter; + uint32_t counter; // Unused after setup + std::string testString; // Test that string got serialized + }; } // namespace CoreTestCheckpoint diff --git a/src/sst/core/timeVortex.h b/src/sst/core/timeVortex.h index 966e3edf0..e410467f2 100644 --- a/src/sst/core/timeVortex.h +++ b/src/sst/core/timeVortex.h @@ -70,6 +70,7 @@ class SST::Core::Serialization::serialize_impl case serializer::UNPACK: std::string tv_type; ser& tv_type; + printf("Creating time vortex type %s\n", tv_type.c_str()); Params p; s = Factory::getFactory()->Create(tv_type, p); s->serialize_order(ser);