Reference documentation for deal.II version 9.0.0
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 at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_process_grid_h
17 #define dealii_process_grid_h
18 
19 #include <deal.II/base/config.h>
20 #include <deal.II/base/mpi.h>
21 #include <deal.II/base/exceptions.h>
22 
23 #ifdef DEAL_II_WITH_SCALAPACK
24 
25 DEAL_II_NAMESPACE_OPEN
26 
27 
28 // Forward declaration of class ScaLAPACKMatrix for ProcessGrid
29 template <typename NumberType> class ScaLAPACKMatrix;
30 
31 
32 namespace Utilities
33 {
34  namespace MPI
35  {
61  {
62  public:
63 
67  template <typename NumberType> friend class ::ScaLAPACKMatrix;
68 
75  const unsigned int n_rows,
76  const unsigned int n_columns);
77 
95  const unsigned int n_rows_matrix,
96  const unsigned int n_columns_matrix,
97  const unsigned int row_block_size,
98  const unsigned int column_block_size);
99 
103  ~ProcessGrid();
104 
108  unsigned int get_process_grid_rows() const;
109 
113  unsigned int get_process_grid_columns() const;
114 
120  template <typename NumberType>
121  void send_to_inactive(NumberType *value, const int count=1) const;
122 
126  bool is_process_active() const;
127 
128  private:
129 
133  ProcessGrid(MPI_Comm mpi_communicator,
134  const std::pair<unsigned int,unsigned int> &grid_dimensions);
135 
140 
145 
151 
155  const unsigned int this_mpi_process;
156 
160  const unsigned int n_mpi_processes;
161 
166 
171 
178 
185 
190  };
191 
192  /*----------------------- Inline functions ----------------------------------*/
193 
194 #ifndef DOXYGEN
195 
196  inline
197  unsigned int ProcessGrid::get_process_grid_rows() const
198  {
199  return n_process_rows;
200  }
201 
202 
203 
204  inline
205  unsigned int ProcessGrid::get_process_grid_columns() const
206  {
207  return n_process_columns;
208  }
209 
210 
211 
212  inline
213  bool ProcessGrid::is_process_active() const
214  {
215  return mpi_process_is_active;
216  }
217 
218 
219 #endif // ifndef DOXYGEN
220 
221  } // end of namespace MPI
222 
223 } // end of namespace Utilities
224 
225 
226 DEAL_II_NAMESPACE_CLOSE
227 
228 #endif // DEAL_II_WITH_SCALAPACK
229 
230 #endif
unsigned int get_process_grid_rows() const
const unsigned int this_mpi_process
Definition: process_grid.h:155
MPI_Comm mpi_communicator_inactive_with_root
Definition: process_grid.h:144
void send_to_inactive(NumberType *value, const int count=1) const
unsigned int get_process_grid_columns() const
Definition: cuda.h:31
const unsigned int n_mpi_processes
Definition: process_grid.h:160
ProcessGrid(MPI_Comm mpi_communicator, const unsigned int n_rows, const unsigned int n_columns)