00001 /* ======================================================================= 00002 Copyright (c) 2010, Institute for Microelectronics, TU Vienna. 00003 http://www.iue.tuwien.ac.at 00004 ----------------- 00005 ViennaCL - The Vienna Computing Library 00006 ----------------- 00007 00008 authors: Karl Rupp rupp@iue.tuwien.ac.at 00009 Florian Rudolf flo.rudy+viennacl@gmail.com 00010 Josef Weinbub weinbub@iue.tuwien.ac.at 00011 00012 license: MIT (X11), see file LICENSE in the ViennaCL base directory 00013 ======================================================================= */ 00014 00015 #ifndef _VIENNACL_COMMAND_QUEUE_HPP_ 00016 #define _VIENNACL_COMMAND_QUEUE_HPP_ 00017 00022 #ifdef __APPLE__ 00023 #include <OpenCL/cl.h> 00024 #else 00025 #include <CL/cl.h> 00026 #endif 00027 00028 #include <vector> 00029 #include <string> 00030 #include <sstream> 00031 #include "viennacl/ocl/context.hpp" 00032 #include "viennacl/ocl/device.hpp" 00033 #include "viennacl/ocl/handle.hpp" 00034 00035 namespace viennacl 00036 { 00037 namespace ocl 00038 { 00039 00043 class command_queue 00044 { 00045 public: 00046 command_queue() {}; 00047 command_queue(viennacl::ocl::handle<cl_command_queue> h, cl_device_id dev) : handle_(h) {} 00048 00049 //Copy constructor: 00050 command_queue(command_queue const & other) 00051 { 00052 handle_ = other.handle_; 00053 } 00054 00055 //assignment operator: 00056 command_queue & operator=(command_queue const & other) 00057 { 00058 handle_ = other.handle_; 00059 return *this; 00060 } 00061 00063 void finish() const 00064 { 00065 clFinish(handle_); 00066 } 00067 00069 void flush() const 00070 { 00071 clFlush(handle_); 00072 } 00073 00074 viennacl::ocl::handle<cl_command_queue> const & handle() const { return handle_; } 00075 00076 private: 00077 00078 viennacl::ocl::handle<cl_command_queue> handle_; 00079 }; 00080 00081 00082 00083 } //namespace ocl 00084 } //namespace viennacl 00085 00086 #endif