diff --git a/src/sst/elements/iris/sumi/sim_transport.h b/src/sst/elements/iris/sumi/sim_transport.h index 546d6d7522..81092d3faf 100644 --- a/src/sst/elements/iris/sumi/sim_transport.h +++ b/src/sst/elements/iris/sumi/sim_transport.h @@ -187,7 +187,7 @@ class SimTransport : public Transport, public SST::Hg::Library { int* nidlist() const override; - void incomingEvent(SST::Event *ev); + void incomingEvent(SST::Event *ev) override; void compute(SST::Hg::TimeDelta t); diff --git a/src/sst/elements/mask-mpi/mpi_api.h b/src/sst/elements/mask-mpi/mpi_api.h index 5864de4a40..a06d921cf5 100644 --- a/src/sst/elements/mask-mpi/mpi_api.h +++ b/src/sst/elements/mask-mpi/mpi_api.h @@ -45,7 +45,6 @@ Questions? Contact sst-macro-help@sandia.gov #include #include #include -#include #include #include #include diff --git a/src/sst/elements/mercury/Makefile.am b/src/sst/elements/mercury/Makefile.am index 475ddbdaaf..18207f30e0 100644 --- a/src/sst/elements/mercury/Makefile.am +++ b/src/sst/elements/mercury/Makefile.am @@ -44,7 +44,6 @@ libhg_la_SOURCES = \ operating_system/launch/app_launch_request.cc \ operating_system/launch/app_launcher.cc \ operating_system/libraries/library.cc \ - operating_system/libraries/event_library.cc \ operating_system/libraries/unblock_event.cc \ operating_system/process/app.cc \ operating_system/process/global.cc \ @@ -167,9 +166,7 @@ nobase_library_include_HEADERS = \ operating_system/launch/app_launcher.h \ operating_system/launch/app_launcher_fwd.h \ operating_system/launch/app_launch_request.h \ - operating_system/libraries/event_library_fwd.h \ operating_system/libraries/service_fwd.h \ - operating_system/libraries/event_library.h \ operating_system/libraries/service.h \ operating_system/libraries/library.h \ operating_system/libraries/library_fwd.h \ diff --git a/src/sst/elements/mercury/components/operating_system_api.h b/src/sst/elements/mercury/components/operating_system_api.h index a54c4645ff..b274d22a5a 100644 --- a/src/sst/elements/mercury/components/operating_system_api.h +++ b/src/sst/elements/mercury/components/operating_system_api.h @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -114,11 +113,11 @@ class OperatingSystemAPI : public SST::Hg::SubComponent { virtual condition_t *getCondition(int id) = 0; - virtual EventLibrary *eventLibrary(const std::string &name) const = 0; + virtual Library *eventLibrary(const std::string &name) const = 0; - virtual void registerEventLib(EventLibrary *lib) = 0; + virtual void registerEventLib(Library *lib) = 0; - virtual void unregisterEventLib(EventLibrary *lib) = 0; + virtual void unregisterEventLib(Library *lib) = 0; virtual void handleRequest(Request *req) = 0; }; diff --git a/src/sst/elements/mercury/components/operating_system_call_forward.h b/src/sst/elements/mercury/components/operating_system_call_forward.h index baa6a8075e..b101e817fb 100644 --- a/src/sst/elements/mercury/components/operating_system_call_forward.h +++ b/src/sst/elements/mercury/components/operating_system_call_forward.h @@ -114,15 +114,15 @@ bool eraseCondition(int id) override { return OperatingSystemImpl::eraseCondition(id); } -EventLibrary *eventLibrary(const std::string &name) const override { +Library *eventLibrary(const std::string &name) const override { return OperatingSystemImpl::eventLibrary(name); } -void registerEventLib(EventLibrary *lib) override { +void registerEventLib(Library *lib) override { OperatingSystemImpl::registerEventLib(lib); } -void unregisterEventLib(EventLibrary *lib) override { +void unregisterEventLib(Library *lib) override { OperatingSystemImpl::unregisterEventLib(lib); } diff --git a/src/sst/elements/mercury/components/operating_system_impl.cc b/src/sst/elements/mercury/components/operating_system_impl.cc index 616e35ca0a..9e059e3e31 100644 --- a/src/sst/elements/mercury/components/operating_system_impl.cc +++ b/src/sst/elements/mercury/components/operating_system_impl.cc @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -385,7 +385,7 @@ OperatingSystemImpl::eraseCondition(int id) } } -EventLibrary* +Library* OperatingSystemImpl::eventLibrary(const std::string& name) const { auto it = libs_.find(name); @@ -397,7 +397,7 @@ OperatingSystemImpl::eventLibrary(const std::string& name) const } void -OperatingSystemImpl::registerEventLib(EventLibrary* lib) +OperatingSystemImpl::registerEventLib(Library* lib) { #if SST_HG_SANITY_CHECK if (lib->libName() == "") { @@ -416,14 +416,14 @@ OperatingSystemImpl::registerEventLib(EventLibrary* lib) for (Request *req : reqs) { out_->debug(CALL_INFO, 1, 0, "delivering delayed event to lib %s: %s\n", lib->libName().c_str(), toString(req).c_str()); - os_api_->sendExecutionEventNow(newCallback(lib, &EventLibrary::incomingRequest, req)); + os_api_->sendExecutionEventNow(newCallback(lib, &Library::incomingRequest, req)); } pending_library_request_.erase(iter); } } void -OperatingSystemImpl::unregisterEventLib(EventLibrary *lib) { +OperatingSystemImpl::unregisterEventLib(Library *lib) { out_->debug(CALL_INFO, 1, 0, "unregistering lib %s\n", lib->libName().c_str()); int &refcount = lib_refcounts_[lib]; @@ -512,7 +512,7 @@ OperatingSystemImpl::handleEventLibraryRequest(const std::string& name, Request* auto it = libs_.find(name); bool found = it != libs_.end(); if (found){ - EventLibrary* lib = it->second; + Library* lib = it->second; out_->debug(CALL_INFO, 1, 0, "delivering message to event lib %s:%p: %s\n", name.c_str(), lib, toString(req).c_str()); lib->incomingRequest(req); diff --git a/src/sst/elements/mercury/components/operating_system_impl.h b/src/sst/elements/mercury/components/operating_system_impl.h index 2b5c217b0a..5c4978fbaa 100644 --- a/src/sst/elements/mercury/components/operating_system_impl.h +++ b/src/sst/elements/mercury/components/operating_system_impl.h @@ -139,11 +139,11 @@ class OperatingSystemImpl { bool eraseCondition(int id); - EventLibrary* eventLibrary(const std::string& name) const; + Library* eventLibrary(const std::string& name) const; - void registerEventLib(EventLibrary* lib); + void registerEventLib(Library* lib); - void unregisterEventLib(EventLibrary* lib); + void unregisterEventLib(Library* lib); void handleRequest(Request* req); @@ -183,8 +183,8 @@ class OperatingSystemImpl { std::map internal_apis_; std::list requests_; - std::unordered_map libs_; - std::unordered_map lib_refcounts_; + std::unordered_map libs_; + std::unordered_map lib_refcounts_; std::map> pending_library_request_; void initThreading(SST::Params& params); diff --git a/src/sst/elements/mercury/operating_system/libraries/event_library.cc b/src/sst/elements/mercury/operating_system/libraries/event_library.cc deleted file mode 100644 index 653ca91648..0000000000 --- a/src/sst/elements/mercury/operating_system/libraries/event_library.cc +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2009-2025 NTESS. Under the terms -// of Contract DE-NA0003525 with NTESS, the U.S. -// Government retains certain rights in this software. -// -// Copyright (c) 2009-2025, NTESS -// All rights reserved. -// -// Portions are copyright of other developers: -// See the file CONTRIBUTORS.TXT in the top level directory -// of the distribution for more information. -// -// This file is part of the SST software package. For license -// information, see the LICENSE file in the top level directory of the -// distribution. - -#include -#include - -namespace SST { -namespace Hg { - -extern template class HgBase; -extern template class HgBase; - -EventLibrary::EventLibrary(const std::string& libname, SoftwareId sid, OperatingSystemAPI* os) : - os_(os), - sid_(sid), - addr_(os->addr()), - libname_(libname) -{ - os_->registerEventLib(this); -} - -EventLibrary::~EventLibrary() -{ - os_->unregisterEventLib(this); -} - -void -EventLibrary::incomingEvent(Event* /*ev*/) -{ - sst_hg_throw_printf(SST::Hg::UnimplementedError, - "%s::incomingEvent: this library should only block, never receive incoming", - toString().c_str()); -} - -void -EventLibrary::incomingRequest(Request* /*ev*/) -{ - sst_hg_throw_printf(SST::Hg::UnimplementedError, - "%s::incomingRequest: this library should only block, never receive incoming", - toString().c_str()); -} - -} // end namespace Hg -} // end namespace SST diff --git a/src/sst/elements/mercury/operating_system/libraries/event_library.h b/src/sst/elements/mercury/operating_system/libraries/event_library.h deleted file mode 100644 index b7b2a79741..0000000000 --- a/src/sst/elements/mercury/operating_system/libraries/event_library.h +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2009-2025 NTESS. Under the terms -// of Contract DE-NA0003525 with NTESS, the U.S. -// Government retains certain rights in this software. -// -// Copyright (c) 2009-2025, NTESS -// All rights reserved. -// -// Portions are copyright of other developers: -// See the file CONTRIBUTORS.TXT in the top level directory -// of the distribution for more information. -// -// This file is part of the SST software package. For license -// information, see the LICENSE file in the top level directory of the -// distribution. - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace SST { -namespace Hg { - -class EventLibrary -{ - public: - std::string toString() const { - return libname_; - } - - const std::string& libName() const { - return libname_; - } - - virtual void incomingEvent(Event* ev) = 0; - - virtual void incomingRequest(Request* req) = 0; - - OperatingSystemAPI* os() const { - return os_; - } - - SoftwareId sid() const { - return sid_; - } - - int aid() const { - return sid_.app_; - } - - NodeId addr() const { - return addr_; - } - - virtual ~EventLibrary(); - - protected: - EventLibrary(const std::string& libname, SoftwareId sid, OperatingSystemAPI* os); - - EventLibrary(const char* prefix, SoftwareId sid, OperatingSystemAPI* os) : - EventLibrary(standardLibname(prefix, sid), sid, os) - { - } - - static std::string standardLibname(const char* prefix, SoftwareId sid){ - return standardLibname(prefix, sid.app_, sid.task_); - } - - static std::string standardLibname(const char* prefix, AppId aid, TaskId tid){ - std::string app_prefix = standardAppPrefix(prefix, aid); - return standardAppLibname(app_prefix.c_str(), tid); - } - - static std::string standardAppLibname(const char* prefix, TaskId tid){ - return SST::Hg::sprintf("%s-%d", prefix, tid); - } - - static std::string standardAppPrefix(const char* prefix, AppId aid){ - return SST::Hg::sprintf("%s-%d", prefix, aid); - } - - protected: - OperatingSystemAPI* os_; - SoftwareId sid_; - NodeId addr_; - - private: - std::string libname_; - -}; - -} // end namespace Hg -} // end namespace SST diff --git a/src/sst/elements/mercury/operating_system/libraries/event_library_fwd.h b/src/sst/elements/mercury/operating_system/libraries/event_library_fwd.h deleted file mode 100644 index f831dd809a..0000000000 --- a/src/sst/elements/mercury/operating_system/libraries/event_library_fwd.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2009-2025 NTESS. Under the terms -// of Contract DE-NA0003525 with NTESS, the U.S. -// Government retains certain rights in this software. -// -// Copyright (c) 2009-2025, NTESS -// All rights reserved. -// -// Portions are copyright of other developers: -// See the file CONTRIBUTORS.TXT in the top level directory -// of the distribution for more information. -// -// This file is part of the SST software package. For license -// information, see the LICENSE file in the top level directory of the -// distribution. - -#pragma once - -namespace SST { -namespace Hg { - -class EventLibrary; -class library_builder; - -} // end namespace Hg -} // end namespace SST diff --git a/src/sst/elements/mercury/operating_system/libraries/library.cc b/src/sst/elements/mercury/operating_system/libraries/library.cc index f1a42b8bc2..0db4288994 100644 --- a/src/sst/elements/mercury/operating_system/libraries/library.cc +++ b/src/sst/elements/mercury/operating_system/libraries/library.cc @@ -94,5 +94,30 @@ Library::Library(SST::Params & params, App *parent) : api_parent_app_(parent) { } +void +Library::incomingRequest(Request* /*ev*/) +{ + sst_hg_throw_printf(SST::Hg::UnimplementedError, + "%s::incomingRequest: this library should only block, never receive incoming", + toString().c_str()); +} + +void +Library::incomingEvent(Event* /*ev*/) +{ + sst_hg_throw_printf(SST::Hg::UnimplementedError, + "%s::incomingEvent: this library should only block, never receive incoming", + toString().c_str()); +} + +Library::Library(const std::string& libname, SoftwareId sid, OperatingSystemAPI* os) : + os_(os), + sid_(sid), + addr_(os->addr()), + libname_(libname) +{ + os_->registerEventLib(this); +} + } // end namespace Hg } // end namespace SST diff --git a/src/sst/elements/mercury/operating_system/libraries/library.h b/src/sst/elements/mercury/operating_system/libraries/library.h index 71e55a2eb7..9d9288680b 100644 --- a/src/sst/elements/mercury/operating_system/libraries/library.h +++ b/src/sst/elements/mercury/operating_system/libraries/library.h @@ -30,6 +30,9 @@ namespace SST { namespace Hg { +class Request; +class OperatingSystemAPI; + void apiLock(); void apiUnlock(); @@ -78,10 +81,29 @@ class Library */ void endLibraryCall(); + const std::string& libName() const { + return libname_; + } + + std::string toString() const { + return libname_; + } + + virtual void incomingRequest(Request* req); + virtual void incomingEvent(Event* ev); + + Library(const std::string& libname, SoftwareId sid, OperatingSystemAPI* os); + protected: + OperatingSystemAPI* os_; + SoftwareId sid_; + NodeId addr_; + Library(SST::Params& params, App* parent); App* api_parent_app_; + private: + std::string libname_; }; } // end namespace Hg diff --git a/src/sst/elements/mercury/operating_system/libraries/service.h b/src/sst/elements/mercury/operating_system/libraries/service.h index fe20e533ed..216623e065 100644 --- a/src/sst/elements/mercury/operating_system/libraries/service.h +++ b/src/sst/elements/mercury/operating_system/libraries/service.h @@ -16,13 +16,13 @@ #pragma once #include -#include +#include namespace SST { namespace Hg { class Service : - public EventLibrary + public Library { public: @@ -30,11 +30,11 @@ class Service : protected: Service(const std::string& libname, SoftwareId sid, OperatingSystemAPI* os) : - EventLibrary(libname, sid, os) + Library(libname, sid, os) {} Service(const char* prefix, SoftwareId sid, OperatingSystemAPI* os) : - EventLibrary(prefix, sid, os) + Library(prefix, sid, os) {} ~Service() override{}