ViennaCL - The Vienna Computing Library  1.5.1
context.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_TRAITS_CONTEXT_HPP_
2 #define VIENNACL_TRAITS_CONTEXT_HPP_
3 
4 /* =========================================================================
5  Copyright (c) 2010-2014, Institute for Microelectronics,
6  Institute for Analysis and Scientific Computing,
7  TU Wien.
8  Portions of this software are copyright by UChicago Argonne, LLC.
9 
10  -----------------
11  ViennaCL - The Vienna Computing Library
12  -----------------
13 
14  Project Head: Karl Rupp rupp@iue.tuwien.ac.at
15 
16  (A list of authors and contributors can be found in the PDF manual)
17 
18  License: MIT (X11), see file LICENSE in the base directory
19 ============================================================================= */
20 
25 #include <string>
26 #include <fstream>
27 #include <sstream>
28 #include "viennacl/forwards.h"
29 #include "viennacl/context.hpp"
31 
32 namespace viennacl
33 {
34  namespace traits
35  {
36  //
37  // Context
38  //
40  template <typename T>
42  {
43 #ifdef VIENNACL_WITH_OPENCL
45  return viennacl::context(traits::opencl_handle(t).context());
46 #endif
47 
49  }
50 
53  {
54 #ifdef VIENNACL_WITH_OPENCL
56  return viennacl::context(h.opencl_handle().context());
57 #endif
58 
60  }
61 
62  } //namespace traits
63 } //namespace viennacl
64 
65 
66 #endif
This file provides the forward declarations for the main types used within ViennaCL.
viennacl::context context(viennacl::backend::mem_handle const &h)
Returns an ID for the currently active memory domain of an object.
Definition: context.hpp:52
Implementation of a OpenCL-like context, which serves as a unification of {OpenMP, CUDA, OpenCL} at the user API.
Represents a generic 'context' similar to an OpenCL context, but is backend-agnostic and thus also su...
Definition: context.hpp:39
memory_types get_active_handle_id() const
Returns an ID for the currently active memory buffer. Other memory buffers might contain old or no da...
Definition: mem_handle.hpp:91
Definition: forwards.h:480
viennacl::memory_types active_handle_id(T const &obj)
Returns an ID for the currently active memory domain of an object.
Definition: handle.hpp:201
viennacl::context context(T const &t)
Returns an ID for the currently active memory domain of an object.
Definition: context.hpp:41
Main abstraction class for multiple memory domains. Represents a buffer in either main RAM...
Definition: mem_handle.hpp:62
Extracts the underlying OpenCL handle from a vector, a matrix, an expression etc. ...