From 8d0741889a3f484d04e4bc8cc8126f0022aa8395 Mon Sep 17 00:00:00 2001
From: Stephane Del Pino <stephane.delpino44@gmail.com>
Date: Wed, 16 Nov 2022 22:19:50 +0100
Subject: [PATCH] Fix deprecated Kokkos command line option

The option was passed directly to Kokkos.
Now one uses the InitArguments structure.
---
 src/utils/PugsUtils.cpp | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/utils/PugsUtils.cpp b/src/utils/PugsUtils.cpp
index 76509c611..4e1f52165 100644
--- a/src/utils/PugsUtils.cpp
+++ b/src/utils/PugsUtils.cpp
@@ -83,6 +83,7 @@ initialize(int& argc, char* argv[])
   parallel::Messenger::create(argc, argv);
   bool enable_fpe     = true;
   bool enable_signals = true;
+  int nb_threads      = -1;
 
   std::string filename;
   {
@@ -97,9 +98,8 @@ initialize(int& argc, char* argv[])
       return os.str();
     });
 
-    int threads = -1;
-    app.add_option("--threads", threads, "Number of Kokkos threads")
-      ->check(CLI::Range(1, std::numeric_limits<decltype(threads)>::max()));
+    app.add_option("--threads", nb_threads, "Number of Kokkos threads")
+      ->check(CLI::Range(1, std::numeric_limits<decltype(nb_threads)>::max()));
 
     bool enable_color = true;
     app.add_flag("--color,!--no-color", enable_color, "Colorize console output [default: true]");
@@ -139,7 +139,15 @@ initialize(int& argc, char* argv[])
   SignalManager::init(enable_signals);
 
   setDefaultOMPEnvironment();
-  Kokkos::initialize(argc, argv);
+  {
+    Kokkos::InitArguments args;
+    args.num_threads      = nb_threads;
+    args.num_numa         = -1;
+    args.device_id        = -1;
+    args.disable_warnings = true;
+
+    Kokkos::initialize(args);
+  }
 
   if (ConsoleManager::showPreamble()) {
     std::cout << "----------------- " << rang::fg::green << "pugs exec info" << rang::fg::reset
-- 
GitLab