Debian Codegraph @

packages/muelu/test/unit_tests_kokkos/UseKokkos_kokkos.cpp

raw
1 // @HEADER
2 // *****************************************************************************
3 // MueLu: A package for multigrid based preconditioning
4 //
5 // Copyright 2012 NTESS and the MueLu contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9
10 #include <Teuchos_UnitTestHarness.hpp>
11 #include <Teuchos_DefaultComm.hpp>
12
13 #include <Xpetra_Matrix.hpp>
14 #include <Xpetra_MultiVectorFactory.hpp>
15
16 #include "MueLu_UseDefaultTypes.hpp"
17
18 #include "MueLu_TestHelpers_kokkos.hpp"
19 #include "MueLu_Version.hpp"
20
21 #include "MueLu_ParameterListInterpreter.hpp"
22 #include "MueLu_FactoryManager.hpp"
23 #include "MueLu_HierarchyManager.hpp"
24 #include "MueLu_Hierarchy.hpp"
25
26 namespace MueLuTests {
27
28 TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL(UseKokkos_kokkos, FactoryManager, Scalar, LocalOrdinal, GlobalOrdinal, Node) {
29 #include "MueLu_UseShortNames.hpp"
30 MUELU_TESTING_SET_OSTREAM;
31 MUELU_TESTING_LIMIT_SCOPE(Scalar, GlobalOrdinal, Node);
32 out << "version: " << MueLu::Version() << std::endl;
33
34 using Teuchos::RCP;
35 using Teuchos::rcp;
36 using real_type = typename Teuchos::ScalarTraits<SC>::coordinateType;
37 using RealValuedMultiVector = Xpetra::MultiVector<real_type, LO, GO, NO>;
38
39 const bool useKokkos = false;
40
41 // Build the problem
42 RCP<Matrix> A = MueLuTests::TestHelpers_kokkos::TestFactory<SC, LO, GO, NO>::Build1DPoisson(2001);
43 RCP<const Map> map = A->getMap();
44 RCP<RealValuedMultiVector> coordinates = Xpetra::MultiVectorFactory<real_type, LO, GO, NO>::Build(map, 1);
45 RCP<MultiVector> nullspace = MultiVectorFactory::Build(map, 1);
46 nullspace->putScalar(Teuchos::ScalarTraits<SC>::one());
47
48 // Setting paramters for the hierarchy
49 Teuchos::ParameterList paramList;
50 paramList.set("verbosity", "test");
51 paramList.set("use kokkos refactor", useKokkos);
52 RCP<HierarchyManager> mueluFactory = rcp(new ParameterListInterpreter(paramList));
53 mueluFactory->CheckConfig();
54 const RCP<const FactoryManagerBase> manager = mueluFactory->GetFactoryManager(0);
55 RCP<const FactoryManager> factoryManager = Teuchos::rcp_dynamic_cast<const FactoryManager>(manager, true);
56
57 TEST_EQUALITY(factoryManager->GetKokkosRefactor() == useKokkos, true);
58 }
59
60 #define MUELU_ETI_GROUP(SC, LO, GO, NO) \
61 TEUCHOS_UNIT_TEST_TEMPLATE_4_INSTANT(UseKokkos_kokkos, FactoryManager, SC, LO, GO, NO)
62
63 #include <MueLu_ETI_4arg.hpp>
64
65 } // namespace MueLuTests