]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add test
authorDaniel Arndt <arndtd@ornl.gov>
Mon, 5 Dec 2022 00:15:09 +0000 (19:15 -0500)
committerDaniel Arndt <arndtd@ornl.gov>
Thu, 8 Dec 2022 22:13:15 +0000 (17:13 -0500)
tests/base/kokkos_01.cc [new file with mode: 0644]
tests/base/kokkos_01.output [new file with mode: 0644]

diff --git a/tests/base/kokkos_01.cc b/tests/base/kokkos_01.cc
new file mode 100644 (file)
index 0000000..5abc787
--- /dev/null
@@ -0,0 +1,42 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2022 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+// test that we can initialize and finalize Kokkos in user code.
+
+#include <deal.II/base/kokkos.h>
+
+#include <deal.II/lac/la_parallel_vector.h>
+#include <deal.II/lac/vector_memory.h>
+
+#include "../tests.h"
+
+int
+main()
+{
+  Kokkos::initialize();
+
+  initlog();
+
+  GrowingVectorMemory<
+    LinearAlgebra::distributed::Vector<double, MemorySpace::Host>>{};
+  GrowingVectorMemory<
+    LinearAlgebra::distributed::Vector<float, MemorySpace::Host>>{};
+
+  Impl::ensure_kokkos_initialized();
+  deallog << "Kokkos initialized by Kokkos: " << Impl::dealii_initialized_kokkos
+          << std::endl;
+
+  Kokkos::finalize();
+}
diff --git a/tests/base/kokkos_01.output b/tests/base/kokkos_01.output
new file mode 100644 (file)
index 0000000..147e64f
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::Kokkos initialized by Kokkos: 0

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.