Skip to content

Commit

Permalink
Merge pull request sstsimulator#1091 from sstsimulator/devel
Browse files Browse the repository at this point in the history
Automatically Merged using SST Master Branch Merger
  • Loading branch information
sst-autotester authored Jun 16, 2024
2 parents e2d7847 + 14b38c4 commit 2f7b13d
Show file tree
Hide file tree
Showing 16 changed files with 409 additions and 326 deletions.
2 changes: 1 addition & 1 deletion src/sst/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ add_library(
profile/eventHandlerProfileTool.cc
profile/syncProfileTool.cc
profile/profiletool.cc
serialization/serializable.cc
serialization/serializable_base.cc
serialization/serialize_serializable.cc
serialization/serializer.cc
serialization/statics.cc
Expand Down
3 changes: 2 additions & 1 deletion src/sst/core/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ nobase_dist_sst_HEADERS = \
eli/statsInfo.h \
eli/subcompSlotInfo.h \
serialization/serializable.h \
serialization/serializable_base.h \
serialization/serializable_fwd.h \
serialization/serialize.h \
serialization/serialize_impl_fwd.h \
Expand Down Expand Up @@ -210,7 +211,7 @@ sst_core_sources = \
ssthandler.cc \
sstpart.cc \
timeVortex.cc \
serialization/serializable.cc \
serialization/serializable_base.cc \
serialization/serialize_serializable.cc \
serialization/serializer.cc \
serialization/statics.cc \
Expand Down
49 changes: 47 additions & 2 deletions src/sst/core/baseComponent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@

namespace SST {

BaseComponent::BaseComponent() : SST::Core::Serialization::serializable() {}
BaseComponent::BaseComponent() : SST::Core::Serialization::serializable_base() {}

BaseComponent::BaseComponent(ComponentId_t id) :
SST::Core::Serialization::serializable(),
SST::Core::Serialization::serializable_base(),
my_info(Simulation_impl::getSimulation()->getComponentInfo(id)),
sim_(Simulation_impl::getSimulation()),
isExtension(false)
Expand Down Expand Up @@ -856,5 +856,50 @@ BaseComponent::serialize_order(SST::Core::Serialization::serializer& ser)
}
}

namespace Core {
namespace Serialization {
namespace pvt {

static const long null_ptr_id = -1;

void
size_basecomponent(serializable_base* s, serializer& ser)
{
long dummy = 0;
ser.size(dummy);
if ( s ) { s->serialize_order(ser); }
}

void
pack_basecomponent(serializable_base* s, serializer& ser)
{
if ( s ) {
long cls_id = s->cls_id();
ser.pack(cls_id);
s->serialize_order(ser);
}
else {
long id = null_ptr_id;
ser.pack(id);
}
}

void
unpack_basecomponent(serializable_base*& s, serializer& ser)
{
long cls_id;
ser.unpack(cls_id);
if ( cls_id == null_ptr_id ) { s = nullptr; }
else {
s = SST::Core::Serialization::serializable_factory::get_serializable(cls_id);
ser.report_new_pointer(reinterpret_cast<uintptr_t>(s));
s->serialize_order(ser);
}
}

} // namespace pvt
} // namespace Serialization
} // namespace Core


} // namespace SST
36 changes: 35 additions & 1 deletion src/sst/core/baseComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "sst/core/factory.h"
#include "sst/core/oneshot.h"
#include "sst/core/profile/componentProfileTool.h"
#include "sst/core/serialization/serializable_base.h"
#include "sst/core/sst_types.h"
#include "sst/core/statapi/statbase.h"
#include "sst/core/statapi/statengine.h"
Expand Down Expand Up @@ -48,7 +49,7 @@ class UnitAlgebra;
/**
* Main component object for the simulation.
*/
class BaseComponent : public SST::Core::Serialization::serializable
class BaseComponent : public SST::Core::Serialization::serializable_base
{

friend class Component;
Expand Down Expand Up @@ -1120,6 +1121,39 @@ class serialize_impl<Statistic<T>*>
}
};


namespace pvt {

void size_basecomponent(serializable_base* s, serializer& ser);

void pack_basecomponent(serializable_base* s, serializer& ser);

void unpack_basecomponent(serializable_base*& s, serializer& ser);
} // namespace pvt

