]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New test.
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Wed, 27 Dec 2017 15:16:09 +0000 (16:16 +0100)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Thu, 28 Dec 2017 06:41:27 +0000 (07:41 +0100)
tests/base/vectorization_09.cc [new file with mode: 0644]
tests/base/vectorization_09.output [new file with mode: 0644]

diff --git a/tests/base/vectorization_09.cc b/tests/base/vectorization_09.cc
new file mode 100644 (file)
index 0000000..b43305d
--- /dev/null
@@ -0,0 +1,69 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2014 - 2015 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 at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+// test VectorizedArray::streaming_store
+
+#include "../tests.h"
+
+#include <deal.II/base/vectorization.h>
+#include <deal.II/base/aligned_vector.h>
+
+template <typename Number>
+void test ()
+{
+  const unsigned int n_chunks = 50000;
+  const unsigned int n_vectors = VectorizedArray<Number>::n_array_elements;
+  std::vector<Number> values(n_vectors*n_chunks);
+  for (unsigned int i=0; i<values.size(); ++i)
+    values[i] = i;
+
+  // test store operation
+  AlignedVector<Number> stored(n_vectors*n_chunks);
+  for (unsigned int i=0; i<n_chunks; ++i)
+    {
+      VectorizedArray<Number> tmp;
+      tmp.load(&values[i*n_vectors]);
+      tmp.streaming_store(&stored[i*n_vectors]);
+    }
+  for (unsigned int i=0; i<n_chunks*n_vectors; ++i)
+    AssertThrow(stored[i] == i, ExcInternalError());
+  deallog << "streaming store OK" << std::endl;
+}
+
+
+
+
+int main()
+{
+  initlog();
+
+  deallog.push("double");
+  test<double> ();
+  deallog.pop();
+  deallog.push("float");
+  test<float> ();
+  deallog.pop();
+
+  // test long double and unsigned int: in these cases, the default path of
+  // VectorizedArray is taken no matter what was done for double or float
+  deallog.push("long double");
+  test<long double> ();
+  deallog.pop();
+
+  deallog.push("unsigned int");
+  test<unsigned int> ();
+  deallog.pop();
+}
diff --git a/tests/base/vectorization_09.output b/tests/base/vectorization_09.output
new file mode 100644 (file)
index 0000000..2080240
--- /dev/null
@@ -0,0 +1,5 @@
+
+DEAL:double::streaming store OK
+DEAL:float::streaming store OK
+DEAL:long double::streaming store OK
+DEAL:unsigned int::streaming store OK

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.