]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Filter out --help from Kokkos flags.
authorWolfgang Bangerth <bangerth@colostate.edu>
Sat, 24 Jun 2023 22:36:54 +0000 (16:36 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sat, 24 Jun 2023 22:36:54 +0000 (16:36 -0600)
source/base/mpi.cc

index 179f7515f260d954bd3e5aec62ab5f33b03dddc5..212814f83ca25c3501ea2caabbbf0cca64127f41 100644 (file)
@@ -781,9 +781,16 @@ namespace Utilities
         // argv has argc+1 elements and the last one is a nullptr. For appending
         // one element we thus create a new argv by copying the first argc
         // elements, append the new option, and then a nullptr.
+        //
+        // We do get in trouble, though, if a user program is called with
+        // '--help' as a command line argument. This '--help' gets passed on to
+        // Kokkos, which promptly responds with a lengthy message that the user
+        // likely did not intend. As a consequence, filter out this specific
+        // flag.
         std::vector<char *> argv_new;
         for (int i = 0; i < argc; ++i)
-          argv_new.push_back(argv[i]);
+          if (strcmp(argv[i], "--help") != 0)
+            argv_new.push_back(argv[i]);
 
         std::stringstream threads_flag;
 #if KOKKOS_VERSION >= 30700

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.