1#ifndef __SIMULATION_KERNELS_HPP__
2#define __SIMULATION_KERNELS_HPP__
5#include <Kokkos_Core_fwd.hpp>
6#include <common/common.hpp>
7#include <common/kokkos_getpolicy.hpp>
8#include <impl/Kokkos_Profiling.hpp>
9#include <mc/domain.hpp>
11#include <simulation/kernels/contribution_kernel.hpp>
12#include <simulation/kernels/model_kernel.hpp>
13#include <simulation/kernels/move_kernel.hpp>
15#include <common/execinfo.hpp>
21 template <
typename Space>
24 template <
typename Space>
27 template <
typename Space, ModelType Model>
struct CycleFunctors
58 const bool enable_leave = new_move.leaving_flow.size() != 0;
85 = Kokkos::create_mirror_view_and_copy(HostSpace(),
cycle_reducer)();
87 const auto host_out_counter
88 = Kokkos::create_mirror_view_and_copy(HostSpace(),
move_reducer)();
90 return std::tuple(host_red, host_out_counter);
110 options.m_p_p_team_leave,
138 std::size_t npt =
m_options.m_p_p_team_move;
140 if (n_particle <= npt)
150 static_cast<int>(league_size),
154 cycle_policy.set_scratch_size(0,
155 Kokkos::PerTeam(
sizeof(
float) * npt * 2));
157 Kokkos ::parallel_for(
"cycle_move", cycle_policy,
move_kernel);
164 if (n_particle <= npt)
177 static_cast<int>(league_size),
181 Kokkos::parallel_reduce(
188 static_cast<int>(league_size),
195 Kokkos::parallel_reduce(
205 std::size_t npt =
m_options.m_p_p_team_model;
207 if (n_particle <= npt)
237 std::size_t npt =
m_options.m_p_p_team_contribs;
238 if (n_particle <= npt)
246 "ModelType:Constapply_weight()");
251 const auto policy_contribs
252 = Kokkos::TeamPolicy<typename ContributionFunctor<Model>::Tag3D>(
253 model_space, league_size, Kokkos::AUTO(), Kokkos::AUTO());
254 Kokkos::parallel_for(
260 = Kokkos::TeamPolicy<typename ContributionFunctor<Model>::Tag0D>(
261 model_space, league_size, Kokkos::AUTO(), Kokkos::AUTO());
262 policy_contribs.set_scratch_size(
263 0, Kokkos::PerTeam(
sizeof(
float) * Model::n_c));
264 Kokkos::parallel_for(
Main owning object for Monte-Carlo particles.
Definition particles_container.hpp:57
KOKKOS_INLINE_FUNCTION std::size_t n_particles() const
Gets the number of particles in the container.
Definition particles_container.hpp:448
MC::ParticlePositions position
Definition particles_container.hpp:84
ParticleAges ages
Definition particles_container.hpp:87
MC::ParticleStatus status
Definition particles_container.hpp:85
Kokkos::View< value_type, Space > result_view_type
Definition model_kernel.hpp:60
Concept to check if a model type has uniform_weight
Definition traits.hpp:203
std::size_t c_league_size(std::size_t n_tot, std::size_t n_per_team) noexcept
Definition common.cpp:17
decltype(Kokkos::Experimental::create_scatter_view( kernelContribution())) ContributionView
Definition alias.hpp:162
gen_pool_type< Kokkos::DefaultExecutionSpace > pool_type
Definition alias.hpp:100
Kokkos::View< const double **, Kokkos::LayoutLeft, ComputeSpace, Kokkos::MemoryTraits< Kokkos::RandomAccess > > KernelConcentrationType
Definition alias.hpp:165
Definition kernels.hpp:19
constexpr bool enable_leave
Definition move_kernel.hpp:24
KernelInline::CycleReducer< Space >::result_view_type cycle_reducer_view_type
Definition kernels.hpp:22
constexpr bool enable_move
Definition move_kernel.hpp:27
Kokkos::View< std::size_t, Space > move_reducer_view_type
Definition kernels.hpp:24
Probes< AutoGenerated::probe_buffer_size > ProbeAutogeneratedBuffer
Definition probe.hpp:150
Definition contribution_kernel.hpp:11
Definition execinfo.hpp:12
Structure to store information about domain needed during MC cycle data is likely to change between e...
Definition domain.hpp:29
Use to count events that occurs during Monte-Carlo processing cycles.
Definition events.hpp:151
Definition model_kernel.hpp:124
CycleFunctor< Model > cycle_kernel_type
Definition kernels.hpp:30
cycle_kernel_type cycle_kernel
Definition kernels.hpp:39
ComputeSpace model_space
Definition kernels.hpp:35
MoveFunctor move_kernel_type
Definition kernels.hpp:31
bool f_multi_compartment
Definition kernels.hpp:48
move_kernel_type move_kernel
Definition kernels.hpp:40
void launch_model(const std::size_t n_particle)
Definition kernels.hpp:201
auto get_host_reduction()
Definition kernels.hpp:81
KernelDispatchOptions m_options
Definition kernels.hpp:46
ComputeSpace move_space
Definition kernels.hpp:33
cycle_reducer_view_type< Space > cycle_reducer
Definition kernels.hpp:37
move_reducer_view_type< Space > move_reducer
Definition kernels.hpp:38
void launch_move(const std::size_t n_particle)
Definition kernels.hpp:131
Model FModel
Definition kernels.hpp:28
ContributionFunctor< Model > contribution_kernel
Definition kernels.hpp:42
void update(const double d_t, MC::ParticlesContainer< Model > container, MC::DomainState< ComputeSpace > &&new_move)
Definition kernels.hpp:51
Definition move_kernel.hpp:115