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_GPU_LINALG_LINALG_ERR_H
6 #define FML_GPU_LINALG_LINALG_ERR_H
7 #pragma once
8 
9 
10 #include <stdexcept>
11 
12 #include "../arch/arch.hh"
13 
14 #include "../gpumat.hh"
15 #include "../gpuvec.hh"
16 
17 
18 namespace fml
19 {
20 namespace linalg
21 {
22  namespace err
23  {
24  template <class T>
25  void check_card(const T &a){}
26 
27  template <class T, class S>
28  void check_card(const T &a, const S &b)
29  {
30  if (a.get_card()->get_id() != b.get_card()->get_id())
31  throw std::runtime_error("gpumat/gpuvex objects must be allocated on the same gpu");
32  }
33 
34  template <class T, class S, typename... VAT>
35  void check_card(const T &a, const S &b, VAT&&... vax)
36  {
37  check_card(a, b);
38  check_card(a, vax ...);
39  }
40  }
41 }
42 }
43 
44 
45 #endif
fml
Core namespace.
Definition: dimops.hh:10