From d3a45feea0a5c258b3727f3bc115993ddd467e50 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 5 Sep 2019 18:15:03 -0500 Subject: [PATCH] add a test --- tests/base/utilities_02b.cc | 67 ++++++++++++++++++++++++++ tests/base/utilities_02b.output | 7 +++ tests/base/utilities_02b.output.avx | 19 ++++++++ tests/base/utilities_02b.output.avx512 | 25 ++++++++++ tests/base/utilities_02b.output.sse2 | 13 +++++ 5 files changed, 131 insertions(+) create mode 100644 tests/base/utilities_02b.cc create mode 100644 tests/base/utilities_02b.output create mode 100644 tests/base/utilities_02b.output.avx create mode 100644 tests/base/utilities_02b.output.avx512 create mode 100644 tests/base/utilities_02b.output.sse2 diff --git a/tests/base/utilities_02b.cc b/tests/base/utilities_02b.cc new file mode 100644 index 0000000000..b78cc7968a --- /dev/null +++ b/tests/base/utilities_02b.cc @@ -0,0 +1,67 @@ +// --------------------------------------------------------------------- +// +// 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 Utilities::fixed_power for vectorized array + +#include +#include + +#include "../tests.h" + +template +void +do_test(const VectorizedArrayType array) +{ + deallog << " test " << VectorizedArrayType::n_array_elements + << " array elements" << std::endl; + + auto exponentiated_array = Utilities::fixed_power<3>(array); + + for (unsigned int i = 0; i < VectorizedArrayType::n_array_elements; i++) + deallog << exponentiated_array[i] << " "; + deallog << std::endl; + + exponentiated_array = Utilities::fixed_power<-3>(array); + + 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)); + do_test(VectorizedArray(2.0)); +#endif + +#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) + do_test(VectorizedArray(2.0)); + do_test(VectorizedArray(2.0)); +#endif + +#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__) + do_test(VectorizedArray(2.0)); + do_test(VectorizedArray(2.0)); +#endif + + do_test(VectorizedArray(2.0)); + do_test(VectorizedArray(2.0)); +} diff --git a/tests/base/utilities_02b.output b/tests/base/utilities_02b.output new file mode 100644 index 0000000000..9e14554795 --- /dev/null +++ b/tests/base/utilities_02b.output @@ -0,0 +1,7 @@ + +DEAL:: test 1 array elements +DEAL::8.00000 +DEAL::0.125000 +DEAL:: test 1 array elements +DEAL::8.00000 +DEAL::0.125000 diff --git a/tests/base/utilities_02b.output.avx b/tests/base/utilities_02b.output.avx new file mode 100644 index 0000000000..7421f2f936 --- /dev/null +++ b/tests/base/utilities_02b.output.avx @@ -0,0 +1,19 @@ + +DEAL:: test 4 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 +DEAL::0.125000 0.125000 0.125000 0.125000 +DEAL:: test 8 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 +DEAL::0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 +DEAL:: test 2 array elements +DEAL::8.00000 8.00000 +DEAL::0.125000 0.125000 +DEAL:: test 4 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 +DEAL::0.125000 0.125000 0.125000 0.125000 +DEAL:: test 1 array elements +DEAL::8.00000 +DEAL::0.125000 +DEAL:: test 1 array elements +DEAL::8.00000 +DEAL::0.125000 diff --git a/tests/base/utilities_02b.output.avx512 b/tests/base/utilities_02b.output.avx512 new file mode 100644 index 0000000000..e26eefc661 --- /dev/null +++ b/tests/base/utilities_02b.output.avx512 @@ -0,0 +1,25 @@ + +DEAL:: test 8 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 +DEAL::0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 +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::0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 +DEAL:: test 4 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 +DEAL::0.125000 0.125000 0.125000 0.125000 +DEAL:: test 8 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 +DEAL::0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 0.125000 +DEAL:: test 2 array elements +DEAL::8.00000 8.00000 +DEAL::0.125000 0.125000 +DEAL:: test 4 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 +DEAL::0.125000 0.125000 0.125000 0.125000 +DEAL:: test 1 array elements +DEAL::8.00000 +DEAL::0.125000 +DEAL:: test 1 array elements +DEAL::8.00000 +DEAL::0.125000 diff --git a/tests/base/utilities_02b.output.sse2 b/tests/base/utilities_02b.output.sse2 new file mode 100644 index 0000000000..f95e20fe95 --- /dev/null +++ b/tests/base/utilities_02b.output.sse2 @@ -0,0 +1,13 @@ + +DEAL:: test 2 array elements +DEAL::8.00000 8.00000 +DEAL::0.125000 0.125000 +DEAL:: test 4 array elements +DEAL::8.00000 8.00000 8.00000 8.00000 +DEAL::0.125000 0.125000 0.125000 0.125000 +DEAL:: test 1 array elements +DEAL::8.00000 +DEAL::0.125000 +DEAL:: test 1 array elements +DEAL::8.00000 +DEAL::0.125000 -- 2.39.5