All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
kernel.hpp
Go to the documentation of this file.
#ifndef VIENNACL_OCL_KERNEL_HPP_
#define VIENNACL_OCL_KERNEL_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 "viennacl/ocl/forwards.h"
#include "viennacl/ocl/handle.hpp"
#include "viennacl/ocl/program.hpp"
#include "viennacl/ocl/device.hpp"
#include "viennacl/ocl/local_mem.hpp"
namespace viennacl
{
namespace ocl
{
struct packed_cl_uint
{
cl_uint start;
cl_uint stride;
cl_uint size;
cl_uint internal_size;
};
class kernel
{
template<typename KernelType>
friend void enqueue(KernelType & k, viennacl::ocl::command_queue const & queue);
public:
typedef vcl_size_t size_type;
kernel() : handle_(), p_program_(NULL), p_context_(NULL), name_()
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Creating kernel object (default CTOR): " << name_ << std::endl;
#endif
}
kernel(cl_kernel kernel_handle, viennacl::ocl::program const & kernel_program, viennacl::ocl::context const & kernel_context, std::string const & name)
: handle_(kernel_handle, kernel_context), p_program_(&kernel_program), p_context_(&kernel_context), name_(name)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Creating kernel object (full CTOR): " << name_ << std::endl;
#endif
set_work_size_defaults();
}
kernel(kernel const & other)
: handle_(other.handle_), p_program_(other.p_program_), p_context_(other.p_context_), name_(other.name_)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Creating kernel object (Copy CTOR): " << name_ << std::endl;
#endif
local_work_size_[0] = other.local_work_size_[0];
local_work_size_[1] = other.local_work_size_[1];
local_work_size_[2] = other.local_work_size_[2];
global_work_size_[0] = other.global_work_size_[0];
global_work_size_[1] = other.global_work_size_[1];
global_work_size_[2] = other.global_work_size_[2];
}
viennacl::ocl::kernel & operator=(const kernel & other)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Assigning kernel object: " << other.name_ << std::endl;
#endif
handle_ = other.handle_;
p_program_ = other.p_program_;
p_context_ = other.p_context_;
name_ = other.name_;
local_work_size_[0] = other.local_work_size_[0];
local_work_size_[1] = other.local_work_size_[1];
local_work_size_[2] = other.local_work_size_[2];
global_work_size_[0] = other.global_work_size_[0];
global_work_size_[1] = other.global_work_size_[1];
global_work_size_[2] = other.global_work_size_[2];
return *this;
}
void arg(unsigned int pos, cl_char val)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Setting char kernel argument " << val << " at pos " << pos << " for kernel " << name_ << std::endl;
#endif
cl_int err = clSetKernelArg(handle_.get(), pos, sizeof(cl_char), (void*)&val);
VIENNACL_ERR_CHECK(err);
}
void arg(unsigned int pos, cl_uchar val)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Setting unsigned char kernel argument " << val << " at pos " << pos << " for kernel " << name_ << std::endl;
#endif
cl_int err = clSetKernelArg(handle_.get(), pos, sizeof(cl_uchar), (void*)&val);
VIENNACL_ERR_CHECK(err);
}
void arg(unsigned int pos, cl_short val)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Setting short kernel argument " << val << " at pos " << pos << " for kernel " << name_ << std::endl;
#endif
cl_int err = clSetKernelArg(handle_.get(), pos, sizeof(cl_short), (void*)&val);
VIENNACL_ERR_CHECK(err);
}
void arg(unsigned int pos, cl_ushort val)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Setting unsigned short kernel argument " << val << " at pos " << pos << " for kernel " << name_ << std::endl;
#endif
cl_int err = clSetKernelArg(handle_.get(), pos, sizeof(cl_ushort), (void*)&val);
VIENNACL_ERR_CHECK(err);
}
void arg(unsigned int pos, cl_uint val)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Setting unsigned int kernel argument " << val << " at pos " << pos << " for kernel " << name_ << std::endl;
#endif
cl_int err = clSetKernelArg(handle_.get(), pos, sizeof(cl_uint), (void*)&val);
VIENNACL_ERR_CHECK(err);
}
void arg(unsigned int pos, packed_cl_uint val)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Setting packed_cl_uint kernel argument (" << val.start << ", " << val.stride << ", " << val.size << ", " << val.internal_size << ") at pos " << pos << " for kernel " << name_ << std::endl;
#endif
cl_int err = clSetKernelArg(handle_.get(), pos, sizeof(packed_cl_uint), (void*)&val);
VIENNACL_ERR_CHECK(err);
}
void arg(unsigned int pos, float val)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Setting floating point kernel argument " << val << " at pos " << pos << " for kernel " << name_ << std::endl;
#endif
cl_int err = clSetKernelArg(handle_.get(), pos, sizeof(float), (void*)&val);
VIENNACL_ERR_CHECK(err);
}
void arg(unsigned int pos, double val)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Setting double precision kernel argument " << val << " at pos " << pos << " for kernel " << name_ << std::endl;
#endif
cl_int err = clSetKernelArg(handle_.get(), pos, sizeof(double), (void*)&val);
VIENNACL_ERR_CHECK(err);
}
void arg(unsigned int pos, cl_int val)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Setting int precision kernel argument " << val << " at pos " << pos << " for kernel " << name_ << std::endl;
#endif
cl_int err = clSetKernelArg(handle_.get(), pos, sizeof(cl_int), (void*)&val);
VIENNACL_ERR_CHECK(err);
}
void arg(unsigned int pos, cl_ulong val)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Setting ulong precision kernel argument " << val << " at pos " << pos << " for kernel " << name_ << std::endl;
#endif
cl_int err = clSetKernelArg(handle_.get(), pos, sizeof(cl_ulong), (void*)&val);
VIENNACL_ERR_CHECK(err);
}
void arg(unsigned int pos, cl_long val)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Setting long precision kernel argument " << val << " at pos " << pos << " for kernel " << name_ << std::endl;
#endif
cl_int err = clSetKernelArg(handle_.get(), pos, sizeof(cl_long), (void*)&val);
VIENNACL_ERR_CHECK(err);
}
//generic handling: call .handle() member
template<class VCL_TYPE>
void arg(unsigned int pos, VCL_TYPE const & val)
{
assert(&val.handle().opencl_handle().context() == &handle_.context() && bool("Kernel and memory object not in the same context!"));
cl_mem temp = val.handle().opencl_handle().get();
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Setting generic kernel argument " << temp << " at pos " << pos << " for kernel " << name_ << std::endl;
#endif
cl_int err = clSetKernelArg(handle_.get(), pos, sizeof(cl_mem), (void*)&temp);
VIENNACL_ERR_CHECK(err);
}
//forward handles directly:
template<class CL_TYPE>
void arg(unsigned int pos, viennacl::ocl::handle<CL_TYPE> const & h)
{
CL_TYPE temp = h.get();
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Setting handle kernel argument " << temp << " at pos " << pos << " for kernel " << name_ << std::endl;
#endif
cl_int err = clSetKernelArg(handle_.get(), pos, sizeof(CL_TYPE), (void*)&temp);
VIENNACL_ERR_CHECK(err);
}
//local buffer argument:
void arg(unsigned int pos, const local_mem & mem)
{
cl_uint size = static_cast<cl_uint>(mem.size());
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Setting local memory kernel argument of size " << size << " bytes at pos " << pos << " for kernel " << name_ << std::endl;
#endif
cl_int err = clSetKernelArg(handle_.get(), pos, size, 0);
VIENNACL_ERR_CHECK(err);
}
template<typename T0>
kernel & operator()(T0 const & t0)
{
arg(0, t0);
return *this;
}
template<typename T0, typename T1>
kernel & operator()(T0 const & t0, T1 const & t1)
{
arg(0, t0); arg(1, t1);
return *this;
}
template<typename T0, typename T1, typename T2>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2)
{
arg(0, t0); arg(1, t1); arg(2, t2);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5); arg(6, t6);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5); arg(6, t6); arg(7, t7);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5); arg(6, t6); arg(7, t7); arg(8, t8);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8, typename T9>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4,
T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5); arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5); arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11, T12 const & t12)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11); arg(12, t12);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15, typename T16>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15, T16 const & t16)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15); arg(16, t16);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15, typename T16, typename T17>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15, T16 const & t16, T17 const & t17)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15); arg(16, t16); arg(17, t17);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15, typename T16, typename T17,
typename T18>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15, T16 const & t16, T17 const & t17,
T18 const & t18
)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15); arg(16, t16); arg(17, t17);
arg(18, t18);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15, typename T16, typename T17,
typename T18, typename T19>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15, T16 const & t16, T17 const & t17,
T18 const & t18, T19 const & t19
)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15); arg(16, t16); arg(17, t17);
arg(18, t18); arg(19, t19);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15, typename T16, typename T17,
typename T18, typename T19, typename T20>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15, T16 const & t16, T17 const & t17,
T18 const & t18, T19 const & t19, T20 const & t20
)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15); arg(16, t16); arg(17, t17);
arg(18, t18); arg(19, t19); arg(20, t20);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15, typename T16, typename T17,
typename T18, typename T19, typename T20, typename T21>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15, T16 const & t16, T17 const & t17,
T18 const & t18, T19 const & t19, T20 const & t20, T21 const & t21
)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15); arg(16, t16); arg(17, t17);
arg(18, t18); arg(19, t19); arg(20, t20); arg(21, t21);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15, typename T16, typename T17,
typename T18, typename T19, typename T20, typename T21, typename T22>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15, T16 const & t16, T17 const & t17,
T18 const & t18, T19 const & t19, T20 const & t20, T21 const & t21, T22 const & t22
)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15); arg(16, t16); arg(17, t17);
arg(18, t18); arg(19, t19); arg(20, t20); arg(21, t21); arg(22, t22);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15, typename T16, typename T17,
typename T18, typename T19, typename T20, typename T21, typename T22, typename T23>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15, T16 const & t16, T17 const & t17,
T18 const & t18, T19 const & t19, T20 const & t20, T21 const & t21, T22 const & t22, T23 const & t23
)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15); arg(16, t16); arg(17, t17);
arg(18, t18); arg(19, t19); arg(20, t20); arg(21, t21); arg(22, t22); arg(23, t23);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15, typename T16, typename T17,
typename T18, typename T19, typename T20, typename T21, typename T22, typename T23,
typename T24>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15, T16 const & t16, T17 const & t17,
T18 const & t18, T19 const & t19, T20 const & t20, T21 const & t21, T22 const & t22, T23 const & t23,
T24 const & t24
)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15); arg(16, t16); arg(17, t17);
arg(18, t18); arg(19, t19); arg(20, t20); arg(21, t21); arg(22, t22); arg(23, t23);
arg(24, t24);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15, typename T16, typename T17,
typename T18, typename T19, typename T20, typename T21, typename T22, typename T23,
typename T24, typename T25>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15, T16 const & t16, T17 const & t17,
T18 const & t18, T19 const & t19, T20 const & t20, T21 const & t21, T22 const & t22, T23 const & t23,
T24 const & t24, T25 const & t25
)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15); arg(16, t16); arg(17, t17);
arg(18, t18); arg(19, t19); arg(20, t20); arg(21, t21); arg(22, t22); arg(23, t23);
arg(24, t24); arg(25, t25);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15, typename T16, typename T17,
typename T18, typename T19, typename T20, typename T21, typename T22, typename T23,
typename T24, typename T25, typename T26>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15, T16 const & t16, T17 const & t17,
T18 const & t18, T19 const & t19, T20 const & t20, T21 const & t21, T22 const & t22, T23 const & t23,
T24 const & t24, T25 const & t25, T26 const & t26
)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15); arg(16, t16); arg(17, t17);
arg(18, t18); arg(19, t19); arg(20, t20); arg(21, t21); arg(22, t22); arg(23, t23);
arg(24, t24); arg(25, t25); arg(26, t26);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15, typename T16, typename T17,
typename T18, typename T19, typename T20, typename T21, typename T22, typename T23,
typename T24, typename T25, typename T26, typename T27>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15, T16 const & t16, T17 const & t17,
T18 const & t18, T19 const & t19, T20 const & t20, T21 const & t21, T22 const & t22, T23 const & t23,
T24 const & t24, T25 const & t25, T26 const & t26, T27 const & t27
)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15); arg(16, t16); arg(17, t17);
arg(18, t18); arg(19, t19); arg(20, t20); arg(21, t21); arg(22, t22); arg(23, t23);
arg(24, t24); arg(25, t25); arg(26, t26); arg(27, t27);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15, typename T16, typename T17,
typename T18, typename T19, typename T20, typename T21, typename T22, typename T23,
typename T24, typename T25, typename T26, typename T27, typename T28>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15, T16 const & t16, T17 const & t17,
T18 const & t18, T19 const & t19, T20 const & t20, T21 const & t21, T22 const & t22, T23 const & t23,
T24 const & t24, T25 const & t25, T26 const & t26, T27 const & t27, T28 const & t28
)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15); arg(16, t16); arg(17, t17);
arg(18, t18); arg(19, t19); arg(20, t20); arg(21, t21); arg(22, t22); arg(23, t23);
arg(24, t24); arg(25, t25); arg(26, t26); arg(27, t27); arg(28, t28);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15, typename T16, typename T17,
typename T18, typename T19, typename T20, typename T21, typename T22, typename T23,
typename T24, typename T25, typename T26, typename T27, typename T28, typename T29>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15, T16 const & t16, T17 const & t17,
T18 const & t18, T19 const & t19, T20 const & t20, T21 const & t21, T22 const & t22, T23 const & t23,
T24 const & t24, T25 const & t25, T26 const & t26, T27 const & t27, T28 const & t28, T29 const & t29
)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15); arg(16, t16); arg(17, t17);
arg(18, t18); arg(19, t19); arg(20, t20); arg(21, t21); arg(22, t22); arg(23, t23);
arg(24, t24); arg(25, t25); arg(26, t26); arg(27, t27); arg(28, t28); arg(29, t29);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15, typename T16, typename T17,
typename T18, typename T19, typename T20, typename T21, typename T22, typename T23,
typename T24, typename T25, typename T26, typename T27, typename T28, typename T29,
typename T30>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15, T16 const & t16, T17 const & t17,
T18 const & t18, T19 const & t19, T20 const & t20, T21 const & t21, T22 const & t22, T23 const & t23,
T24 const & t24, T25 const & t25, T26 const & t26, T27 const & t27, T28 const & t28, T29 const & t29,
T30 const & t30
)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15); arg(16, t16); arg(17, t17);
arg(18, t18); arg(19, t19); arg(20, t20); arg(21, t21); arg(22, t22); arg(23, t23);
arg(24, t24); arg(25, t25); arg(26, t26); arg(27, t27); arg(28, t28); arg(29, t29);
arg(30, t30);
return *this;
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10, typename T11,
typename T12, typename T13, typename T14, typename T15, typename T16, typename T17,
typename T18, typename T19, typename T20, typename T21, typename T22, typename T23,
typename T24, typename T25, typename T26, typename T27, typename T28, typename T29,
typename T30, typename T31>
kernel & operator()(T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5,
T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11,
T12 const & t12, T13 const & t13, T14 const & t14, T15 const & t15, T16 const & t16, T17 const & t17,
T18 const & t18, T19 const & t19, T20 const & t20, T21 const & t21, T22 const & t22, T23 const & t23,
T24 const & t24, T25 const & t25, T26 const & t26, T27 const & t27, T28 const & t28, T29 const & t29,
T30 const & t30, T31 const & t31
)
{
arg(0, t0); arg(1, t1); arg(2, t2); arg(3, t3); arg(4, t4); arg(5, t5);
arg(6, t6); arg(7, t7); arg(8, t8); arg(9, t9); arg(10, t10); arg(11, t11);
arg(12, t12); arg(13, t13); arg(14, t14); arg(15, t15); arg(16, t16); arg(17, t17);
arg(18, t18); arg(19, t19); arg(20, t20); arg(21, t21); arg(22, t22); arg(23, t23);
arg(24, t24); arg(25, t25); arg(26, t26); arg(27, t27); arg(28, t28); arg(29, t29);
arg(30, t30); arg(31, t31);
return *this;
}
size_type local_work_size(int index = 0) const
{
assert(index < 3 && bool("Work size index out of bounds"));
return local_work_size_[index];
}
size_type global_work_size(int index = 0) const
{
assert(index < 3 && bool("Work size index out of bounds"));
return global_work_size_[index];
}
void local_work_size(int index, size_type s)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Setting local work size to " << s << " at index " << index << " for kernel " << name_ << std::endl;
#endif
assert(index < 3 && bool("Work size index out of bounds"));
local_work_size_[index] = s;
}
void global_work_size(int index, size_type s)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_KERNEL)
std::cout << "ViennaCL: Setting global work size to " << s << " at index " << index << " for kernel " << name_ << std::endl;
#endif
assert(index < 3 && bool("Work size index out of bounds"));
global_work_size_[index] = s;
}
std::string const & name() const { return name_; }
viennacl::ocl::handle<cl_kernel> const & handle() const { return handle_; }
viennacl::ocl::context const & context() const { return *p_context_; }
private:
inline void set_work_size_defaults(); //see context.hpp for implementation
viennacl::ocl::handle<cl_kernel> handle_;
viennacl::ocl::program const * p_program_;
viennacl::ocl::context const * p_context_;
std::string name_;
size_type local_work_size_[3];
size_type global_work_size_[3];
};
} //namespace ocl
} //namespace viennacl
#endif
viennacl::ocl::packed_cl_uint::stride
cl_uint stride
Increment between integers.
Definition: kernel.hpp:50
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1)
Convenience function for setting two kernel parameters.
Definition: kernel.hpp:279
forwards.h
This file provides the forward declarations for the OpenCL layer of ViennaCL.
viennacl::ocl::packed_cl_uint
Helper class for packing four cl_uint numbers into a uint4 type for access inside an OpenCL kernel...
Definition: kernel.hpp:45
device.hpp
Represents an OpenCL device within ViennaCL.
viennacl::ocl::kernel::arg
void arg(unsigned int pos, cl_ulong val)
Sets an unsigned long argument at the provided position.
Definition: kernel.hpp:207
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3)
Convenience function for setting four kernel parameters.
Definition: kernel.hpp:295
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15, T16 const &t16, T17 const &t17, T18 const &t18, T19 const &t19)
Convenience function for setting twenty kernel parameters.
Definition: kernel.hpp:476
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15, T16 const &t16, T17 const &t17, T18 const &t18, T19 const &t19, T20 const &t20, T21 const &t21, T22 const &t22, T23 const &t23, T24 const &t24)
Convenience function for setting 25 kernel parameters.
Definition: kernel.hpp:567
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10)
Convenience function for setting eleven kernel parameters.
Definition: kernel.hpp:354
viennacl::ocl::kernel::enqueue
friend void enqueue(KernelType &k, viennacl::ocl::command_queue const &queue)
Enqueues a kernel in the provided queue.
Definition: enqueue.hpp:50
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11)
Convenience function for setting twelve kernel parameters.
Definition: kernel.hpp:364
viennacl::ocl::kernel::handle
viennacl::ocl::handle< cl_kernel > const & handle() const
Definition: kernel.hpp:786
viennacl::ocl::kernel
Represents an OpenCL kernel within ViennaCL.
Definition: kernel.hpp:58
viennacl::ocl::kernel::kernel
kernel(kernel const &other)
Definition: kernel.hpp:82
viennacl::ocl::packed_cl_uint::start
cl_uint start
Starting value of the integer stride.
Definition: kernel.hpp:48
viennacl::ocl::kernel::local_work_size
size_type local_work_size(int index=0) const
Returns the local work size at the respective dimension.
Definition: kernel.hpp:742
viennacl::ocl::kernel::arg
void arg(unsigned int pos, float val)
Sets a single precision floating point argument at the provided position.
Definition: kernel.hpp:177
viennacl::ocl::kernel::size_type
vcl_size_t size_type
Definition: kernel.hpp:64
viennacl::ocl::context
Manages an OpenCL context and provides the respective convenience functions for creating buffers...
Definition: context.hpp:55
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14)
Convenience function for setting fifteen kernel parameters.
Definition: kernel.hpp:401
viennacl::ocl::kernel::arg
void arg(unsigned int pos, cl_uchar val)
Sets a char argument at the provided position.
Definition: kernel.hpp:126
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6)
Convenience function for setting seven kernel parameters.
Definition: kernel.hpp:319
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15, T16 const &t16, T17 const &t17, T18 const &t18, T19 const &t19, T20 const &t20, T21 const &t21, T22 const &t22)
Convenience function for setting 23 kernel parameters.
Definition: kernel.hpp:530
viennacl::ocl::kernel::name
std::string const & name() const
Definition: kernel.hpp:784
viennacl::ocl::command_queue
A class representing a command queue.
Definition: command_queue.hpp:45
viennacl::ocl::kernel::arg
void arg(unsigned int pos, const local_mem &mem)
Sets an OpenCL local memory object at the provided position.
Definition: kernel.hpp:257
viennacl::ocl::kernel::local_work_size
void local_work_size(int index, size_type s)
Sets the local work size at the respective dimension.
Definition: kernel.hpp:762
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15, T16 const &t16, T17 const &t17, T18 const &t18, T19 const &t19, T20 const &t20, T21 const &t21, T22 const &t22, T23 const &t23, T24 const &t24, T25 const &t25, T26 const &t26, T27 const &t27)
Convenience function for setting 28 kernel parameters.
Definition: kernel.hpp:630
viennacl::ocl::kernel::arg
void arg(unsigned int pos, cl_ushort val)
Sets a argument of type unsigned short at the provided position.
Definition: kernel.hpp:146
viennacl::ocl::packed_cl_uint::internal_size
cl_uint internal_size
Internal length of the buffer. Might be larger than 'size' due to padding.
Definition: kernel.hpp:54
viennacl::ocl::handle::context
viennacl::ocl::context const & context() const
Definition: handle.hpp:193
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15)
Convenience function for setting sixteen kernel parameters.
Definition: kernel.hpp:415
VIENNACL_ERR_CHECK
#define VIENNACL_ERR_CHECK(err)
Definition: error.hpp:681
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15, T16 const &t16)
Convenience function for setting seventeen kernel parameters.
Definition: kernel.hpp:429
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9)
Convenience function for setting ten kernel parameters.
Definition: kernel.hpp:344
viennacl::ocl::handle::get
const OCL_TYPE & get() const
Definition: handle.hpp:191
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15, T16 const &t16, T17 const &t17, T18 const &t18, T19 const &t19, T20 const &t20, T21 const &t21, T22 const &t22, T23 const &t23, T24 const &t24, T25 const &t25, T26 const &t26, T27 const &t27, T28 const &t28, T29 const &t29, T30 const &t30, T31 const &t31)
Convenience function for setting 32 kernel parameters.
Definition: kernel.hpp:718
viennacl::traits::size
vcl_size_t size(VectorType const &vec)
Generic routine for obtaining the size of a vector (ViennaCL, uBLAS, etc.)
Definition: size.hpp:239
viennacl::ocl::local_mem
A class representing local (shared) OpenCL memory. Typically used as kernel argument.
Definition: local_mem.hpp:33
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7)
Convenience function for setting eight kernel parameters.
Definition: kernel.hpp:327
program.hpp
Implements an OpenCL program class for ViennaCL.
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5)
Convenience function for setting six kernel parameters.
Definition: kernel.hpp:311
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2)
Convenience function for setting three kernel parameters.
Definition: kernel.hpp:287
handle.hpp
Implementation of a smart-pointer-like class for handling OpenCL handles.
viennacl::ocl::kernel::operator=
viennacl::ocl::kernel & operator=(const kernel &other)
Definition: kernel.hpp:97
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15, T16 const &t16, T17 const &t17, T18 const &t18, T19 const &t19, T20 const &t20)
Convenience function for setting twentyone kernel parameters.
Definition: kernel.hpp:494
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15, T16 const &t16, T17 const &t17)
Convenience function for setting eighteen kernel parameters.
Definition: kernel.hpp:443
viennacl::ocl::kernel::kernel
kernel(cl_kernel kernel_handle, viennacl::ocl::program const &kernel_program, viennacl::ocl::context const &kernel_context, std::string const &name)
Definition: kernel.hpp:73
viennacl::ocl::kernel::arg
void arg(unsigned int pos, packed_cl_uint val)
Sets four packed unsigned integers as argument at the provided position.
Definition: kernel.hpp:167
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4)
Convenience function for setting five kernel parameters.
Definition: kernel.hpp:303
viennacl::vcl_size_t
std::size_t vcl_size_t
Definition: forwards.h:75
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15, T16 const &t16, T17 const &t17, T18 const &t18, T19 const &t19, T20 const &t20, T21 const &t21, T22 const &t22, T23 const &t23, T24 const &t24, T25 const &t25, T26 const &t26, T27 const &t27, T28 const &t28, T29 const &t29, T30 const &t30)
Convenience function for setting 31 kernel parameters.
Definition: kernel.hpp:694
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15, T16 const &t16, T17 const &t17, T18 const &t18, T19 const &t19, T20 const &t20, T21 const &t21, T22 const &t22, T23 const &t23, T24 const &t24, T25 const &t25, T26 const &t26, T27 const &t27, T28 const &t28)
Convenience function for setting 29 kernel parameters.
Definition: kernel.hpp:651
viennacl::ocl::program
Wrapper class for an OpenCL program.
Definition: program.hpp:42
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15, T16 const &t16, T17 const &t17, T18 const &t18, T19 const &t19, T20 const &t20, T21 const &t21, T22 const &t22, T23 const &t23)
Convenience function for setting 24 kernel parameters.
Definition: kernel.hpp:548
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15, T16 const &t16, T17 const &t17, T18 const &t18)
Convenience function for setting nineteen kernel parameters.
Definition: kernel.hpp:458
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15, T16 const &t16, T17 const &t17, T18 const &t18, T19 const &t19, T20 const &t20, T21 const &t21, T22 const &t22, T23 const &t23, T24 const &t24, T25 const &t25, T26 const &t26)
Convenience function for setting 27 kernel parameters.
Definition: kernel.hpp:609
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15, T16 const &t16, T17 const &t17, T18 const &t18, T19 const &t19, T20 const &t20, T21 const &t21)
Convenience function for setting twentytwo kernel parameters.
Definition: kernel.hpp:512
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15, T16 const &t16, T17 const &t17, T18 const &t18, T19 const &t19, T20 const &t20, T21 const &t21, T22 const &t22, T23 const &t23, T24 const &t24, T25 const &t25, T26 const &t26, T27 const &t27, T28 const &t28, T29 const &t29)
Convenience function for setting 30 kernel parameters.
Definition: kernel.hpp:672
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13)
Convenience function for setting fourteen kernel parameters.
Definition: kernel.hpp:387
viennacl::ocl::kernel::arg
void arg(unsigned int pos, cl_int val)
Sets an int argument at the provided position.
Definition: kernel.hpp:197
viennacl::ocl::kernel::arg
void arg(unsigned int pos, VCL_TYPE const &val)
Sets an OpenCL memory object at the provided position.
Definition: kernel.hpp:229
viennacl::ocl::kernel::context
viennacl::ocl::context const & context() const
Definition: kernel.hpp:788
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0)
Convenience function for setting one kernel parameter.
Definition: kernel.hpp:271
viennacl::ocl::kernel::kernel
kernel()
Definition: kernel.hpp:66
viennacl::ocl::kernel::global_work_size
size_type global_work_size(int index=0) const
Returns the global work size at the respective dimension.
Definition: kernel.hpp:751
viennacl::ocl::local_mem::size
vcl_size_t size() const
Returns size in bytes.
Definition: local_mem.hpp:39
viennacl::ocl::kernel::arg
void arg(unsigned int pos, viennacl::ocl::handle< CL_TYPE > const &h)
Sets an OpenCL object at the provided position.
Definition: kernel.hpp:244
viennacl::ocl::kernel::arg
void arg(unsigned int pos, cl_char val)
Sets a char argument at the provided position.
Definition: kernel.hpp:116
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12, T13 const &t13, T14 const &t14, T15 const &t15, T16 const &t16, T17 const &t17, T18 const &t18, T19 const &t19, T20 const &t20, T21 const &t21, T22 const &t22, T23 const &t23, T24 const &t24, T25 const &t25)
Convenience function for setting 26 kernel parameters.
Definition: kernel.hpp:588
viennacl::ocl::kernel::arg
void arg(unsigned int pos, double val)
Sets a double precision floating point argument at the provided position.
Definition: kernel.hpp:187
viennacl::ocl::kernel::global_work_size
void global_work_size(int index, size_type s)
Sets the global work size at the respective dimension.
Definition: kernel.hpp:775
local_mem.hpp
A local (shared) memory object for OpenCL.
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9, T10 const &t10, T11 const &t11, T12 const &t12)
Convenience function for setting thirteen kernel parameters.
Definition: kernel.hpp:375
viennacl::ocl::kernel::arg
void arg(unsigned int pos, cl_long val)
Sets an unsigned long argument at the provided position.
Definition: kernel.hpp:217
viennacl::ocl::kernel::arg
void arg(unsigned int pos, cl_uint val)
Sets an unsigned integer argument at the provided position.
Definition: kernel.hpp:157
viennacl::ocl::kernel::arg
void arg(unsigned int pos, cl_short val)
Sets a argument of type short at the provided position.
Definition: kernel.hpp:136
viennacl::ocl::handle
Handle class the effectively represents a smart pointer for OpenCL handles.
Definition: forwards.h:51
viennacl::ocl::packed_cl_uint::size
cl_uint size
Number of values in the stride.
Definition: kernel.hpp:52
viennacl::ocl::kernel::operator()
kernel & operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8)
Convenience function for setting nine kernel parameters.
Definition: kernel.hpp:335