Reference documentation for deal.II version GIT d77e5ebb0a 2023-01-27 22:35:02+00:00
\(\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 
25 #include <deal.II/base/mpi_stub.h>
26 #include <deal.II/base/tensor.h>
28 
29 
31 
32 
33 // forward declaration
34 #ifndef DOXYGEN
36 #endif
37 
38 
39 namespace internal
40 {
46  {
47  public:
48  virtual ~MFWorkerInterface() = default;
49 
51  virtual void
53 
55  virtual void
57 
59  virtual void
61 
63  virtual void
65 
68  virtual void
69  zero_dst_vector_range(const unsigned int range_index) = 0;
70 
71  virtual void
72  cell_loop_pre_range(const unsigned int range_index) = 0;
73 
74  virtual void
75  cell_loop_post_range(const unsigned int range_index) = 0;
76 
79  virtual void
80  cell(const std::pair<unsigned int, unsigned int> &cell_range) = 0;
81 
84  virtual void
85  cell(const unsigned int range_index) = 0;
86 
89  virtual void
90  face(const unsigned int range_index) = 0;
91 
94  virtual void
95  boundary(const unsigned int range_index) = 0;
96  };
97 
98 
99 
100  namespace MatrixFreeFunctions
101  {
107  struct TaskInfo
108  {
109  // enum for choice of how to build the task graph. Odd add versions with
110  // preblocking and even versions with postblocking. partition_partition
111  // and partition_color are deprecated but kept for backward
112  // compatibility.
114  {
118  color
119  };
120 
124  TaskInfo();
125 
130  void
131  clear();
132 
136  void
137  loop(MFWorkerInterface &worker) const;
138 
143  void
144  make_boundary_cells_divisible(std::vector<unsigned int> &boundary_cells);
145 
188  void
190  const std::vector<unsigned int> &cells_with_comm,
191  const unsigned int dofs_per_cell,
192  const bool categories_are_hp,
193  const std::vector<unsigned int> &cell_vectorization_categories,
194  const bool cell_vectorization_categories_strict,
195  const std::vector<unsigned int> &parent_relation,
196  std::vector<unsigned int> & renumbering,
197  std::vector<unsigned char> & incompletely_filled_vectorization);
198 
216  void
218  const std::vector<unsigned int> &boundary_cells,
219  std::vector<unsigned int> & renumbering,
220  std::vector<unsigned char> & incompletely_filled_vectorization);
221 
228  void
229  guess_block_size(const unsigned int dofs_per_cell);
230 
257  void
259  DynamicSparsityPattern & connectivity,
260  std::vector<unsigned int> & renumbering,
261  std::vector<unsigned char> &irregular_cells,
262  const bool hp_bool);
263 
296  void
298  const std::vector<unsigned int> &cell_active_fe_index,
299  DynamicSparsityPattern & connectivity,
300  std::vector<unsigned int> & renumbering,
301  std::vector<unsigned char> & irregular_cells,
302  const bool hp_bool);
303 
327  void
328  make_thread_graph(const std::vector<unsigned int> &cell_active_fe_index,
329  DynamicSparsityPattern & connectivity,
330  std::vector<unsigned int> & renumbering,
331  std::vector<unsigned char> & irregular_cells,
332  const bool hp_bool);
333 
338  void
340  const std::vector<unsigned char> &irregular_cells,
341  const DynamicSparsityPattern & connectivity_cells,
342  DynamicSparsityPattern & connectivity_blocks) const;
343 
348  void
350  const DynamicSparsityPattern & connectivity,
351  const unsigned int partition,
352  const std::vector<unsigned int> &cell_partition,
353  const std::vector<unsigned int> &partition_list,
354  const std::vector<unsigned int> &partition_size,
355  std::vector<unsigned int> & partition_color_list);
356 
361  void
363  const DynamicSparsityPattern & connectivity,
364  const std::vector<unsigned int> &cell_active_fe_index,
365  const unsigned int partition,
366  const unsigned int cluster_size,
367  const bool hp_bool,
368  const std::vector<unsigned int> &cell_partition,
369  const std::vector<unsigned int> &partition_list,
370  const std::vector<unsigned int> &partition_size,
371  std::vector<unsigned int> & partition_partition_list,
372  std::vector<unsigned char> & irregular_cells);
373 
394  void
395  make_partitioning(const DynamicSparsityPattern &connectivity,
396  const unsigned int cluster_size,
397  std::vector<unsigned int> & cell_partition,
398  std::vector<unsigned int> & partition_list,
399  std::vector<unsigned int> & partition_size,
400  unsigned int & partition) const;
401 
406  void
407  update_task_info(const unsigned int partition);
408 
412  void
414 
418  std::size_t
419  memory_consumption() const;
420 
425  template <typename StreamType>
426  void
427  print_memory_statistics(StreamType &out, std::size_t data_length) const;
428 
433  unsigned int n_active_cells;
434 
439  unsigned int n_ghost_cells;
440 
444  unsigned int vectorization_length;
445 
449  unsigned int block_size;
450 
454  unsigned int n_blocks;
455 
460 
467  std::vector<unsigned int> partition_row_index;
468 
475  std::vector<unsigned int> cell_partition_data;
476 
482  std::vector<unsigned int> cell_partition_data_hp;
483 
488  std::vector<unsigned int> cell_partition_data_hp_ptr;
489 
497  std::vector<unsigned int> face_partition_data;
498 
504  std::vector<unsigned int> face_partition_data_hp;
505 
510  std::vector<unsigned int> face_partition_data_hp_ptr;
511 
519  std::vector<unsigned int> boundary_partition_data;
520 
526  std::vector<unsigned int> boundary_partition_data_hp;
527 
532  std::vector<unsigned int> boundary_partition_data_hp_ptr;
533 
542  std::vector<unsigned int> ghost_face_partition_data;
543 
553  std::vector<unsigned int> refinement_edge_face_partition_data;
554 
559  std::vector<unsigned int> partition_evens;
560 
565  std::vector<unsigned int> partition_odds;
566 
571  std::vector<unsigned int> partition_n_blocked_workers;
572 
577  std::vector<unsigned int> partition_n_workers;
578 
583  unsigned int evens;
584 
589  unsigned int odds;
590 
595  unsigned int n_blocked_workers;
596 
600  unsigned int n_workers;
601 
606  std::vector<unsigned char> task_at_mpi_boundary;
607 
611  MPI_Comm communicator;
612 
616  MPI_Comm communicator_sm;
617 
622 
626  unsigned int my_pid;
627 
631  unsigned int n_procs;
632  };
633 
634  } // end of namespace MatrixFreeFunctions
635 } // end of namespace internal
636 
638 
639 #endif
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:461
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:462
void partition(const SparsityPattern &sparsity_pattern, const unsigned int n_partitions, std::vector< unsigned int > &partition_indices, const Partitioner partitioner=Partitioner::metis)
virtual void face(const unsigned int range_index)=0
virtual void zero_dst_vector_range(const unsigned int range_index)=0
virtual void cell(const std::pair< unsigned int, unsigned int > &cell_range)=0
virtual void boundary(const unsigned int range_index)=0
virtual void vector_compress_start()=0
Starts the communication for the vector compress operation.
virtual void cell(const unsigned int range_index)=0
virtual void cell_loop_post_range(const unsigned int range_index)=0
virtual void vector_update_ghosts_start()=0
Starts the communication for the update ghost values operation.
virtual ~MFWorkerInterface()=default
virtual void cell_loop_pre_range(const unsigned int range_index)=0
virtual void vector_update_ghosts_finish()=0
Finishes the communication for the update ghost values operation.
virtual void vector_compress_finish()=0
Finishes the communication for the vector compress operation.
std::vector< unsigned int > face_partition_data_hp_ptr
Definition: task_info.h:510
std::size_t memory_consumption() const
Definition: task_info.cc:706
std::vector< unsigned int > boundary_partition_data_hp
Definition: task_info.h:526
std::vector< unsigned int > boundary_partition_data
Definition: task_info.h:519
void loop(MFWorkerInterface &worker) const
Definition: task_info.cc:351
std::vector< unsigned char > task_at_mpi_boundary
Definition: task_info.h:606
std::vector< unsigned int > face_partition_data_hp
Definition: task_info.h:504
void make_thread_graph_partition_color(DynamicSparsityPattern &connectivity, std::vector< unsigned int > &renumbering, std::vector< unsigned char > &irregular_cells, const bool hp_bool)
Definition: task_info.cc:1245
std::vector< unsigned int > refinement_edge_face_partition_data
Definition: task_info.h:553
std::vector< unsigned int > partition_n_workers
Definition: task_info.h:577
void create_blocks_serial(const std::vector< unsigned int > &cells_with_comm, const unsigned int dofs_per_cell, const bool categories_are_hp, const std::vector< unsigned int > &cell_vectorization_categories, const bool cell_vectorization_categories_strict, const std::vector< unsigned int > &parent_relation, std::vector< unsigned int > &renumbering, std::vector< unsigned char > &incompletely_filled_vectorization)
Definition: task_info.cc:795
void make_connectivity_cells_to_blocks(const std::vector< unsigned char > &irregular_cells, const DynamicSparsityPattern &connectivity_cells, DynamicSparsityPattern &connectivity_blocks) const
Definition: task_info.cc:1655
void make_partitioning_within_partitions_post_blocked(const DynamicSparsityPattern &connectivity, const std::vector< unsigned int > &cell_active_fe_index, const unsigned int partition, const unsigned int cluster_size, const bool hp_bool, const std::vector< unsigned int > &cell_partition, const std::vector< unsigned int > &partition_list, const std::vector< unsigned int > &partition_size, std::vector< unsigned int > &partition_partition_list, std::vector< unsigned char > &irregular_cells)
Definition: task_info.cc:1699
void initial_setup_blocks_tasks(const std::vector< unsigned int > &boundary_cells, std::vector< unsigned int > &renumbering, std::vector< unsigned char > &incompletely_filled_vectorization)
Definition: task_info.cc:1151
void print_memory_statistics(StreamType &out, std::size_t data_length) const
Definition: task_info.cc:691
void make_coloring_within_partitions_pre_blocked(const DynamicSparsityPattern &connectivity, const unsigned int partition, const std::vector< unsigned int > &cell_partition, const std::vector< unsigned int > &partition_list, const std::vector< unsigned int > &partition_size, std::vector< unsigned int > &partition_color_list)
Definition: task_info.cc:2020
std::vector< unsigned int > partition_row_index
Definition: task_info.h:467
void make_thread_graph_partition_partition(const std::vector< unsigned int > &cell_active_fe_index, DynamicSparsityPattern &connectivity, std::vector< unsigned int > &renumbering, std::vector< unsigned char > &irregular_cells, const bool hp_bool)
Definition: task_info.cc:1587
std::vector< unsigned int > partition_evens
Definition: task_info.h:559
void make_thread_graph(const std::vector< unsigned int > &cell_active_fe_index, DynamicSparsityPattern &connectivity, std::vector< unsigned int > &renumbering, std::vector< unsigned char > &irregular_cells, const bool hp_bool)
Definition: task_info.cc:1392
std::vector< unsigned int > partition_n_blocked_workers
Definition: task_info.h:571
std::vector< unsigned int > cell_partition_data_hp
Definition: task_info.h:482
std::vector< unsigned int > cell_partition_data_hp_ptr
Definition: task_info.h:488
std::vector< unsigned int > cell_partition_data
Definition: task_info.h:475
void make_partitioning(const DynamicSparsityPattern &connectivity, const unsigned int cluster_size, std::vector< unsigned int > &cell_partition, std::vector< unsigned int > &partition_list, std::vector< unsigned int > &partition_size, unsigned int &partition) const
Definition: task_info.cc:2096
void update_task_info(const unsigned int partition)
Definition: task_info.cc:2325
void make_boundary_cells_divisible(std::vector< unsigned int > &boundary_cells)
Definition: task_info.cc:723
std::vector< unsigned int > ghost_face_partition_data
Definition: task_info.h:542
void guess_block_size(const unsigned int dofs_per_cell)
Definition: task_info.cc:1217
std::vector< unsigned int > boundary_partition_data_hp_ptr
Definition: task_info.h:532
std::vector< unsigned int > partition_odds
Definition: task_info.h:565
std::vector< unsigned int > face_partition_data
Definition: task_info.h:497