From 4d537130861e76a99d18a7309e0402e0ec136a45 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 16 Aug 2018 23:04:34 +0200 Subject: [PATCH] Add test for CUDAWrappers::Vector::print --- tests/cuda/cuda_vector_04.cu | 57 +++++++++++++++++ tests/cuda/cuda_vector_04.output | 104 +++++++++++++++++++++++++++++++ 2 files changed, 161 insertions(+) create mode 100644 tests/cuda/cuda_vector_04.cu create mode 100644 tests/cuda/cuda_vector_04.output diff --git a/tests/cuda/cuda_vector_04.cu b/tests/cuda/cuda_vector_04.cu new file mode 100644 index 0000000000..c97ee95031 --- /dev/null +++ b/tests/cuda/cuda_vector_04.cu @@ -0,0 +1,57 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2015 - 2016 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. +// +// --------------------------------------------------------------------- + + +// Check LinearAlgebra::CUDAWrappers::Vector::print() + +#include + +#include +#include + +#include +#include + +#include "../tests.h" + +void +test() +{ + const unsigned int size = 100; + LinearAlgebra::CUDAWrappers::Vector cuda_vector(size); + + LinearAlgebra::ReadWriteVector read_write_1(size); + for (unsigned int i = 0; i < size; ++i) + { + read_write_1[i] = i; + } + + cuda_vector.import(read_write_1, VectorOperation::insert); + + cuda_vector.print(deallog.get_file_stream()); +} + +int +main(int argc, char **argv) +{ + initlog(); + deallog.depth_console(0); + + test(); + + deallog << "OK" << std::endl; + + return 0; +} diff --git a/tests/cuda/cuda_vector_04.output b/tests/cuda/cuda_vector_04.output new file mode 100644 index 0000000000..012f7efdd8 --- /dev/null +++ b/tests/cuda/cuda_vector_04.output @@ -0,0 +1,104 @@ + +IndexSet: {[0,99]} + +0.00e+00 +1.00e+00 +2.00e+00 +3.00e+00 +4.00e+00 +5.00e+00 +6.00e+00 +7.00e+00 +8.00e+00 +9.00e+00 +1.00e+01 +1.10e+01 +1.20e+01 +1.30e+01 +1.40e+01 +1.50e+01 +1.60e+01 +1.70e+01 +1.80e+01 +1.90e+01 +2.00e+01 +2.10e+01 +2.20e+01 +2.30e+01 +2.40e+01 +2.50e+01 +2.60e+01 +2.70e+01 +2.80e+01 +2.90e+01 +3.00e+01 +3.10e+01 +3.20e+01 +3.30e+01 +3.40e+01 +3.50e+01 +3.60e+01 +3.70e+01 +3.80e+01 +3.90e+01 +4.00e+01 +4.10e+01 +4.20e+01 +4.30e+01 +4.40e+01 +4.50e+01 +4.60e+01 +4.70e+01 +4.80e+01 +4.90e+01 +5.00e+01 +5.10e+01 +5.20e+01 +5.30e+01 +5.40e+01 +5.50e+01 +5.60e+01 +5.70e+01 +5.80e+01 +5.90e+01 +6.00e+01 +6.10e+01 +6.20e+01 +6.30e+01 +6.40e+01 +6.50e+01 +6.60e+01 +6.70e+01 +6.80e+01 +6.90e+01 +7.00e+01 +7.10e+01 +7.20e+01 +7.30e+01 +7.40e+01 +7.50e+01 +7.60e+01 +7.70e+01 +7.80e+01 +7.90e+01 +8.00e+01 +8.10e+01 +8.20e+01 +8.30e+01 +8.40e+01 +8.50e+01 +8.60e+01 +8.70e+01 +8.80e+01 +8.90e+01 +9.00e+01 +9.10e+01 +9.20e+01 +9.30e+01 +9.40e+01 +9.50e+01 +9.60e+01 +9.70e+01 +9.80e+01 +9.90e+01 +DEAL::OK -- 2.39.5