ViennaCL - The Vienna Computing Library: viennacl/ocl/command_queue.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
command_queue.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_OCL_COMMAND_QUEUE_HPP_
2 #define VIENNACL_OCL_COMMAND_QUEUE_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 #ifdef __APPLE__
26 #include <OpenCL/cl.h>
27 #else
28 #include <CL/cl.h>
29 #endif
30
31 #include <vector>
32 #include <string>
33 #include <sstream>
34 #include "viennacl/ocl/device.hpp"
35 #include "viennacl/ocl/handle.hpp"
36
37 namespace viennacl
38 {
39 namespace ocl
40 {
41
45 class command_queue
46 {
47 public:
48 command_queue() {}
49 command_queue(viennacl::ocl::handle<cl_command_queue> h) : handle_(h) {}
50
51 //Copy constructor:
52 command_queue(command_queue const & other)
53 {
54 handle_ = other.handle_;
55 }
56
57 //assignment operator:
58 command_queue & operator=(command_queue const & other)
59 {
60 handle_ = other.handle_;
61 return *this;
62 }
63
64 bool operator==(command_queue const & other) const
65 {
66 return handle_ == other.handle_;
67 }
68
70 void finish() const
71 {
72 clFinish(handle_.get());
73 }
74
76 void flush() const
77 {
78 clFlush(handle_.get());
79 }
80
81 viennacl::ocl::handle<cl_command_queue> const & handle() const { return handle_; }
82 viennacl::ocl::handle<cl_command_queue> & handle() { return handle_; }
83
84 private:
85
86 viennacl::ocl::handle<cl_command_queue> handle_;
87 };
88
89 } //namespace ocl
90 } //namespace viennacl
91
92 #endif
viennacl::ocl::command_queue::operator=
command_queue & operator=(command_queue const &other)
Definition: command_queue.hpp:58
device.hpp
Represents an OpenCL device within ViennaCL.
viennacl::ocl::command_queue::finish
void finish() const
Waits until all kernels in the queue have finished their execution.
Definition: command_queue.hpp:70
viennacl::ocl::command_queue::handle
viennacl::ocl::handle< cl_command_queue > & handle()
Definition: command_queue.hpp:82
viennacl::ocl::command_queue::command_queue
command_queue(command_queue const &other)
Definition: command_queue.hpp:52
viennacl::ocl::command_queue
A class representing a command queue.
Definition: command_queue.hpp:45
viennacl::ocl::command_queue::handle
viennacl::ocl::handle< cl_command_queue > const & handle() const
Definition: command_queue.hpp:81
viennacl::ocl::command_queue::operator==
bool operator==(command_queue const &other) const
Definition: command_queue.hpp:64
viennacl::ocl::handle::get
const OCL_TYPE & get() const
Definition: handle.hpp:191
handle.hpp
Implementation of a smart-pointer-like class for handling OpenCL handles.
viennacl::ocl::command_queue::flush
void flush() const
Waits until all kernels in the queue have started their execution.
Definition: command_queue.hpp:76
viennacl::ocl::command_queue::command_queue
command_queue(viennacl::ocl::handle< cl_command_queue > h)
Definition: command_queue.hpp:49
viennacl::ocl::command_queue::command_queue
command_queue()
Definition: command_queue.hpp:48
viennacl::ocl::handle< cl_command_queue >