template <class T>
class serialize_impl<T*, typename std::enable_if<std::is_base_of<SST::BaseComponent, T>::value>::type>
{
template <class A>
friend class serialize;
void operator()(T*& s, serializer& ser)
{
serializable_base* sp = static_cast<serializable_base*>(s);
switch ( ser.mode() ) {
case serializer::SIZER:
pvt::size_basecomponent(sp, ser);
break;
case serializer::PACK:
pvt::pack_basecomponent(sp, ser);
break;
case serializer::UNPACK:
pvt::unpack_basecomponent(sp, ser);
break;
}
s = static_cast<T*>(sp);
}
};

} // namespace Serialization
} // namespace Core

Expand Down
17 changes: 9 additions & 8 deletions src/sst/core/eli/elementinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,14 +405,15 @@ SST_ELI_getTertiaryNumberFromVersion(SST_ELI_element_version_extraction ver)
// this class. Sny local information will overwrite any inherited
// information. See comment for SST_ELI_DECLARE_BASE in elibase.h for
// info on how __EliDerivedLevel is used.
#define SST_ELI_REGISTER_DERIVED(base, cls, lib, name, version, desc) \
static constexpr int __EliDerivedLevel = std::is_same<base, cls>::value ? __EliBaseLevel : __EliBaseLevel + 1; \
static bool ELI_isLoaded() \
{ \
return SST::ELI::InstantiateBuilder<base, cls>::isLoaded() && \
SST::ELI::InstantiateBuilderInfo<base, cls>::isLoaded(); \
} \
SST_ELI_FORCE_INSTANTIATION(base, cls) \
#define SST_ELI_REGISTER_DERIVED(base, cls, lib, name, version, desc) \
[[maybe_unused]] static constexpr int __EliDerivedLevel = \
std::is_same<base, cls>::value ? __EliBaseLevel : __EliBaseLevel + 1; \
static bool ELI_isLoaded() \
{ \
return SST::ELI::InstantiateBuilder<base, cls>::isLoaded() && \
SST::ELI::InstantiateBuilderInfo<base, cls>::isLoaded(); \
} \
SST_ELI_FORCE_INSTANTIATION(base, cls) \
SST_ELI_DEFAULT_INFO(lib, name, ELI_FORWARD_AS_ONE(version), desc)

#define SST_ELI_REGISTER_EXTERN(base, cls) \
Expand Down
32 changes: 17 additions & 15 deletions src/sst/core/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -626,25 +626,27 @@ start_simulation(uint32_t tid, SimThreadInfo_t& info, Core::ThreadSafe::Barrier&
sim->restart(info.config);
}
/* Run Simulation */
sim->run();
barrier.wait();
if ( info.config->runMode() == SimulationRunMode::RUN || info.config->runMode() == SimulationRunMode::BOTH ) {
sim->run();
barrier.wait();

/* Adjust clocks at simulation end to
* reflect actual simulation end if that
* differs from detected simulation end
*/
sim->adjustTimeAtSimEnd();
barrier.wait();
/* Adjust clocks at simulation end to
* reflect actual simulation end if that
* differs from detected simulation end
*/
sim->adjustTimeAtSimEnd();
barrier.wait();

sim->complete();
barrier.wait();
sim->complete();
barrier.wait();

sim->finish();
barrier.wait();
sim->finish();
barrier.wait();

/* Tell stat outputs simulation is done */
do_statoutput_end_simulation(info.myRank);
barrier.wait();
/* Tell stat outputs simulation is done */
do_statoutput_end_simulation(info.myRank);
barrier.wait();
}

info.simulated_time = sim->getEndSimTime();
// g_output.output(CALL_INFO,"Simulation time = %s\n",info.simulated_time.toStringBestSI().c_str());
Expand Down
1 change: 1 addition & 0 deletions src/sst/core/serialization/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

set(SSTSerializationHeaders
serializable_fwd.h
serializable_base.h
serializable.h
serialize_array.h
serialize_atomic.h
Expand Down
Loading

0 comments on commit 2f7b13d

Please sign in to comment.