Reference documentation for deal.II version 9.1.0-pre
process_grid.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2017 - 2018 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 #ifndef dealii_process_grid_h
17 #define dealii_process_grid_h
18 
19 #include <deal.II/base/config.h>
20 
21 #include <deal.II/base/exceptions.h>
22 #include <deal.II/base/mpi.h>
23 
24 #ifdef DEAL_II_WITH_SCALAPACK
25 
26 DEAL_II_NAMESPACE_OPEN
27 
28 
29 // Forward declaration of class ScaLAPACKMatrix for ProcessGrid
30 template <typename NumberType>
32 
33 
34 namespace Utilities
35 {
36  namespace MPI
37  {
63  {
64  public:
68  template <typename NumberType>
69  friend class ::ScaLAPACKMatrix;
70 
78  const unsigned int n_rows,
79  const unsigned int n_columns);
80 
99  const unsigned int n_rows_matrix,
100  const unsigned int n_columns_matrix,
101  const unsigned int row_block_size,
102  const unsigned int column_block_size);
103 
107  ~ProcessGrid();
108 
112  unsigned int
113  get_process_grid_rows() const;
114 
118  unsigned int
119  get_process_grid_columns() const;
120 
126  template <typename NumberType>
127  void
128  send_to_inactive(NumberType *value, const int count = 1) const;
129 
133  bool
134  is_process_active() const;
135 
136  private:
141  ProcessGrid(MPI_Comm mpi_communicator,
142  const std::pair<unsigned int, unsigned int> &grid_dimensions);
143 
148 
154 
160 
164  const unsigned int this_mpi_process;
165 
169  const unsigned int n_mpi_processes;
170 
175 
180 
187 
194 
199  };
200 
201  /*--------------------- Inline functions --------------------------------*/
202 
203 # ifndef DOXYGEN
204 
205  inline unsigned int
207  {
208  return n_process_rows;
209  }
210 
211 
212 
213  inline unsigned int
215  {
216  return n_process_columns;
217  }
218 
219 
220 
221  inline bool
223  {
224  return mpi_process_is_active;
225  }
226 
227 
228 # endif // ifndef DOXYGEN
229 
230  } // end of namespace MPI
231 
232 } // end of namespace Utilities
233 
234 
235 DEAL_II_NAMESPACE_CLOSE
236 
237 #endif // DEAL_II_WITH_SCALAPACK
238 
239 #endif
void send_to_inactive(NumberType *value, const int count=1) const
const unsigned int this_mpi_process
Definition: process_grid.h:164
bool is_process_active() const
MPI_Comm mpi_communicator_inactive_with_root
Definition: process_grid.h:153
unsigned int get_process_grid_columns() const
Definition: cuda.h:32
const unsigned int n_mpi_processes
Definition: process_grid.h:169
ProcessGrid(MPI_Comm mpi_communicator, const unsigned int n_rows, const unsigned int n_columns)
unsigned int get_process_grid_rows() const