All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
command_queue.hpp
Go to the documentation of this file.
#ifndef VIENNACL_OCL_COMMAND_QUEUE_HPP_
#define VIENNACL_OCL_COMMAND_QUEUE_HPP_
/* =========================================================================
Copyright (c) 2010-2016, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
-----------------
ViennaCL - The Vienna Computing Library
-----------------
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
#ifdef __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
#include <vector>
#include <string>
#include <sstream>
#include "viennacl/ocl/device.hpp"
#include "viennacl/ocl/handle.hpp"
namespace viennacl
{
namespace ocl
{
class command_queue
{
public:
command_queue() {}
command_queue(viennacl::ocl::handle<cl_command_queue> h) : handle_(h) {}
//Copy constructor:
command_queue(command_queue const & other)
{
handle_ = other.handle_;
}
//assignment operator:
command_queue & operator=(command_queue const & other)
{
handle_ = other.handle_;
return *this;
}
bool operator==(command_queue const & other) const
{
return handle_ == other.handle_;
}
void finish() const
{
clFinish(handle_.get());
}
void flush() const
{
clFlush(handle_.get());
}
viennacl::ocl::handle<cl_command_queue> const & handle() const { return handle_; }
viennacl::ocl::handle<cl_command_queue> & handle() { return handle_; }
private:
viennacl::ocl::handle<cl_command_queue> handle_;
};
} //namespace ocl
} //namespace viennacl
#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 >