Reference documentation for deal.II version Git e67cfc96e3 2021-10-16 16:07:33 +0200
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
task_info.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2011 - 2021 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #ifndef dealii_matrix_free_task_info_h
18 #define dealii_matrix_free_task_info_h
19 
20 
21 #include <deal.II/base/config.h>
22 
24 #include <deal.II/base/index_set.h>
26 #include <deal.II/base/tensor.h>
28 #include <deal.II/base/utilities.h>
30 
32 
33 
35 
36 
37 
38 namespace internal
39 {
45  {
46  public:
47  virtual ~MFWorkerInterface() = default;
48 
50  virtual void
52 
54  virtual void
56 
58  virtual void
60 
62  virtual void
64 
67  virtual void
68  zero_dst_vector_range(const unsigned int range_index) = 0;
69 
70  virtual void
71  cell_loop_pre_range(const unsigned int range_index) = 0;
72 
73  virtual void
74  cell_loop_post_range(const unsigned int range_index) = 0;
75 
78  virtual void
79  cell(const std::pair<unsigned int, unsigned int> &cell_range) = 0;
80 
83  virtual void
84  cell(const unsigned int range_index) = 0;
85 
88  virtual void
89  face(const unsigned int range_index) = 0;
90 
93  virtual void
94  boundary(const unsigned int range_index) = 0;
95  };
96 
97 
98 
99  namespace MatrixFreeFunctions
100  {
106  struct TaskInfo
107  {
108  // enum for choice of how to build the task graph. Odd add versions with
109  // preblocking and even versions with postblocking. partition_partition
110  // and partition_color are deprecated but kept for backward
111  // compatibility.
113  {
117  color
118  };
119 
123  TaskInfo();
124 
129  void
130  clear();
131 
135  void
136  loop(MFWorkerInterface &worker) const;
137 
142  void
143  make_boundary_cells_divisible(std::vector<unsigned int> &boundary_cells);
144 
187  void
188  create_blocks_serial(
189  const std::vector<unsigned int> &cells_with_comm,
190  const unsigned int dofs_per_cell,
191  const bool categories_are_hp,
192  const std::vector<unsigned int> &cell_vectorization_categories,
193  const bool cell_vectorization_categories_strict,
194  const std::vector<unsigned int> &parent_relation,
195  std::vector<unsigned int> & renumbering,
196  std::vector<unsigned char> & incompletely_filled_vectorization);
197 
215  void
216  initial_setup_blocks_tasks(
217  const std::vector<unsigned int> &boundary_cells,
218  std::vector<unsigned int> & renumbering,
219  std::vector<unsigned char> & incompletely_filled_vectorization);
220 
227  void
228  guess_block_size(const unsigned int dofs_per_cell);
229 
256  void
257  make_thread_graph_partition_color(
258  DynamicSparsityPattern & connectivity,
259  std::vector<unsigned int> & renumbering,
260  std::vector<unsigned char> &irregular_cells,
261  const bool hp_bool);
262 
295  void
296  make_thread_graph_partition_partition(
297  const std::vector<unsigned int> &cell_active_fe_index,
298  DynamicSparsityPattern & connectivity,
299  std::vector<unsigned int> & renumbering,
300  std::vector<unsigned char> & irregular_cells,
301  const bool hp_bool);
302 
326  void
327  make_thread_graph(const std::vector<unsigned int> &cell_active_fe_index,
328  DynamicSparsityPattern & connectivity,
329  std::vector<unsigned int> & renumbering,
330  std::vector<unsigned char> & irregular_cells,
331  const bool hp_bool);
332 
337  void
338  make_connectivity_cells_to_blocks(
339  const std::vector<unsigned char> &irregular_cells,
340  const DynamicSparsityPattern & connectivity_cells,
341  DynamicSparsityPattern & connectivity_blocks) const;
342 
347  void
348  make_coloring_within_partitions_pre_blocked(
349  const DynamicSparsityPattern & connectivity,
350  const unsigned int partition,
351  const std::vector<unsigned int> &cell_partition,
352  const std::vector<unsigned int> &partition_list,
353  const std::vector<unsigned int> &partition_size,
354  std::vector<unsigned int> & partition_color_list);
355 
360  void
361  make_partitioning_within_partitions_post_blocked(
362  const DynamicSparsityPattern & connectivity,
363  const std::vector<unsigned int> &cell_active_fe_index,
364  const unsigned int partition,
365  const unsigned int cluster_size,
366  const bool hp_bool,
367  const std::vector<unsigned int> &cell_partition,
368  const std::vector<unsigned int> &partition_list,
369  const std::vector<unsigned int> &partition_size,
370  std::vector<unsigned int> & partition_partition_list,
371  std::vector<unsigned char> & irregular_cells);
372 
393  void
394  make_partitioning(const DynamicSparsityPattern &connectivity,
395  const unsigned int cluster_size,
396  std::vector<unsigned int> & cell_partition,
397  std::vector<unsigned int> & partition_list,
398  std::vector<unsigned int> & partition_size,
399  unsigned int & partition) const;
400 
405  void
406  update_task_info(const unsigned int partition);
407 
411  void
412  create_flow_graph();
413 
417  std::size_t
418  memory_consumption() const;
419 
424  template <typename StreamType>
425  void
426  print_memory_statistics(StreamType &out, std::size_t data_length) const;
427 
432  unsigned int n_active_cells;
433 
438  unsigned int n_ghost_cells;
439 
443  unsigned int vectorization_length;
444 
448  unsigned int block_size;
449 
453  unsigned int n_blocks;
454 
459 
466  std::vector<unsigned int> partition_row_index;
467 
474  std::vector<unsigned int> cell_partition_data;
475 
481  std::vector<unsigned int> cell_partition_data_hp;
482 
487  std::vector<unsigned int> cell_partition_data_hp_ptr;
488 
496  std::vector<unsigned int> face_partition_data;
497 
503  std::vector<unsigned int> face_partition_data_hp;
504 
509  std::vector<unsigned int> face_partition_data_hp_ptr;
510 
518  std::vector<unsigned int> boundary_partition_data;
519 
525  std::vector<unsigned int> boundary_partition_data_hp;
526 
531  std::vector<unsigned int> boundary_partition_data_hp_ptr;
532 
541  std::vector<unsigned int> ghost_face_partition_data;
542 
552  std::vector<unsigned int> refinement_edge_face_partition_data;
553 
558  std::vector<unsigned int> partition_evens;
559 
564  std::vector<unsigned int> partition_odds;
565 
570  std::vector<unsigned int> partition_n_blocked_workers;
571 
576  std::vector<unsigned int> partition_n_workers;
577 
582  unsigned int evens;
583 
588  unsigned int odds;
589 
594  unsigned int n_blocked_workers;
595 
599  unsigned int n_workers;
600 
605  std::vector<unsigned char> task_at_mpi_boundary;
606 
611 
616 
621 
625  unsigned int my_pid;
626 
630  unsigned int n_procs;
631  };
632 
633  } // end of namespace MatrixFreeFunctions
634 } // end of namespace internal
635 
637 
638 #endif
virtual ~MFWorkerInterface()=default
std::vector< unsigned int > ghost_face_partition_data
Definition: task_info.h:541
void loop(ITERATOR begin, typename identity< ITERATOR >::type end, DOFINFO &dinfo, INFOBOX &info, const std::function< void(DOFINFO &, typename INFOBOX::CellInfo &)> &cell_worker, const std::function< void(DOFINFO &, typename INFOBOX::CellInfo &)> &boundary_worker, const std::function< void(DOFINFO &, DOFINFO &, typename INFOBOX::CellInfo &, typename INFOBOX::CellInfo &)> &face_worker, ASSEMBLER &assembler, const LoopControl &lctrl=LoopControl())
Definition: loop.h:439
virtual void cell_loop_post_range(const unsigned int range_index)=0
std::vector< unsigned int > boundary_partition_data_hp
Definition: task_info.h:525
virtual void cell_loop_pre_range(const unsigned int range_index)=0
virtual void cell(const std::pair< unsigned int, unsigned int > &cell_range)=0
std::vector< unsigned int > boundary_partition_data_hp_ptr
Definition: task_info.h:531
std::vector< unsigned int > partition_row_index
Definition: task_info.h:466
std::vector< unsigned int > partition_n_workers
Definition: task_info.h:576
virtual void vector_update_ghosts_finish()=0
Finishes the communication for the update ghost values operation.
std::vector< unsigned int > cell_partition_data
Definition: task_info.h:474
std::vector< unsigned int > partition_n_blocked_workers
Definition: task_info.h:570
std::vector< unsigned int > refinement_edge_face_partition_data
Definition: task_info.h:552
void partition(const SparsityPattern &sparsity_pattern, const unsigned int n_partitions, std::vector< unsigned int > &partition_indices, const Partitioner partitioner=Partitioner::metis)
std::vector< unsigned int > boundary_partition_data
Definition: task_info.h:518
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:401
virtual void face(const unsigned int range_index)=0
virtual void zero_dst_vector_range(const unsigned int range_index)=0
std::vector< unsigned char > task_at_mpi_boundary
Definition: task_info.h:605
std::vector< unsigned int > cell_partition_data_hp
Definition: task_info.h:481
std::vector< unsigned int > face_partition_data_hp
Definition: task_info.h:503
std::vector< unsigned int > face_partition_data_hp_ptr
Definition: task_info.h:509
virtual void vector_update_ghosts_start()=0
Starts the communication for the update ghost values operation.
std::vector< unsigned int > face_partition_data
Definition: task_info.h:496
virtual void boundary(const unsigned int range_index)=0
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:400
std::vector< unsigned int > cell_partition_data_hp_ptr
Definition: task_info.h:487
virtual void vector_compress_start()=0
Starts the communication for the vector compress operation.
std::vector< unsigned int > partition_odds
Definition: task_info.h:564
std::vector< unsigned int > partition_evens
Definition: task_info.h:558
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
virtual void vector_compress_finish()=0
Finishes the communication for the vector compress operation.