1#ifndef __CORE__PROBE_HPP__
2#define __CORE__PROBE_HPP__
4#include <Kokkos_Core.hpp>
5#include <biocma_cst_config.hpp>
19 template <std::
size_t buffer_size>
class Probes
24 [[nodiscard]] KOKKOS_INLINE_FUNCTION
bool set(
double val)
const;
30 [[nodiscard]] std::span<const
double>
get() const;
36 Kokkos::View<
double[buffer_size], Kokkos::LayoutRight, Kokkos::DefaultExecutionSpace>
buffer;
38 Kokkos::View<
double[buffer_size], Kokkos::LayoutRight, Kokkos::DefaultHostExecutionSpace>
49 template <std::
size_t buffer_size>
56 template <std::
size_t buffer_size>
59 const auto i = Kokkos::atomic_fetch_inc(&internal_counter());
67 this->buffer(i) = val;
84 return internal_counter() >= buffer_size;
88 Kokkos::deep_copy(buffer, 0.);
90 Kokkos::deep_copy(internal_counter, 0);
93 template <std::
size_t buffer_size>
96 Kokkos::deep_copy(host_buffer, buffer);
97 return {host_buffer.data(), std::min(buffer_size, internal_counter())};
Kokkos::View< uint64_t, Kokkos::SharedSpace > internal_counter
Definition probe.hpp:37
Probes()
Definition probe.hpp:50
bool need_export() const noexcept
Definition probe.hpp:82
std::span< const double > get() const
Definition probe.hpp:94
void clear()
Definition probe.hpp:86
Kokkos::View< double[buffer_size], Kokkos::LayoutRight, Kokkos::DefaultHostExecutionSpace > host_buffer
Definition probe.hpp:39
KOKKOS_INLINE_FUNCTION bool set(double val) const
Definition probe.hpp:57
Kokkos::View< double[buffer_size], Kokkos::LayoutRight, Kokkos::DefaultExecutionSpace > buffer
Definition probe.hpp:36
Namespace that contains classes and structures related to simulation handling.
Definition host_specific.hpp:12