Parallel Write Data

Header file: <libs/observers/parallel_write_data.hpp> [source]

struct ParallelGridboxesRangePolicyFunc

Struct for a function-like object with operator() to call when using type as parallel_gridboxes_func object in ParallelWriteGridboxes.

Struct for a function-like object with operator() suitable for parallel_gridboxes_func object in ParallelWriteGridboxes in order to loop over gridbxoes using a kokkos range policy.

Public Functions

template<typename Functor>
inline void operator()(const Functor functor, const viewd_constgbx d_gbxs) const

Parallel loop over gridboxes using a Kokkos Range Policy.

Kokkos::parallel_for([…]) is equivalent in serial to: for (size_t ii(0); ii < d_gbxs.extent(0); ++ii){[…]}.

Note: type for Functor used in this call must have operator() with signature: void operator()(const size_t ii).

Template Parameters:

Functor – The type of the functor.

Parameters:
  • functor – The functor to be executed in parallel.

  • d_gbxs – The view of gridboxes.

struct ParallelGridboxesTeamPolicyFunc

Struct for a function-like object with operator() to call when using type as parallel_gridboxes_func object in ParallelWriteGridboxes.

Struct for a function-like object with operator() suitable for parallel_gridboxes_func object in ParallelWriteGridboxes in order to loop over gridbxoes using a kokkos team policy.

Public Functions

template<typename Functor>
inline void operator()(const Functor functor, const viewd_constgbx d_gbxs) const

Parallel loop over gridboxes using a Kokkos Team Policy.

Kokkos::parallel_for([…]) is equivalent in serial to: for (size_t ii(0); ii < d_gbxs.extent(0); ++ii){[…]}.

Note: type for Functor used in this call must have operator() with signature: void operator()(const TeamMember &team_member).

Template Parameters:

Functor – The type of the functor.

Parameters:
  • functor – The functor to be executed in parallel.

  • d_gbxs – The view of gridboxes.

template<typename Store, typename ParallelGridboxesFunc, CollectDataForDataset<Store> CollectData>
class ParallelWriteGridboxes

Struct for “ParallelWriteData” (see write_to_dataset_observer.hpp) to collect data from gridboxes in a loop (e.g. using Kokkos::parallel_for with a range or team policy) and then write that data to arrays in a dataset.

This struct is responsible for collecting data from gridboxes and writing it to arrays in a dataset with a given store.

The ParallelGridboxesFunc type is a function-like object responsible for looping over gridboxes in parallel (see ParallelGridboxesRangePolicyFunc or ParallelGridboxesTeamPolicyFunc). The CollectData type satisfies the concept for CollectDataForDataset and the signature for the operator of the type it returns from its get_functor() call should be compatible with the signature of the functor required by the ParallelGridboxesFunc type.

Template Parameters:
  • Store – The type of the data store in the dataset.

  • ParallelGridboxesFunc – Function-like object for call to loop over gridboxes.

  • CollectData – Object satisfying the CollectDataForDataset concept for the given store.

Public Functions

inline ParallelWriteGridboxes(ParallelGridboxesFunc parallel_gridboxes_func, const Dataset<Store> &dataset, CollectData collect_data)

Constructs a new ParallelWriteGridboxes object.

Parameters:
  • parallel_gridboxes_func – Function-like object for call to loop over gridboxes.

  • dataset – The dataset to write data to.

  • collect_data – The object satisfying the CollectDataForDataset concept to collect data.

inline ~ParallelWriteGridboxes()

Destructor for the ParallelWriteGridboxes class.

inline void operator()(const viewd_constgbx d_gbxs, const viewd_constsupers totsupers) const

Executes the operation to collect data from gridboxes and write it to arrays in the dataset.

Use the funtor returned by CollectData’s get_functor() call to collect data from gridboxes in a parallel loop as determined by the parallel_gridboxes_func operator().

Inclusion of totsupers in function signature so that object can be used as “ParallelWriteData” function-like object in DoWriteToDataset struct.

Parameters:
  • d_gbxs – The view of gridboxes in device memory.

  • totsupers – The view of superdroplets in device memory.

Private Members

ParallelGridboxesFunc parallel_gridboxes_func

Function-like object for call to loop over gridboxes.

const Dataset<Store> &dataset

Dataset to write data to.

CollectData collect_data

CollectData Object satisfying the CollectDataForDataset concept.

template<typename CRC, typename Store>
concept CollectRaggedCount
#include <parallel_write_data.hpp>

Concept for CollectRaggedCount is all types that have functions for writing the ragged count of superdroplet arrays to an array in a dataset.

tparam CRC:

The type that satisfies the CollectRaggedCount concept.

template<typename Store, CollectDataForDataset<Store> CollectData, CollectRaggedCount<Store> RaggedCount>
class ParallelWriteSupers

Struct for “ParallelWriteData” (see write_to_dataset_observer.hpp) to collect data from superdroplets in a (parallel) loop and then write that data to ragged arrays in a dataset.

This struct is responsible for collecting data from superdroplets and writing it to ragged arrays in a dataset with a given store.

The CollectData type satisfies the concept for CollectDataForDataset and the signature for the operator of the type it returns from its get_functor() call should be compatible with the signature of the functor required by the Kokkos::parallel_for loop over superdroplets.

Template Parameters:
  • Store – The type of data store in the dataset.

  • CollectData – The object for collecting data satsifying the CollectDataForDataset concept.

  • RaggedCount – The type of the function object for writing the ragged count variable in the dataset satisfying the CollectRaggedCount concept.

Public Functions

inline ParallelWriteSupers(const Dataset<Store> &dataset, CollectData collect_data, RaggedCount ragged_count)

Constructs a new ParallelWriteSupers object.

Parameters:
  • dataset – The dataset to write data to.

  • collect_data – Object for collecting data satsifying the CollectDataForDataset concept.

  • ragged_count – Object for writing the ragged count variable in the dataset satisfying the CollectRaggedCount concept.

inline ~ParallelWriteSupers()

Destructor for the ParallelWriteSupers class.

inline void operator()(const viewd_constgbx d_gbxs, const viewd_constsupers totsupers) const

Executes the operation to collect data from superdroplets and write it to ragged arrays in the dataset.

Use the funtor returned by CollectData’s get_functor() call to collect data from superdroplets in a parallel loop as determined by the parallel_supers_func function call. Then write the data in the dataset alongside ragged count for arrays.

Inclusion of d_gbxs in function signature so that object can be used as “ParallelWriteData” function-like object in DoWriteToDataset struct.

Parameters:
  • d_gbxs – The view of gridboxes in device memory.

  • totsupers – The view of superdroplets in device memory.

Private Functions

template<typename Functor>
inline void parallel_supers_func(const Functor functor, const viewd_constsupers totsupers) const

Parallel loop over superdroplets using a Kokkos Range Policy.

Kokkos::parallel_for([…]) is equivalent in serial to: for (size_t kk(0); kk < totsupers.extent(0); ++kk){[…]}

Note: type for Functor used in this call must have operator() with signature: void operator()(const size_t kk).

Template Parameters:

Functor – The type of the functor.

Parameters:
  • functor – The functor to be executed in parallel.

  • totsupers – The view of superdroplets on device.

Private Members

const Dataset<Store> &dataset

dataset to write data to

CollectData collect_data

functions to collect data within loop over superdroplets and write to ragged array(s)

RaggedCount ragged_count

functions to write ragged count variable to a dataset