ViennaCL - The Vienna Computing Library  1.7.1
Free open-source GPU-accelerated linear algebra and solver library.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2016, 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 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
39 template<typename T>
41 {
42 #ifdef VIENNACL_WITH_OPENCL
44  return viennacl::context(traits::opencl_handle(t).context());
45 #endif
46 
48 }
49 
52 {
53 #ifdef VIENNACL_WITH_OPENCL
55  return viennacl::context(h.opencl_handle().context());
56 #endif
57 
59 }
60 
61 } //namespace traits
62 } //namespace viennacl
63 
64 
65 #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:51
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
viennacl::memory_types active_handle_id(T const &obj)
Returns an ID for the currently active memory domain of an object.
Definition: handle.hpp:218
viennacl::context context(T const &t)
Returns an ID for the currently active memory domain of an object.
Definition: context.hpp:40
Main abstraction class for multiple memory domains. Represents a buffer in either main RAM...
Definition: mem_handle.hpp:89
Extracts the underlying OpenCL handle from a vector, a matrix, an expression etc. ...
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:118