From: Matthias Maier Date: Wed, 4 Sep 2019 17:52:30 +0000 (-0500) Subject: add a test X-Git-Tag: v9.2.0-rc1~1133^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F8707%2Fhead;p=dealii.git add a test --- diff --git a/tests/base/vectorization_13.cc b/tests/base/vectorization_13.cc new file mode 100644 index 0000000000..d1adc1e2ed --- /dev/null +++ b/tests/base/vectorization_13.cc @@ -0,0 +1,62 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2015 - 2019 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 std::pow for vectorized array + +#include + +#include "../tests.h" + + +template +void +do_test(const VectorizedArrayType array, + const typename VectorizedArrayType::value_type number) +{ + deallog << " test " << VectorizedArrayType::n_array_elements + << " array elements" << std::endl; + + auto exponentiated_array = std::pow(array, number); + + for (unsigned int i = 0; i < VectorizedArrayType::n_array_elements; i++) + deallog << exponentiated_array[i] << " "; + deallog << std::endl; +} + + +int +main() +{ + initlog(); + +#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) + do_test(VectorizedArray(2.0), 3.0); + do_test(VectorizedArray(2.0), 3.0); +#endif + +#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) + do_test(VectorizedArray(2.0), 3.0); + do_test(VectorizedArray(2.0), 3.0); +#endif + +#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__) + do_test(VectorizedArray(2.0), 3.0); + do_test(VectorizedArray(2.0), 3.0); +#endif + + do_test(VectorizedArray(2.0), 3.0); + do_test(VectorizedArray(2.0), 3.0); +} diff --git a/tests/base/vectorization_13.output b/tests/base/vectorization_13.output new file mode 100644 index 0000000000..b255be5f41 --- /dev/null +++ b/tests/base/vectorization_13.output @@ -0,0 +1,5 @@ + +DEAL:: test 1 array elements +DEAL::8.00000 +DEAL:: test 1 array elements +DEAL::8.00000 diff --git a/tests/base/vectorization_13.output.avx b/tests/base/vectorization_13.output.avx new file mode 100644 index 0000000000..e8cc787586 --- /dev/null +++ b/tests/base/vectorization_13.output.avx @@ -0,0 +1,13 @@ + +DEAL:: test 4 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 +DEAL:: test 8 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 +DEAL:: test 2 array elements +DEAL::8.00000 8.00000 +DEAL:: test 4 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 +DEAL:: test 1 array elements +DEAL::8.00000 +DEAL:: test 1 array elements +DEAL::8.00000 diff --git a/tests/base/vectorization_13.output.avx512 b/tests/base/vectorization_13.output.avx512 new file mode 100644 index 0000000000..46df357ef7 --- /dev/null +++ b/tests/base/vectorization_13.output.avx512 @@ -0,0 +1,17 @@ + +DEAL:: test 8 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 +DEAL:: test 16 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 +DEAL:: test 4 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 +DEAL:: test 8 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 +DEAL:: test 2 array elements +DEAL::8.00000 8.00000 +DEAL:: test 4 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 +DEAL:: test 1 array elements +DEAL::8.00000 +DEAL:: test 1 array elements +DEAL::8.00000 diff --git a/tests/base/vectorization_13.output.sse2 b/tests/base/vectorization_13.output.sse2 new file mode 100644 index 0000000000..33e4e4f81a --- /dev/null +++ b/tests/base/vectorization_13.output.sse2 @@ -0,0 +1,9 @@ + +DEAL:: test 2 array elements +DEAL::8.00000 8.00000 +DEAL:: test 4 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 +DEAL:: test 1 array elements +DEAL::8.00000 +DEAL:: test 1 array elements +DEAL::8.00000