00001 #ifndef VIENNACL_OCL_COMMAND_QUEUE_HPP_ 00002 #define VIENNACL_OCL_COMMAND_QUEUE_HPP_ 00003 00004 /* ========================================================================= 00005 Copyright (c) 2010-2011, Institute for Microelectronics, 00006 Institute for Analysis and Scientific Computing, 00007 TU Wien. 00008 00009 ----------------- 00010 ViennaCL - The Vienna Computing Library 00011 ----------------- 00012 00013 Project Head: Karl Rupp rupp@iue.tuwien.ac.at 00014 00015 (A list of authors and contributors can be found in the PDF manual) 00016 00017 License: MIT (X11), see file LICENSE in the base directory 00018 ============================================================================= */ 00019 00024 #ifdef __APPLE__ 00025 #include <OpenCL/cl.h> 00026 #else 00027 #include <CL/cl.h> 00028 #endif 00029 00030 #include <vector> 00031 #include <string> 00032 #include <sstream> 00033 #include "viennacl/ocl/context.hpp" 00034 #include "viennacl/ocl/device.hpp" 00035 #include "viennacl/ocl/handle.hpp" 00036 00037 namespace viennacl 00038 { 00039 namespace ocl 00040 { 00041 00045 class command_queue 00046 { 00047 public: 00048 command_queue() {}; 00049 command_queue(viennacl::ocl::handle<cl_command_queue> h, cl_device_id dev) : handle_(h) {} 00050 00051 //Copy constructor: 00052 command_queue(command_queue const & other) 00053 { 00054 handle_ = other.handle_; 00055 } 00056 00057 //assignment operator: 00058 command_queue & operator=(command_queue const & other) 00059 { 00060 handle_ = other.handle_; 00061 return *this; 00062 } 00063 00065 void finish() const 00066 { 00067 clFinish(handle_); 00068 } 00069 00071 void flush() const 00072 { 00073 clFlush(handle_); 00074 } 00075 00076 viennacl::ocl::handle<cl_command_queue> const & handle() const { return handle_; } 00077 00078 private: 00079 00080 viennacl::ocl::handle<cl_command_queue> handle_; 00081 }; 00082 00083 00084 00085 } //namespace ocl 00086 } //namespace viennacl 00087 00088 #endif