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