Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
task_info.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2011 - 2019 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/exceptions.h>
22 #include <deal.II/base/index_set.h>
23 #include <deal.II/base/memory_consumption.h>
24 #include <deal.II/base/tensor.h>
25 #include <deal.II/base/thread_management.h>
26 #include <deal.II/base/utilities.h>
27 #include <deal.II/base/vectorization.h>
28 
29 #include <deal.II/lac/dynamic_sparsity_pattern.h>
30 
31 
32 DEAL_II_NAMESPACE_OPEN
33 
34 
35 
36 namespace internal
37 {
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 
72  virtual void
73  cell(const std::pair<unsigned int, unsigned int> &cell_range) = 0;
74 
77  virtual void
78  face(const std::pair<unsigned int, unsigned int> &face_range) = 0;
79 
82  virtual void
83  boundary(const std::pair<unsigned int, unsigned int> &face_range) = 0;
84  };
85 
86 
87 
88  namespace MatrixFreeFunctions
89  {
90  // forward declaration of internal data structure
91  template <typename Number>
92  struct ConstraintValues;
93 
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.
107  enum TasksParallelScheme
108  {
109  none,
110  partition_partition,
111  partition_color,
112  color
113  };
114 
118  TaskInfo();
119 
124  void
125  clear();
126 
130  void
131  loop(MFWorkerInterface &worker) const;
132 
137  void
138  collect_boundary_cells(const unsigned int n_active_cells,
139  const unsigned int n_active_and_ghost_cells,
140  const unsigned int vectorization_length,
141  std::vector<unsigned int> &boundary_cells);
142 
179  void
181  const std::vector<unsigned int> &boundary_cells,
182  const std::vector<unsigned int> &cells_close_to_boundary,
183  const unsigned int dofs_per_cell,
184  const std::vector<unsigned int> &cell_vectorization_categories,
185  const bool cell_vectorization_categories_strict,
186  std::vector<unsigned int> & renumbering,
187  std::vector<unsigned char> & incompletely_filled_vectorization);
188 
206  void
208  const std::vector<unsigned int> &boundary_cells,
209  std::vector<unsigned int> & renumbering,
210  std::vector<unsigned char> & incompletely_filled_vectorization);
211 
218  void
219  guess_block_size(const unsigned int dofs_per_cell);
220 
247  void
249  DynamicSparsityPattern & connectivity,
250  std::vector<unsigned int> & renumbering,
251  std::vector<unsigned char> &irregular_cells,
252  const bool hp_bool);
253 
286  void
288  const std::vector<unsigned int> &cell_active_fe_index,
289  DynamicSparsityPattern & connectivity,
290  std::vector<unsigned int> & renumbering,
291  std::vector<unsigned char> & irregular_cells,
292  const bool hp_bool);
293 
317  void
318  make_thread_graph(const std::vector<unsigned int> &cell_active_fe_index,
319  DynamicSparsityPattern & connectivity,
320  std::vector<unsigned int> & renumbering,
321  std::vector<unsigned char> & irregular_cells,
322  const bool hp_bool);
323 
328  void
330  const std::vector<unsigned char> &irregular_cells,
331  const DynamicSparsityPattern & connectivity_cells,
332  DynamicSparsityPattern & connectivity_blocks) const;
333 
338  void
340  const DynamicSparsityPattern & connectivity,
341  const unsigned int partition,
342  const std::vector<unsigned int> &cell_partition,
343  const std::vector<unsigned int> &partition_list,
344  const std::vector<unsigned int> &partition_size,
345  std::vector<unsigned int> & partition_color_list);
346 
351  void
353  const DynamicSparsityPattern & connectivity,
354  const std::vector<unsigned int> &cell_active_fe_index,
355  const unsigned int partition,
356  const unsigned int cluster_size,
357  const bool hp_bool,
358  const std::vector<unsigned int> &cell_partition,
359  const std::vector<unsigned int> &partition_list,
360  const std::vector<unsigned int> &partition_size,
361  std::vector<unsigned int> & partition_partition_list,
362  std::vector<unsigned char> & irregular_cells);
363 
384  void
385  make_partitioning(const DynamicSparsityPattern &connectivity,
386  const unsigned int cluster_size,
387  std::vector<unsigned int> & cell_partition,
388  std::vector<unsigned int> & partition_list,
389  std::vector<unsigned int> & partition_size,
390  unsigned int & partition) const;
391 
396  void
397  update_task_info(const unsigned int partition);
398 
402  void
404 
408  std::size_t
409  memory_consumption() const;
410 
415  template <typename StreamType>
416  void
417  print_memory_statistics(StreamType &out, std::size_t data_length) const;
418 
423  unsigned int n_active_cells;
424 
429  unsigned int n_ghost_cells;
430 
434  unsigned int vectorization_length;
435 
439  unsigned int block_size;
440 
444  unsigned int n_blocks;
445 
449  TasksParallelScheme scheme;
450 
457  std::vector<unsigned int> partition_row_index;
458 
465  std::vector<unsigned int> cell_partition_data;
466 
474  std::vector<unsigned int> face_partition_data;
475 
483  std::vector<unsigned int> boundary_partition_data;
484 
493  std::vector<unsigned int> ghost_face_partition_data;
494 
504  std::vector<unsigned int> refinement_edge_face_partition_data;
505 
510  std::vector<unsigned int> partition_evens;
511 
516  std::vector<unsigned int> partition_odds;
517 
522  std::vector<unsigned int> partition_n_blocked_workers;
523 
528  std::vector<unsigned int> partition_n_workers;
529 
534  unsigned int evens;
535 
540  unsigned int odds;
541 
546  unsigned int n_blocked_workers;
547 
551  unsigned int n_workers;
552 
557  std::vector<unsigned char> task_at_mpi_boundary;
558 
562  MPI_Comm communicator;
563 
567  unsigned int my_pid;
568 
572  unsigned int n_procs;
573  };
574 
578  using SizeInfo DEAL_II_DEPRECATED = TaskInfo;
579 
580  } // end of namespace MatrixFreeFunctions
581 } // end of namespace internal
582 
583 DEAL_II_NAMESPACE_CLOSE
584 
585 #endif
std::vector< unsigned int > ghost_face_partition_data
Definition: task_info.h:493
virtual void cell(const std::pair< unsigned int, unsigned int > &cell_range)=0
void loop(MFWorkerInterface &worker) const
Definition: task_info.cc:337
void guess_block_size(const unsigned int dofs_per_cell)
Definition: task_info.cc:1031
std::vector< unsigned int > partition_row_index
Definition: task_info.h:457
std::vector< unsigned int > partition_n_workers
Definition: task_info.h:528
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:465
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:1469
std::vector< unsigned int > partition_n_blocked_workers
Definition: task_info.h:522
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:1513
std::vector< unsigned int > refinement_edge_face_partition_data
Definition: task_info.h:504
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:1834
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:1059
void update_task_info(const unsigned int partition)
Definition: task_info.cc:2139
std::vector< unsigned int > boundary_partition_data
Definition: task_info.h:483
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:965
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
void create_blocks_serial(const std::vector< unsigned int > &boundary_cells, const std::vector< unsigned int > &cells_close_to_boundary, const unsigned int dofs_per_cell, const std::vector< unsigned int > &cell_vectorization_categories, const bool cell_vectorization_categories_strict, std::vector< unsigned int > &renumbering, std::vector< unsigned char > &incompletely_filled_vectorization)
Definition: task_info.cc:766
std::vector< unsigned char > task_at_mpi_boundary
Definition: task_info.h:557
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:474
void collect_boundary_cells(const unsigned int n_active_cells, const unsigned int n_active_and_ghost_cells, const unsigned int vectorization_length, std::vector< unsigned int > &boundary_cells)
Definition: task_info.cc:687
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:1401
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:1910
virtual void vector_compress_start()=0
Starts the communication for the vector compress operation.
std::vector< unsigned int > partition_odds
Definition: task_info.h:516
std::size_t memory_consumption() const
Definition: task_info.cc:670
std::vector< unsigned int > partition_evens
Definition: task_info.h:510
void print_memory_statistics(StreamType &out, std::size_t data_length) const
Definition: task_info.cc:655
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:1206
virtual void vector_compress_finish()=0
Finishes the communication for the vector compress operation.