deal.II version GIT relicensing-2289-g1e5549a87a 2024-12-21 21:30:00+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\}}\)
Loading...
Searching...
No Matches
task_info.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2018 - 2023 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15
16#ifndef dealii_matrix_free_task_info_h
17#define dealii_matrix_free_task_info_h
18
19
20#include <deal.II/base/config.h>
21
25#include <deal.II/base/tensor.h>
27
28
30
31
32// forward declaration
33#ifndef DOXYGEN
35#endif
36
37
38namespace 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.
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
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
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
258 DynamicSparsityPattern &connectivity,
259 std::vector<unsigned int> &renumbering,
260 std::vector<unsigned char> &irregular_cells,
261 const bool hp_bool);
262
295 void
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
339 const std::vector<unsigned char> &irregular_cells,
340 const DynamicSparsityPattern &connectivity_cells,
341 DynamicSparsityPattern &connectivity_blocks) const;
342
347 void
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
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
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
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
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
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:509
std::vector< unsigned int > boundary_partition_data_hp
Definition task_info.h:525
std::vector< unsigned int > boundary_partition_data
Definition task_info.h:518
void loop(MFWorkerInterface &worker) const
Definition task_info.cc:350
std::vector< unsigned char > task_at_mpi_boundary
Definition task_info.h:605
std::vector< unsigned int > face_partition_data_hp
Definition task_info.h:503
void make_thread_graph_partition_color(DynamicSparsityPattern &connectivity, std::vector< unsigned int > &renumbering, std::vector< unsigned char > &irregular_cells, const bool hp_bool)
std::vector< unsigned int > refinement_edge_face_partition_data
Definition task_info.h:552
std::vector< unsigned int > partition_n_workers
Definition task_info.h:576
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
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)
void initial_setup_blocks_tasks(const std::vector< unsigned int > &boundary_cells, std::vector< unsigned int > &renumbering, std::vector< unsigned char > &incompletely_filled_vectorization)
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)
std::vector< unsigned int > partition_row_index
Definition task_info.h:466
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)
std::vector< unsigned int > partition_evens
Definition task_info.h:558
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)
std::vector< unsigned int > partition_n_blocked_workers
Definition task_info.h:570
std::vector< unsigned int > cell_partition_data_hp
Definition task_info.h:481
std::vector< unsigned int > cell_partition_data_hp_ptr
Definition task_info.h:487
std::vector< unsigned int > cell_partition_data
Definition task_info.h:474
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
void update_task_info(const unsigned int partition)
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:541
void guess_block_size(const unsigned int dofs_per_cell)
std::vector< unsigned int > boundary_partition_data_hp_ptr
Definition task_info.h:531
std::vector< unsigned int > partition_odds
Definition task_info.h:564
std::vector< unsigned int > face_partition_data
Definition task_info.h:496