Reference documentation for deal.II version GIT 6bdf9a4b6c 2022-08-12 19:20: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.h>
26 #include <deal.II/base/tensor.h>
27 #include <deal.II/base/utilities.h>
29 
30 
32 
33 
34 // forward declaration
35 #ifndef DOXYGEN
37 #endif
38 
39 
40 namespace internal
41 {
47  {
48  public:
49  virtual ~MFWorkerInterface() = default;
50 
52  virtual void
54 
56  virtual void
58 
60  virtual void
62 
64  virtual void
66 
69  virtual void
70  zero_dst_vector_range(const unsigned int range_index) = 0;
71 
72  virtual void
73  cell_loop_pre_range(const unsigned int range_index) = 0;
74 
75  virtual void
76  cell_loop_post_range(const unsigned int range_index) = 0;
77 
80  virtual void
81  cell(const std::pair<unsigned int, unsigned int> &cell_range) = 0;
82 
85  virtual void
86  cell(const unsigned int range_index) = 0;
87 
90  virtual void
91  face(const unsigned int range_index) = 0;
92 
95  virtual void
96  boundary(const unsigned int range_index) = 0;
97  };
98 
99 
100 
101  namespace MatrixFreeFunctions
102  {
108  struct TaskInfo
109  {
110  // enum for choice of how to build the task graph. Odd add versions with
111  // preblocking and even versions with postblocking. partition_partition
112  // and partition_color are deprecated but kept for backward
113  // compatibility.
115  {
119  color
120  };
121 
125  TaskInfo();
126 
131  void
132  clear();
133 
137  void
138  loop(MFWorkerInterface &worker) const;
139 
144  void
145  make_boundary_cells_divisible(std::vector<unsigned int> &boundary_cells);
146 
189  void
191  const std::vector<unsigned int> &cells_with_comm,
192  const unsigned int dofs_per_cell,
193  const bool categories_are_hp,
194  const std::vector<unsigned int> &cell_vectorization_categories,
195  const bool cell_vectorization_categories_strict,
196  const std::vector<unsigned int> &parent_relation,
197  std::vector<unsigned int> & renumbering,
198  std::vector<unsigned char> & incompletely_filled_vectorization);
199 
217  void
219  const std::vector<unsigned int> &boundary_cells,
220  std::vector<unsigned int> & renumbering,
221  std::vector<unsigned char> & incompletely_filled_vectorization);
222 
229  void
230  guess_block_size(const unsigned int dofs_per_cell);
231 
258  void
260  DynamicSparsityPattern & connectivity,
261  std::vector<unsigned int> & renumbering,
262  std::vector<unsigned char> &irregular_cells,
263  const bool hp_bool);
264 
297  void
299  const std::vector<unsigned int> &cell_active_fe_index,
300  DynamicSparsityPattern & connectivity,
301  std::vector<unsigned int> & renumbering,
302  std::vector<unsigned char> & irregular_cells,
303  const bool hp_bool);
304 
328  void
329  make_thread_graph(const std::vector<unsigned int> &cell_active_fe_index,
330  DynamicSparsityPattern & connectivity,
331  std::vector<unsigned int> & renumbering,
332  std::vector<unsigned char> & irregular_cells,
333  const bool hp_bool);
334 
339  void
341  const std::vector<unsigned char> &irregular_cells,
342  const DynamicSparsityPattern & connectivity_cells,
343  DynamicSparsityPattern & connectivity_blocks) const;
344 
349  void
351  const DynamicSparsityPattern & connectivity,
352  const unsigned int partition,
353  const std::vector<unsigned int> &cell_partition,
354  const std::vector<unsigned int> &partition_list,
355  const std::vector<unsigned int> &partition_size,
356  std::vector<unsigned int> & partition_color_list);
357 
362  void
364  const DynamicSparsityPattern & connectivity,
365  const std::vector<unsigned int> &cell_active_fe_index,
366  const unsigned int partition,
367  const unsigned int cluster_size,
368  const bool hp_bool,
369  const std::vector<unsigned int> &cell_partition,
370  const std::vector<unsigned int> &partition_list,
371  const std::vector<unsigned int> &partition_size,
372  std::vector<unsigned int> & partition_partition_list,
373  std::vector<unsigned char> & irregular_cells);
374 
395  void
396  make_partitioning(const DynamicSparsityPattern &connectivity,
397  const unsigned int cluster_size,
398  std::vector<unsigned int> & cell_partition,
399  std::vector<unsigned int> & partition_list,
400  std::vector<unsigned int> & partition_size,
401  unsigned int & partition) const;
402 
407  void
408  update_task_info(const unsigned int partition);
409 
413  void
415 
419  std::size_t
420  memory_consumption() const;
421 
426  template <typename StreamType>
427  void
428  print_memory_statistics(StreamType &out, std::size_t data_length) const;
429 
434  unsigned int n_active_cells;
435 
440  unsigned int n_ghost_cells;
441 
445  unsigned int vectorization_length;
446 
450  unsigned int block_size;
451 
455  unsigned int n_blocks;
456 
461 
468  std::vector<unsigned int> partition_row_index;
469 
476  std::vector<unsigned int> cell_partition_data;
477 
483  std::vector<unsigned int> cell_partition_data_hp;
484 
489  std::vector<unsigned int> cell_partition_data_hp_ptr;
490 
498  std::vector<unsigned int> face_partition_data;
499 
505  std::vector<unsigned int> face_partition_data_hp;
506 
511  std::vector<unsigned int> face_partition_data_hp_ptr;
512 
520  std::vector<unsigned int> boundary_partition_data;
521 
527  std::vector<unsigned int> boundary_partition_data_hp;
528 
533  std::vector<unsigned int> boundary_partition_data_hp_ptr;
534 
543  std::vector<unsigned int> ghost_face_partition_data;
544 
554  std::vector<unsigned int> refinement_edge_face_partition_data;
555 
560  std::vector<unsigned int> partition_evens;
561 
566  std::vector<unsigned int> partition_odds;
567 
572  std::vector<unsigned int> partition_n_blocked_workers;
573 
578  std::vector<unsigned int> partition_n_workers;
579 
584  unsigned int evens;
585 
590  unsigned int odds;
591 
596  unsigned int n_blocked_workers;
597 
601  unsigned int n_workers;
602 
607  std::vector<unsigned char> task_at_mpi_boundary;
608 
612  MPI_Comm communicator;
613 
617  MPI_Comm communicator_sm;
618 
623 
627  unsigned int my_pid;
628 
632  unsigned int n_procs;
633  };
634 
635  } // end of namespace MatrixFreeFunctions
636 } // end of namespace internal
637 
639 
640 #endif
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
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:511
std::size_t memory_consumption() const
Definition: task_info.cc:705
std::vector< unsigned int > boundary_partition_data_hp
Definition: task_info.h:527
std::vector< unsigned int > boundary_partition_data
Definition: task_info.h:520
void loop(MFWorkerInterface &worker) const
Definition: task_info.cc:350
std::vector< unsigned char > task_at_mpi_boundary
Definition: task_info.h:607
std::vector< unsigned int > face_partition_data_hp
Definition: task_info.h:505
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:1248
std::vector< unsigned int > refinement_edge_face_partition_data
Definition: task_info.h:554
std::vector< unsigned int > partition_n_workers
Definition: task_info.h:578
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:794
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:1658
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:1702
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:1154
void print_memory_statistics(StreamType &out, std::size_t data_length) const
Definition: task_info.cc:690
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:2023
std::vector< unsigned int > partition_row_index
Definition: task_info.h:468
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:1590
std::vector< unsigned int > partition_evens
Definition: task_info.h:560
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:1395
std::vector< unsigned int > partition_n_blocked_workers
Definition: task_info.h:572
std::vector< unsigned int > cell_partition_data_hp
Definition: task_info.h:483
std::vector< unsigned int > cell_partition_data_hp_ptr
Definition: task_info.h:489
std::vector< unsigned int > cell_partition_data
Definition: task_info.h:476
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:2099
void update_task_info(const unsigned int partition)
Definition: task_info.cc:2328
void make_boundary_cells_divisible(std::vector< unsigned int > &boundary_cells)
Definition: task_info.cc:722
std::vector< unsigned int > ghost_face_partition_data
Definition: task_info.h:543
void guess_block_size(const unsigned int dofs_per_cell)
Definition: task_info.cc:1220
std::vector< unsigned int > boundary_partition_data_hp_ptr
Definition: task_info.h:533
std::vector< unsigned int > partition_odds
Definition: task_info.h:566
std::vector< unsigned int > face_partition_data
Definition: task_info.h:498