18#ifndef __itkOpenCLKernel_h
19#define __itkOpenCLKernel_h
32#include "itkCovariantVector.h"
111#define OpenCLKernelSetArgMacroH( type ) \
112 cl_int SetArg( const cl_uint index, const type value ); \
114#define OpenCLKernelSetArgMacroCXX( type ) \
115 cl_int OpenCLKernel::SetArg( const cl_uint index, const type value ) \
117 return clSetKernelArg( this->m_KernelId, index, sizeof( value ), (const void *)&value ); \
120#define OpenCLKernelSetArgsMacroH( type0, type1, type2, type3, type4 ) \
121 OpenCLKernelSetArgMacroH( type0 ) OpenCLKernelSetArgMacroH( type1 ) \
122 OpenCLKernelSetArgMacroH( type2 ) OpenCLKernelSetArgMacroH( type3 ) \
123 OpenCLKernelSetArgMacroH( type4 ) \
125#define OpenCLKernelSetArgsMacroCXX( type0, type1, type2, type3, type4 ) \
126 OpenCLKernelSetArgMacroCXX( type0 ) OpenCLKernelSetArgMacroCXX( type1 ) \
127 OpenCLKernelSetArgMacroCXX( type2 ) OpenCLKernelSetArgMacroCXX( type3 ) \
128 OpenCLKernelSetArgMacroCXX( type4 ) \
133class OpenCLVectorBase;
136class OpenCLKernelPimpl;
303 cl_int SetArg( const cl_uint index, const
void * data, const
size_t size );
307 cl_int SetArg( const cl_uint index, const
Size1DType & value );
310 cl_int SetArg( const cl_uint index, const
Size2DType & value );
313 cl_int SetArg( const cl_uint index, const
Size3DType & value );
316 cl_int SetArg( const cl_uint index, const
Size4DType & value );
545 template<
typename T1 >
548 this->SetArg( 0, arg1 );
549 return this->LaunchKernel();
556 template<
typename T1,
typename T2 >
559 this->SetArg( 0, arg1 );
560 this->SetArg( 1, arg2 );
561 return this->LaunchKernel();
568 template<
typename T1,
typename T2,
typename T3 >
570 (
const T1 & arg1,
const T2 & arg2,
const T3 & arg3 )
572 this->SetArg( 0, arg1 );
573 this->SetArg( 1, arg2 );
574 this->SetArg( 2, arg3 );
575 return this->LaunchKernel();
582 template<
typename T1,
typename T2,
typename T3,
typename T4 >
584 (
const T1 & arg1,
const T2 & arg2,
const T3 & arg3,
const T4 & arg4 )
586 this->SetArg( 0, arg1 );
587 this->SetArg( 1, arg2 );
588 this->SetArg( 2, arg3 );
589 this->SetArg( 3, arg4 );
590 return this->LaunchKernel();
597 template<
typename T1,
typename T2,
typename T3,
typename T4,
600 (
const T1 & arg1,
const T2 & arg2,
const T3 & arg3,
const T4 & arg4,
603 this->SetArg( 0, arg1 );
604 this->SetArg( 1, arg2 );
605 this->SetArg( 2, arg3 );
606 this->SetArg( 3, arg4 );
607 this->SetArg( 4, arg5 );
608 return this->LaunchKernel();
615 template<
typename T1,
typename T2,
typename T3,
typename T4,
616 typename T5,
typename T6 >
618 (
const T1 & arg1,
const T2 & arg2,
const T3 & arg3,
const T4 & arg4,
619 const T5 & arg5,
const T6 & arg6 )
621 this->SetArg( 0, arg1 );
622 this->SetArg( 1, arg2 );
623 this->SetArg( 2, arg3 );
624 this->SetArg( 3, arg4 );
625 this->SetArg( 4, arg5 );
626 this->SetArg( 5, arg6 );
627 return this->LaunchKernel();
634 template<
typename T1,
typename T2,
typename T3,
typename T4,
635 typename T5,
typename T6,
typename T7 >
637 (
const T1 & arg1,
const T2 & arg2,
const T3 & arg3,
const T4 & arg4,
638 const T5 & arg5,
const T6 & arg6,
const T7 & arg7 )
640 this->SetArg( 0, arg1 );
641 this->SetArg( 1, arg2 );
642 this->SetArg( 2, arg3 );
643 this->SetArg( 3, arg4 );
644 this->SetArg( 4, arg5 );
645 this->SetArg( 5, arg6 );
646 this->SetArg( 6, arg7 );
647 return this->LaunchKernel();
654 template<
typename T1,
typename T2,
typename T3,
typename T4,
655 typename T5,
typename T6,
typename T7,
typename T8 >
657 (
const T1 & arg1,
const T2 & arg2,
const T3 & arg3,
const T4 & arg4,
658 const T5 & arg5,
const T6 & arg6,
const T7 & arg7,
const T8 & arg8 )
660 this->SetArg( 0, arg1 );
661 this->SetArg( 1, arg2 );
662 this->SetArg( 2, arg3 );
663 this->SetArg( 3, arg4 );
664 this->SetArg( 4, arg5 );
665 this->SetArg( 5, arg6 );
666 this->SetArg( 6, arg7 );
667 this->SetArg( 7, arg8 );
668 return this->LaunchKernel();
676 template<
typename T1,
typename T2,
typename T3,
typename T4,
677 typename T5,
typename T6,
typename T7,
typename T8,
680 (
const T1 & arg1,
const T2 & arg2,
const T3 & arg3,
const T4 & arg4,
681 const T5 & arg5,
const T6 & arg6,
const T7 & arg7,
const T8 & arg8,
684 this->SetArg( 0, arg1 );
685 this->SetArg( 1, arg2 );
686 this->SetArg( 2, arg3 );
687 this->SetArg( 3, arg4 );
688 this->SetArg( 4, arg5 );
689 this->SetArg( 5, arg6 );
690 this->SetArg( 6, arg7 );
691 this->SetArg( 7, arg8 );
692 this->SetArg( 8, arg9 );
693 return this->LaunchKernel();
701 template<
typename T1,
typename T2,
typename T3,
typename T4,
702 typename T5,
typename T6,
typename T7,
typename T8,
703 typename T9,
typename T10 >
705 (
const T1 & arg1,
const T2 & arg2,
const T3 & arg3,
const T4 & arg4,
706 const T5 & arg5,
const T6 & arg6,
const T7 & arg7,
const T8 & arg8,
707 const T9 & arg9,
const T10 & arg10 )
709 this->SetArg( 0, arg1 );
710 this->SetArg( 1, arg2 );
711 this->SetArg( 2, arg3 );
712 this->SetArg( 3, arg4 );
713 this->SetArg( 4, arg5 );
714 this->SetArg( 5, arg6 );
715 this->SetArg( 6, arg7 );
716 this->SetArg( 7, arg8 );
717 this->SetArg( 8, arg9 );
718 this->SetArg( 9, arg10 );
719 return this->LaunchKernel();
725 std::unique_ptr< OpenCLKernelPimpl >
d_ptr;
743template<
typename charT,
typename traits >
745std::basic_ostream< charT, traits > &
746operator<<( std::basic_ostream< charT, traits > & strm,
751 strm <<
"OpenCLKernel(null)";
755 const char indent =
' ';
757 strm <<
"OpenCLKernel" << std::endl
758 << indent <<
"Id: " << kernel.
GetKernelId() << std::endl
759 << indent <<
"Name: " << kernel.
GetName() << std::endl
The OpenCLContext class represents an OpenCL context.
The OpenCLDevice class represents the collection of OpenCL devices to be used by the host.
OpenCLEventList class represents a list of OpenCLEvent objects.
OpenCLEvent class represents an OpenCL event object.
The OpenCLKernel class represents an executable entry point function in an OpenCL program.
Matrix< double, 1, 1 > MatrixDouble1x1Type
OpenCLSize GetBestLocalWorkSizeImage3D() const
void SetGlobalWorkSize(const OpenCLSize &size)
void SetRoundedGlobalWorkSize(const OpenCLSize &size)
void SetDoubleAsFloat(const bool value)
CovariantVector< double, 2 > CovariantVectorDouble2DType
CovariantVector< float, 3 > CovariantVectorFloat3DType
Point< double, 4 > PointDouble4DType
Vector< int, 4 > VectorInt4DType
void SetLocalWorkSize(const OpenCLSize &size)
Vector< float, 4 > VectorFloat4DType
Point< float, 3 > PointFloat3DType
std::vcl_size_t GetNumberOfArguments() const
OpenCLSize GetBestLocalWorkSizeImage(const std::vcl_size_t dimension) const
Matrix< double, 3, 3 > MatrixDouble3x3Type
Point< int, 2 > PointInt2DType
Vector< float, 3 > VectorFloat3DType
OpenCLKernel & operator=(const OpenCLKernel &other)
Point< int, 3 > PointInt3DType
OpenCLSize GetLocalWorkSize() const
Vector< int, 2 > VectorInt2DType
Matrix< float, 4, 4 > MatrixFloat4x4Type
std::unique_ptr< OpenCLKernelPimpl > d_ptr
OpenCLEvent operator()(const T1 &arg1, const T2 &arg2)
CovariantVector< double, 1 > CovariantVectorDouble1DType
Point< double, 2 > PointDouble2DType
OpenCLSize GetBestLocalWorkSizeImage2D() const
void SetDoubleAsFloatDisable()
Vector< int, 3 > VectorInt3DType
CovariantVector< float, 2 > CovariantVectorFloat2DType
OpenCLSize GetGlobalWorkOffset() const
Vector< double, 3 > VectorDouble3DType
Point< double, 3 > PointDouble3DType
CovariantVector< int, 1 > CovariantVectorInt1DType
OpenCLKernel(const OpenCLKernel &other)
CovariantVector< double, 3 > CovariantVectorDouble3DType
Point< float, 2 > PointFloat2DType
CovariantVector< int, 4 > CovariantVectorInt4DType
Matrix< float, 2, 2 > MatrixFloat2x2Type
CovariantVector< float, 4 > CovariantVectorFloat4DType
Vector< float, 1 > VectorFloat1DType
CovariantVector< int, 2 > CovariantVectorInt2DType
Vector< int, 1 > VectorInt1DType
OpenCLSize GetGlobalWorkSize() const
OpenCLKernelSetArgsMacroH(cl_uchar, cl_uchar2, cl_uchar4, cl_uchar8, cl_uchar16) OpenCLKernelSetArgsMacroH(cl_char
vcl_size_t GetPreferredWorkSizeMultiple() const
void SetGlobalWorkOffset(const OpenCLSize &offset)
OpenCLSize GetCompileWorkGroupSize() const
OpenCLProgram GetProgram() const
Vector< float, 2 > VectorFloat2DType
CovariantVector< double, 4 > CovariantVectorDouble4DType
bool GetDoubleAsFloatEnabled()
OpenCLKernel(OpenCLContext *context, const cl_kernel id)
OpenCLSize GetCompileWorkGroupSize(const OpenCLDevice &device) const
Point< double, 1 > PointDouble1DType
Point< int, 4 > PointInt4DType
Matrix< float, 3, 3 > MatrixFloat3x3Type
Vector< double, 1 > VectorDouble1DType
Matrix< float, 1, 1 > MatrixFloat1x1Type
CovariantVector< int, 3 > CovariantVectorInt3DType
OpenCLContext * GetContext() const
OpenCLEvent operator()(const T1 &arg1)
std::string GetName() const
Point< int, 1 > PointInt1DType
OpenCLSize GetBestLocalWorkSizeImage1D() const
Vector< double, 4 > VectorDouble4DType
Matrix< double, 2, 2 > MatrixDouble2x2Type
cl_kernel GetKernelId() const
Matrix< double, 4, 4 > MatrixDouble4x4Type
Point< float, 4 > PointFloat4DType
void SetDoubleAsFloatEnable()
Point< float, 1 > PointFloat1DType
CovariantVector< float, 1 > CovariantVectorFloat1DType
Vector< double, 2 > VectorDouble2DType
The OpenCLMemoryObject class represents all common memory objects such as buffers and image objects.
The OpenCLProgram class represents an OpenCL program object.
The OpenCLSampler class represents an OpenCL sampler object.
The OpenCLSize class defines the size of an item of work for an OpenCL kernel.
The base class for the OpenCLVector implementation.
#define ITK_OPENCL_DECLARE_PRIVATE(Class)
#define OpenCLKernelSetArgsMacroH(type0, type1, type2, type3, type4)
bool ITKOpenCL_EXPORT operator==(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
bool ITKOpenCL_EXPORT operator!=(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &strm, const OpenCLCommandQueue &queue)