Reference documentation for deal.II version Git ca0b05a7a7 2020-12-01 11:49:21 -0500
\(\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 - 2020 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  face(const std::pair<unsigned int, unsigned int> &face_range) = 0;
85 
88  virtual void
89  boundary(const std::pair<unsigned int, unsigned int> &face_range) = 0;
90  };
91 
92 
93 
94  namespace MatrixFreeFunctions
95  {
101  struct TaskInfo
102  {
103  // enum for choice of how to build the task graph. Odd add versions with
104  // preblocking and even versions with postblocking. partition_partition
105  // and partition_color are deprecated but kept for backward
106  // compatibility.
108  {
112  color
113  };
114 
118  TaskInfo();
119 
124  void
125  clear();
126 
130  void
131  loop(MFWorkerInterface &worker) const;
132 
137  void
138  make_boundary_cells_divisible(std::vector<unsigned int> &boundary_cells);
139 
182  void
183  create_blocks_serial(
184  const std::vector<unsigned int> &cells_with_comm,
185  const unsigned int dofs_per_cell,
186  const bool categories_are_hp,
187  const std::vector<unsigned int> &cell_vectorization_categories,
188  const bool cell_vectorization_categories_strict,
189  const std::vector<unsigned int> &parent_relation,
190  std::vector<unsigned int> & renumbering,
191  std::vector<unsigned char> & incompletely_filled_vectorization);
192 
210  void
211  initial_setup_blocks_tasks(
212  const std::vector<unsigned int> &boundary_cells,
213  std::vector<unsigned int> & renumbering,
214  std::vector<unsigned char> & incompletely_filled_vectorization);
215 
222  void
223  guess_block_size(const unsigned int dofs_per_cell);
224 
251  void
252  make_thread_graph_partition_color(
253  DynamicSparsityPattern & connectivity,
254  std::vector<unsigned int> & renumbering,
255  std::vector<unsigned char> &irregular_cells,
256  const bool hp_bool);
257 
290  void
291  make_thread_graph_partition_partition(
292  const std::vector<unsigned int> &cell_active_fe_index,
293  DynamicSparsityPattern & connectivity,
294  std::vector<unsigned int> & renumbering,
295  std::vector<unsigned char> & irregular_cells,
296  const bool hp_bool);
297 
321  void
322  make_thread_graph(const std::vector<unsigned int> &cell_active_fe_index,
323  DynamicSparsityPattern & connectivity,
324  std::vector<unsigned int> & renumbering,
325  std::vector<unsigned char> & irregular_cells,
326  const bool hp_bool);
327 
332  void
333  make_connectivity_cells_to_blocks(
334  const std::vector<unsigned char> &irregular_cells,
335  const DynamicSparsityPattern & connectivity_cells,
336  DynamicSparsityPattern & connectivity_blocks) const;
337 
342  void
343  make_coloring_within_partitions_pre_blocked(
344  const DynamicSparsityPattern & connectivity,
345  const unsigned int partition,
346  const std::vector<unsigned int> &cell_partition,
347  const std::vector<unsigned int> &partition_list,
348  const std::vector<unsigned int> &partition_size,
349  std::vector<unsigned int> & partition_color_list);
350 
355  void
356  make_partitioning_within_partitions_post_blocked(
357  const DynamicSparsityPattern & connectivity,
358  const std::vector<unsigned int> &cell_active_fe_index,
359  const unsigned int partition,
360  const unsigned int cluster_size,
361  const bool hp_bool,
362  const std::vector<unsigned int> &cell_partition,
363  const std::vector<unsigned int> &partition_list,
364  const std::vector<unsigned int> &partition_size,
365  std::vector<unsigned int> & partition_partition_list,
366  std::vector<unsigned char> & irregular_cells);
367 
388  void
389  make_partitioning(const DynamicSparsityPattern &connectivity,
390  const unsigned int cluster_size,
391  std::vector<unsigned int> & cell_partition,
392  std::vector<unsigned int> & partition_list,
393  std::vector<unsigned int> & partition_size,
394  unsigned int & partition) const;
395 
400  void
401  update_task_info(const unsigned int partition);
402 
406  void
407  create_flow_graph();
408 
412  std::size_t
413  memory_consumption() const;
414 
419  template <typename StreamType>
420  void
421  print_memory_statistics(StreamType &out, std::size_t data_length) const;
422 
427  unsigned int n_active_cells;
428 
433  unsigned int n_ghost_cells;
434 
438  unsigned int vectorization_length;
439 
443  unsigned int block_size;
444 
448  unsigned int n_blocks;
449 
454 
461  std::vector<unsigned int> partition_row_index;
462 
469  std::vector<unsigned int> cell_partition_data;
470 
478  std::vector<unsigned int> face_partition_data;
479 
487  std::vector<unsigned int> boundary_partition_data;
488 
497  std::vector<unsigned int> ghost_face_partition_data;
498 
508  std::vector<unsigned int> refinement_edge_face_partition_data;
509 
514  std::vector<unsigned int> partition_evens;
515 
520  std::vector<unsigned int> partition_odds;
521 
526  std::vector<unsigned int> partition_n_blocked_workers;
527 
532  std::vector<unsigned int> partition_n_workers;
533 
538  unsigned int evens;
539 
544  unsigned int odds;
545 
550  unsigned int n_blocked_workers;
551 
555  unsigned int n_workers;
556 
561  std::vector<unsigned char> task_at_mpi_boundary;
562 
567 
572 
576  unsigned int my_pid;
577 
581  unsigned int n_procs;
582  };
583 
584  } // end of namespace MatrixFreeFunctions
585 } // end of namespace internal
586 
588 
589 #endif
virtual ~MFWorkerInterface()=default
std::vector< unsigned int > ghost_face_partition_data
Definition: task_info.h:497
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
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 > partition_row_index
Definition: task_info.h:461
std::vector< unsigned int > partition_n_workers
Definition: task_info.h:532
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:469
std::vector< unsigned int > partition_n_blocked_workers
Definition: task_info.h:526
std::vector< unsigned int > refinement_edge_face_partition_data
Definition: task_info.h:508
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:487
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:372
virtual void zero_dst_vector_range(const unsigned int range_index)=0
virtual void boundary(const std::pair< unsigned int, unsigned int > &face_range)=0
std::vector< unsigned char > task_at_mpi_boundary
Definition: task_info.h:561
virtual void vector_update_ghosts_start()=0
Starts the communication for the update ghost values operation.
virtual void face(const std::pair< unsigned int, unsigned int > &face_range)=0
std::vector< unsigned int > face_partition_data
Definition: task_info.h:478
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:371
virtual void vector_compress_start()=0
Starts the communication for the vector compress operation.
std::vector< unsigned int > partition_odds
Definition: task_info.h:520
std::vector< unsigned int > partition_evens
Definition: task_info.h:514
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.