From f726490fd7cf55a147e68f4cdf5e1a542be1f8d9 Mon Sep 17 00:00:00 2001
From: gianlucarossi15 <gianluca.rossi2000@live.com>
Date: Tue, 2 Apr 2024 11:30:18 +0200
Subject: [PATCH] Added concurrency equals to the number of cores of the
 running machine

---
 (p,t)_sparsification/main.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/(p,t)_sparsification/main.cpp b/(p,t)_sparsification/main.cpp
index b4b342b..52e253e 100644
--- a/(p,t)_sparsification/main.cpp
+++ b/(p,t)_sparsification/main.cpp
@@ -18,7 +18,7 @@ namespace po = boost::program_options;
 int main(int argc, char *argv[]) {
 
     srand((unsigned)time(NULL));
-
+    unsigned int nproc = std::thread::hardware_concurrency();
     po::options_description desc("Allowed options");
     desc.add_options()
             ("help", "produce help message")
@@ -66,7 +66,7 @@ int main(int argc, char *argv[]) {
 
 
 
-    #pragma omp parallel for  num_threads(NUM_TRIALS)
+    #pragma omp parallel for  num_threads(nproc)
     for (int i = 0; i < NUM_TRIALS; i++) {
 
         auto start = std::chrono::steady_clock::now();
-- 
GitLab