ViennaCL - The Vienna Computing Library: viennacl/device_specific/execute.hpp Source File

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
execute.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_DEVICE_SPECIFIC_EXECUTE_HPP
2 #define VIENNACL_DEVICE_SPECIFIC_EXECUTE_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
21
26 #include <cstring>
27 #include <vector>
28 #include <typeinfo>
29
30 #include "viennacl/scheduler/forwards.h"
31 #include "viennacl/device_specific/forwards.h"
32 #include "viennacl/device_specific/templates/template_base.hpp"
33 #include "viennacl/device_specific/tree_parsing.hpp"
34 #include "viennacl/device_specific/execution_handler.hpp"
35
36 #include "viennacl/tools/tools.hpp"
37 #include "viennacl/tools/timer.hpp"
38
39 namespace viennacl
40 {
41 namespace device_specific
42 {
43
44 inline void execute(template_base const & T, statements_container const & statements, viennacl::ocl::context & ctx = viennacl::ocl::current_context(), bool force_compilation = false)
45 {
46 //Generate program name
47 std::string program_name = tree_parsing::statements_representation(statements, BIND_TO_HANDLE);
48 execution_handler handler(program_name, ctx, ctx.current_device(), force_compilation);
49 handler.add(program_name, T, statements);
50 handler.execute(program_name, statements);
51 }
52
53 }
54 }
55 #endif
viennacl::device_specific::execution_handler
Definition: execution_handler.hpp:39
tools.hpp
Various little tools used here and there in ViennaCL.
viennacl::ocl::current_context
viennacl::ocl::context & current_context()
Convenience function for returning the current context.
Definition: backend.hpp:213
viennacl::ocl::context
Manages an OpenCL context and provides the respective convenience functions for creating buffers...
Definition: context.hpp:55
viennacl::device_specific::execution_handler::add
void add(std::string const &key, template_base const &T, statements_container const &statements)
Definition: execution_handler.hpp:70
viennacl::device_specific::template_base
Definition: template_base.hpp:54
template_base.hpp
forwards.h
Forwards declaration.
forwards.h
Provides the datastructures for dealing with a single statement such as 'x = y + z;'.
viennacl::device_specific::execute
void execute(template_base const &T, statements_container const &statements, viennacl::ocl::context &ctx=viennacl::ocl::current_context(), bool force_compilation=false)
Definition: execute.hpp:44
viennacl::device_specific::tree_parsing::statements_representation
std::string statements_representation(statements_container const &statements, binding_policy_t binding_policy)
Definition: tree_parsing.hpp:494
timer.hpp
A simple, yet (mostly) sufficiently accurate timer for benchmarking and profiling.
tree_parsing.hpp
Code for parsing the expression trees.
viennacl::device_specific::BIND_TO_HANDLE
Definition: forwards.h:248
execution_handler.hpp
Helper for handling fallbacks, lazy compilation, input-dependent kernels, etc.
viennacl::device_specific::statements_container
Definition: forwards.h:262