18 #ifndef __itkOpenCLKernel_h
19 #define __itkOpenCLKernel_h
31 #include "itkVector.h"
32 #include "itkCovariantVector.h"
33 #include "itkMatrix.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 ) \
133 class OpenCLVectorBase;
136 class 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::auto_ptr< OpenCLKernelPimpl >
d_ptr;
743 template<
typename charT,
typename traits >
745 std::basic_ostream< charT, traits > &
746 operator<<( 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