From b9d2a652a6060449def3bbfd7467c2a3c49d6883 Mon Sep 17 00:00:00 2001
From: Giovanna Lazzari Miotto <giovanna.lazzari.miotto@cern.ch>
Date: Thu, 20 Mar 2025 14:52:23 +0100
Subject: [PATCH] nmc: Dummy code for NMC resource allocation

---
 src/multi_pipeline.cc | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/multi_pipeline.cc b/src/multi_pipeline.cc
index 55d3435a..2afc5802 100644
--- a/src/multi_pipeline.cc
+++ b/src/multi_pipeline.cc
@@ -8,6 +8,8 @@
 #include <boost/bind/bind.hpp>
 #include <boost/thread.hpp>
 
+#include "micron/nmc.h"
+#include "micron/nmc.hpp"
 #include "server.h"
 #include "tbb/task_group.h"
 #include "tbb/task_scheduler_init.h"
@@ -23,6 +25,21 @@ MultiPipeline::MultiPipeline(Config c)
     server_thread_ = boost::thread(boost::bind(&boost::asio::io_service::run, &io_service_));
   }
 
+  nmc_status_t default_status = NMC_NO_MEM;
+  Nmc default_nmc(&default_status);
+  if (default_status != 0) {
+    LOG(FATAL) << "Failed to allocate default NMC resources";
+  }
+
+  nmc_status_t nmc_status = NMC_NO_MEM;
+  NmcAttachProps nmc_properties;
+  Nmc prop_nmc(nmc_properties, &nmc_status);
+  if (nmc_status) {
+    LOG(FATAL) << "Failed to allocate NMC resources";
+  }
+  uint32_t transf_engine_thread_count = nmc_properties.getTeTotalThreadCount();
+  LOG(INFO) << "Number of TE threads: " << transf_engine_thread_count;
+
   MakePipelines();
 }
 
-- 
GitLab