Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_Details_Random_decl.hpp
1// @HEADER
2// *****************************************************************************
3// Tpetra: Templated Linear Algebra Services Package
4//
5// Copyright 2008 NTESS and the Tpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef TPETRA_DETAILS_RANDOM_DECL_HPP
11#define TPETRA_DETAILS_RANDOM_DECL_HPP
12
13#include "TpetraCore_config.h"
14#include "Kokkos_Random.hpp"
15
16namespace Tpetra {
17namespace Details {
18
19template <class ExecutionSpace>
20class Static_Random_XorShift64_Pool {
21 public:
22 // The resetPool function will re-initialize the pool based on the system RNG and the MPI rank.
23 // On GPU architectures, this will likely involve non-trivial host-to-device transfers.
24 static void resetPool(int mpi_rank);
25
26 // The isSet function returns true if resetPool has been callled.
27 static bool isSet();
28 // The getPool function will return the existing pool.
29 static Kokkos::Random_XorShift64_Pool<ExecutionSpace>& getPool();
30
31 // Do not access this directly. This is public only for deallocation purposes
32 static Kokkos::Random_XorShift64_Pool<ExecutionSpace>* pool_;
33
34 private:
35 static unsigned int getSeedFromRank(int mpi_rank);
36};
37
38} // namespace Details
39} // namespace Tpetra
40
41#endif // TPETRA_DETAILS_RANDOM_DECL_HPP
Implementation details of Tpetra.
Namespace Tpetra contains the class and methods constituting the Tpetra library.