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 
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
Various little tools used here and there in ViennaCL.
viennacl::ocl::context & current_context()
Convenience function for returning the current context.
Definition: backend.hpp:213
Manages an OpenCL context and provides the respective convenience functions for creating buffers...
Definition: context.hpp:55
void add(std::string const &key, template_base const &T, statements_container const &statements)
Forwards declaration.
Provides the datastructures for dealing with a single statement such as 'x = y + z;'.
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
std::string statements_representation(statements_container const &statements, binding_policy_t binding_policy)
A simple, yet (mostly) sufficiently accurate timer for benchmarking and profiling.
Code for parsing the expression trees.
Helper for handling fallbacks, lazy compilation, input-dependent kernels, etc.