fml  0.1-0
Fused Matrix Library
linalg_err.hh
1 // This file is part of fml which is released under the Boost Software
2 // License, Version 1.0. See accompanying file LICENSE or copy at
3 // https://www.boost.org/LICENSE_1_0.txt
4 
5 #ifndef FML_MPI_LINALG_LINALG_ERR_H
6 #define FML_MPI_LINALG_LINALG_ERR_H
7 #pragma once
8 
9 
10 #include <stdexcept>
11 
12 #include "../mpimat.hh"
13 
14 
15 namespace fml
16 {
17 namespace linalg
18 {
19  namespace err
20  {
21  template <class T>
22  void check_grid(const T &a){}
23 
24  template <class T, class S>
25  void check_grid(const T &a, const S &b)
26  {
27  if (a.get_grid().ictxt() != b.get_grid().ictxt())
28  throw std::runtime_error("mpimat objects must be distributed on the same process grid");
29  }
30 
31  template <class T, class S, typename... VAT>
32  void check_grid(const T &a, const S &b, VAT&&... vax)
33  {
34  check_grid(a, b);
35  check_grid(a, vax ...);
36  }
37  }
38 }
39 }
40 
41 
42 #endif
fml
Core namespace.
Definition: dimops.hh:10