44#include < random>
55#include < hicr/backends/hwloc/memoryManager.hpp>
66#include < hicr/backends/hwloc/topologyManager.hpp>
7- #include < hicr/backends/mpi/instanceManager.hpp>
8- #include < hicr/backends/mpi/communicationManager.hpp>
9- #include < hicr/backends/mpi/memoryManager.hpp>
7+ #include < hicr/backends/pthreads/instanceManager.hpp>
8+ #include < hicr/backends/pthreads/communicationManager.hpp>
109#include < hicr/backends/pthreads/computeManager.hpp>
1110#include < hicr/backends/pthreads/communicationManager.hpp>
1211#include < hicr/backends/boost/computeManager.hpp>
@@ -22,7 +21,7 @@ int main(int argc, char *argv[])
2221 // Creating HWloc topology object
2322 hwloc_topology_t hwlocTopologyObject;
2423
25- // Reserving memory for hwloc
24+ // Reserving memory for hwloc
2625 hwloc_topology_init (&hwlocTopologyObject);
2726
2827 // Initializing host (CPU) topology manager
@@ -46,13 +45,15 @@ int main(int argc, char *argv[])
4645 // Grabbing first compute resource for computing incoming RPCs
4746 auto computeResource = *computeResources.begin ();
4847
49- // Getting MPI managers
50- auto instanceManager = HiCR::backend::mpi::InstanceManager::createDefault (&argc, &argv);
51- auto mpiCommunicationManager = std::make_shared<HiCR::backend::mpi::CommunicationManager>();
52- auto mpiMemoryManager = std::make_shared<HiCR::backend::mpi::MemoryManager>();
53- auto pthreadsComputeManager = std::make_shared<HiCR::backend::pthreads::ComputeManager>();
54- auto boostComputeManager = std::make_shared<HiCR::backend::boost::ComputeManager>();
55- auto hwlocMemoryManager = std::make_shared<HiCR::backend::hwloc::MemoryManager>(&hwlocTopologyObject);
48+ // Creating pthreads manager core
49+ HiCR::backend::pthreads::Core core (1 );
50+
51+ // Getting managers
52+ auto instanceManager = std::make_shared<HiCR::backend::pthreads::InstanceManager>(core);
53+ auto communicationManager = std::make_shared<HiCR::backend::pthreads::CommunicationManager>(core);
54+ auto workerComputeManager = std::make_shared<HiCR::backend::pthreads::ComputeManager>();
55+ auto taskComputeManager = std::make_shared<HiCR::backend::boost::ComputeManager>();
56+ auto memoryManager = std::make_shared<HiCR::backend::hwloc::MemoryManager>(&hwlocTopologyObject);
5657
5758 // Creating taskr object
5859 nlohmann::json taskrConfig;
@@ -61,10 +62,10 @@ int main(int argc, char *argv[])
6162 taskrConfig[" Minimum Active Task Workers" ] = 1 ; // Have at least one worker active at all times
6263 taskrConfig[" Service Worker Count" ] = 1 ; // Have one dedicated service workers at all times to listen for incoming messages
6364 taskrConfig[" Make Task Workers Run Services" ] = false ; // Workers will check for meta messages in between executions
64- auto taskr = std::make_unique<taskr::Runtime>(boostComputeManager .get (), pthreadsComputeManager .get (), computeResources, taskrConfig);
65+ auto taskr = std::make_unique<taskr::Runtime>(taskComputeManager .get (), workerComputeManager .get (), computeResources, taskrConfig);
6566
6667 // Instantiate RPC Engine
67- auto rpcEngine = std::make_shared<HiCR::frontend::RPCEngine>(*mpiCommunicationManager , *instanceManager, *mpiMemoryManager , *pthreadsComputeManager , bufferMemorySpace, computeResource);
68+ auto rpcEngine = std::make_shared<HiCR::frontend::RPCEngine>(*communicationManager , *instanceManager, *memoryManager , *workerComputeManager , bufferMemorySpace, computeResource);
6869
6970 // Initialize RPC Engine
7071 rpcEngine->initialize ();
@@ -118,7 +119,7 @@ int main(int argc, char *argv[])
118119 // Checking I have the correct number of instances (one per replica)
119120 if (instanceManager->getInstances ().size () != replicasRequired)
120121 {
121- fprintf (stderr, " Error: %lu MPI instances provided, but %lu partition replicas were requested\n " , instanceManager->getInstances ().size (), replicasRequired);
122+ fprintf (stderr, " Error: %lu instances provided, but %lu partition replicas were requested\n " , instanceManager->getInstances ().size (), replicasRequired);
122123 instanceManager->abort (-1 );
123124 }
124125
@@ -143,18 +144,18 @@ int main(int argc, char *argv[])
143144 // This allows for flexibility to choose in which devices to place the payload and coordination buffers
144145 for (const auto & edge : hllm.getDeployment ().getEdges ())
145146 {
146- edge->setPayloadCommunicationManager (mpiCommunicationManager .get ());
147- edge->setPayloadMemoryManager (mpiMemoryManager .get ());
147+ edge->setPayloadCommunicationManager (communicationManager .get ());
148+ edge->setPayloadMemoryManager (memoryManager .get ());
148149 edge->setPayloadMemorySpace (bufferMemorySpace);
149150
150- edge->setCoordinationCommunicationManager (mpiCommunicationManager .get ());
151- edge->setCoordinationMemoryManager (mpiMemoryManager .get ());
151+ edge->setCoordinationCommunicationManager (communicationManager .get ());
152+ edge->setCoordinationMemoryManager (memoryManager .get ());
152153 edge->setCoordinationMemorySpace (bufferMemorySpace);
153154 }
154155
155156 // Setting managers for partition-wise control messaging
156- hllm.getDeployment ().getControlBuffer ().communicationManager = mpiCommunicationManager .get ();
157- hllm.getDeployment ().getControlBuffer ().memoryManager = mpiMemoryManager .get ();
157+ hllm.getDeployment ().getControlBuffer ().communicationManager = communicationManager .get ();
158+ hllm.getDeployment ().getControlBuffer ().memoryManager = memoryManager .get ();
158159 hllm.getDeployment ().getControlBuffer ().memorySpace = bufferMemorySpace;
159160
160161 // Declaring the hLLM tasks for the application
@@ -167,7 +168,7 @@ int main(int argc, char *argv[])
167168
168169 // Create output
169170 responseOutput = request + std::string (" [Processed]" );
170- const auto responseMemSlot = mpiMemoryManager ->registerLocalMemorySlot (bufferMemorySpace, responseOutput.data (), responseOutput.size () + 1 );
171+ const auto responseMemSlot = memoryManager ->registerLocalMemorySlot (bufferMemorySpace, responseOutput.data (), responseOutput.size () + 1 );
171172
172173 // printf("[Basic Example] Returning response: '%s'\n", responseOutput.c_str());
173174 task->setOutput (" Response" , responseMemSlot);
0 commit comments