Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_Details_Random.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_HPP
11#define TPETRA_DETAILS_RANDOM_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 {
21public:
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
32
33#ifdef KOKKOS_ENABLE_CUDA
34template<>
35class Static_Random_XorShift64_Pool<typename Kokkos::CudaSpace::execution_space> {
36public:
37 static void resetPool(int mpi_rank);
38 static bool isSet();
39 static Kokkos::Random_XorShift64_Pool<typename Kokkos::CudaSpace::execution_space> & getPool();
40};
41#endif // KOKKOS_ENABLE_CUDA
42
43
44#ifdef KOKKOS_ENABLE_HIP
45template<>
46class Static_Random_XorShift64_Pool<typename Kokkos::HIPSpace::execution_space> {
47public:
48 static void resetPool(int mpi_rank);
49 static bool isSet();
50 static Kokkos::Random_XorShift64_Pool<typename Kokkos::HIPSpace::execution_space> & getPool();
51};
52#endif // KOKKOS_ENABLE_HIP
53
54
55#ifdef KOKKOS_ENABLE_SYCL
56template<>
57class Static_Random_XorShift64_Pool<typename Kokkos::Experimental::SYCLDeviceUSMSpace::execution_space> {
58public:
59 static void resetPool(int mpi_rank);
60 static bool isSet();
61 static Kokkos::Random_XorShift64_Pool<typename Kokkos::Experimental::SYCLDeviceUSMSpace::execution_space> & getPool();
62};
63#endif // KOKKOS_ENABLE_SYCL
64
65#ifdef KOKKOS_ENABLE_OPENMP
66template<>
67class Static_Random_XorShift64_Pool<typename Kokkos::OpenMP> {
68public:
69 static void resetPool(int mpi_rank);
70 static bool isSet();
71 static Kokkos::Random_XorShift64_Pool<typename Kokkos::OpenMP> & getPool();
72};
73#endif // KOKKOS_ENABLE_OPENMP
74
75#ifdef KOKKOS_ENABLE_SERIAL
76template<>
77class Static_Random_XorShift64_Pool<typename Kokkos::Serial> {
78public:
79 static void resetPool(int mpi_rank);
80 static bool isSet();
81 static Kokkos::Random_XorShift64_Pool<typename Kokkos::Serial> & getPool();
82};
83#endif // KOKKOS_ENABLE_SERIAL
84
85} // namespace Details
86} // namespace Tpetra
87
88#endif // TPETRA_DETAILS_RANDOM_HPP
Nonmember function that computes a residual Computes R = B - A * X.
Namespace Tpetra contains the class and methods constituting the Tpetra library.