MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_KokkosTuningInterface.hpp
Go to the documentation of this file.
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#ifndef MUELU_KOKKOSTUNINGINTERFACE_HPP
11#define MUELU_KOKKOSTUNINGINTERFACE_HPP
12
13#include <string>
14#include <vector>
15#include "Teuchos_Comm.hpp"
16#include "Teuchos_RCP.hpp"
17#include "Teuchos_ArrayRCP.hpp"
18#include "Teuchos_ParameterList.hpp"
19#include "MueLu_BaseClass.hpp"
20
21namespace MueLu {
22
30 public:
31 KokkosTuningInterface(const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
32
34
35 Teuchos::RCP<const Teuchos::ParameterList> GetValidParameterList() const;
36
37 // Sets the input parameters for the KokkosTuneInterface
38 // NOTE: These are *not* the parameters which KokkosTuning is going to overwrite, rather the
39 // parameters to tell KokkosTuning what to do.
40 void SetParameterList(Teuchos::ParameterList& inParams) {
41 params_ = inParams;
42 Setup();
43 }
44
45 // Calls Kokkos Tuning to set MueLu Parameters, manually specifying the Kokkos context ID
46 void SetMueLuParameters(size_t kokkos_context_id, Teuchos::ParameterList& mueluParams, bool overwrite = true) const;
47
48 // Calls Kokkos Tuning to set MueLu Parameters, using the Kokkos context ID on the list
49 void SetMueLuParameters(Teuchos::ParameterList& mueluParams, bool overwrite = true) const;
50
51 private:
52 // Mapping unpacker
53 void UnpackMueLuMapping();
54
55 // String splitter
56 std::vector<std::string> SplitString(const std::string& base_string, const std::string& delimiter) const;
57
58 // Sets up Kokkos Tuning - This gets called from SetParameterList
59 void Setup();
60
61 // Cached data
62 Teuchos::RCP<const Teuchos::Comm<int> > comm_;
63 mutable Teuchos::ParameterList params_; // The mutable is a hack to deal with issues in Teuchos
64
65 // Tuning information
66 mutable std::vector<Kokkos::Tools::Experimental::VariableValue> in_variables;
67 mutable std::vector<Kokkos::Tools::Experimental::VariableValue> out_variables;
68 std::vector<std::string> out_names;
69 std::vector<std::string> out_typenames;
70};
71
72} // namespace MueLu
73
74#endif // MUELU_KOKKOSTUNEINTERFACE_HPP
Base class for MueLu classes.
void SetParameterList(Teuchos::ParameterList &inParams)
std::vector< Kokkos::Tools::Experimental::VariableValue > out_variables
std::vector< std::string > SplitString(const std::string &base_string, const std::string &delimiter) const
Teuchos::RCP< const Teuchos::Comm< int > > comm_
std::vector< Kokkos::Tools::Experimental::VariableValue > in_variables
Teuchos::RCP< const Teuchos::ParameterList > GetValidParameterList() const
void SetMueLuParameters(size_t kokkos_context_id, Teuchos::ParameterList &mueluParams, bool overwrite=true) const
Namespace for MueLu classes and methods.