|
28 | 28 | namespace Cajita |
29 | 29 | { |
30 | 30 |
|
| 31 | +//---------------------------------------------------------------------------// |
| 32 | +/*! |
| 33 | + Workload measurer for DynamicPartitioner. It can be customized by the user |
| 34 | + to compute workload on each rank. |
| 35 | +
|
| 36 | + \tparam Device Kokkos device type. |
| 37 | +*/ |
31 | 38 | template <typename Device> |
32 | 39 | class DynamicPartitionerWorkloadMeasurer |
33 | 40 | { |
34 | 41 | using memory_space = typename Device::memory_space; |
35 | 42 |
|
36 | 43 | public: |
37 | | - virtual void compute( Kokkos::View<int***, memory_space>& ) = 0; |
| 44 | + /*! |
| 45 | + \brief this function need to be overwrited to compute workload |
| 46 | + \param workload workload computed on each rank |
| 47 | + */ |
| 48 | + virtual void compute( Kokkos::View<int***, memory_space>& workload ) = 0; |
38 | 49 | }; |
39 | 50 |
|
40 | 51 | //---------------------------------------------------------------------------// |
@@ -769,18 +780,22 @@ class DynamicPartitioner : public BlockPartitioner<NumSpaceDim> |
769 | 780 | int _max_optimize_iteration; |
770 | 781 |
|
771 | 782 | protected: |
772 | | - // represent the rectangle partition in each dimension |
773 | | - // with form [0, p_1, ..., p_n, cell_num], n = rank num in current |
774 | | - // dimension, partition in this dimension would be [0, p_1), [p_1, p_2) ... |
775 | | - // [p_n, total_tile_num] (unit: tile) |
| 783 | + //! represent the rectangle partition in each dimension |
| 784 | + //! with form [0, p_1, ..., p_n, cell_num], n = rank num in current |
| 785 | + //! dimension, partition in this dimension would be [0, p_1), [p_1, p_2) ... |
| 786 | + //! [p_n, total_tile_num] (unit: tile) |
776 | 787 | partition_view _rectangle_partition_dev; |
777 | | - // the workload of each tile on current |
| 788 | + //! the workload of each tile on current |
778 | 789 | workload_view _workload_per_tile; |
779 | | - // 3d prefix sum of the workload of each tile on current |
| 790 | + //! 3d prefix sum of the workload of each tile on current |
780 | 791 | workload_view _workload_prefix_sum; |
781 | | - // ranks per dimension |
| 792 | + //! ranks per dimension |
782 | 793 | Kokkos::Array<int, num_space_dim> _ranks_per_dim; |
783 | 794 |
|
| 795 | + /*! |
| 796 | + \brief allocate internal data structure for the partition algorithm |
| 797 | + \param global_cells_per_dim grid size along each dimension |
| 798 | + */ |
784 | 799 | void allocate( const std::array<int, num_space_dim>& global_cells_per_dim ) |
785 | 800 | { |
786 | 801 |
|
|
0 commit comments