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
"
30
#include "
viennacl/traits/handle.hpp
"
31
32
namespace
viennacl
33
{
34
namespace
traits
35
{
36
37
// Context
39
template
<
typename
T>
40
viennacl::context
context
(T
const
& t)
41
{
42
#ifdef VIENNACL_WITH_OPENCL
43
if
(
traits::active_handle_id
(t) ==
OPENCL_MEMORY
)
44
return
viennacl::context
(traits::opencl_handle(t).
context
());
45
#endif
46
47
return
viennacl::context
(
traits::active_handle_id
(t));
48
}
49
51
inline
viennacl::context
context
(
viennacl::backend::mem_handle
const
& h)
52
{
53
#ifdef VIENNACL_WITH_OPENCL
54
if
(h.
get_active_handle_id
() ==
OPENCL_MEMORY
)
55
return
viennacl::context
(h.opencl_handle().context());
56
#endif
57
58
return
viennacl::context
(h.
get_active_handle_id
());
59
}
60
61
}
//namespace traits
62
}
//namespace viennacl
63
64
65
#endif
viennacl::OPENCL_MEMORY
Definition:
forwards.h:349
forwards.h
This file provides the forward declarations for the main types used within ViennaCL.
viennacl::traits::context
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
context.hpp
Implementation of a OpenCL-like context, which serves as a unification of {OpenMP, CUDA, OpenCL} at the user API.
viennacl::context
Represents a generic 'context' similar to an OpenCL context, but is backend-agnostic and thus also su...
Definition:
context.hpp:39
viennacl::traits::active_handle_id
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::traits::context
viennacl::context context(T const &t)
Returns an ID for the currently active memory domain of an object.
Definition:
context.hpp:40
viennacl::backend::mem_handle
Main abstraction class for multiple memory domains. Represents a buffer in either main RAM...
Definition:
mem_handle.hpp:89
handle.hpp
Extracts the underlying OpenCL handle from a vector, a matrix, an expression etc. ...
viennacl::backend::mem_handle::get_active_handle_id
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
viennacl
traits
context.hpp
Generated on Wed Jan 20 2016 22:32:39 for ViennaCL - The Vienna Computing Library by
1.8.6