SkePU  1.2
 All Classes Namespaces Files Functions Variables Enumerations Friends Macros Groups Pages
Public Member Functions | List of all members
skepu::MapOverlap2D< MapOverlap2DFunc > Class Template Reference

A class representing the MapOverlap skeleton for 2D overlap for Matrix operands (useful for convolution and stencil computation). More...

#include <2dmapoverlap.h>

Public Member Functions

 MapOverlap2D (MapOverlap2DFunc *mapOverlapFunc)
 
 ~MapOverlap2D ()
 
template<typename T >
void operator() (Matrix< T > &input)
 
template<typename T >
void operator() (Matrix< T > &input, Matrix< T > &output)
 
template<typename T >
void operator() (Matrix< T > &input, Matrix< T > &output, Matrix< T > &filter, bool useTiling=false)
 
template<typename T >
void operator() (Matrix< T > &input, Matrix< T > &output, size_t filter_rows, size_t filter_cols, bool useTiling=false)
 
template<typename T >
void CPU (Matrix< T > &input)
 
template<typename T >
void CPU (Matrix< T > &input, Matrix< T > &output)
 
template<typename T >
void CPU (Matrix< T > &input, Matrix< T > &output, Matrix< T > &filter)
 
template<typename T >
void CPU (Matrix< T > &input, Matrix< T > &output, size_t filter_rows, size_t filter_cols)
 
template<typename T >
void OMP (Matrix< T > &input)
 
template<typename T >
void OMP (Matrix< T > &input, Matrix< T > &output)
 
template<typename T >
void OMP (Matrix< T > &input, Matrix< T > &output, Matrix< T > &filter)
 
template<typename T >
void OMP (Matrix< T > &input, Matrix< T > &output, size_t filter_rows, size_t filter_cols)
 
template<typename T >
void CU (Matrix< T > &input, int useNumGPU=1)
 
template<typename T >
void CU (Matrix< T > &input, Matrix< T > &output, int useNumGPU=1)
 
template<typename T >
void CU (Matrix< T > &input, Matrix< T > &output, Matrix< T > &filter, bool useTiling=false, int useNumGPU=1)
 
template<typename T >
void CU (Matrix< T > &input, Matrix< T > &output, size_t filter_rows, size_t filter_cols, bool useTiling=false, int useNumGPU=1)
 
template<typename T >
void CL (Matrix< T > &input, int useNumGPU=1)
 
template<typename T >
void CL (Matrix< T > &input, Matrix< T > &output, int useNumGPU=1)
 
template<typename T >
void CL (Matrix< T > &input, Matrix< T > &output, Matrix< T > &filter, int useNumGPU=1)
 
template<typename T >
void CL (Matrix< T > &input, Matrix< T > &output, size_t filter_rows, size_t filter_cols, int useNumGPU=1)
 

Detailed Description

template<typename MapOverlap2DFunc>
class skepu::MapOverlap2D< MapOverlap2DFunc >

A class representing the MapOverlap skeleton for 2D overlap for Matrix operands (useful for convolution and stencil computation).

This class defines the MapOverlap skeleton for 2-dimensional MapOverlap for Matrix operands which is similar to a normal MapOverlap, but each element of the result matrix is a function of several "neighboring" elements of one input matrix that reside at a certain constant maximum distance, control by overlap-width and overlap-height. Once instantiated, it is meant to be used as a function and therefore overloading operator(). There are a few overloaded variants of this operator depending on whenther (1) user-function is used to specify the neighborhood filter or (2) a filter matrix is passed instead, specifiying weights for each neighbouring elements. Later is optimized when using CUDA backend using tiling optimization.

If a certain backend is to be used, functions with the same interface as operator() but by the names CPU, CU, CL, OMP exists for CPU, CUDA, OpenCL and OpenMP respectively.

The MapOverlap2D skeleton also includes a pointer to an Environment which includes the devices available to execute on.

Constructor & Destructor Documentation

template<typename MapOverlap2DFunc >
skepu::MapOverlap2D< MapOverlap2DFunc >::MapOverlap2D ( MapOverlap2DFunc *  mapOverlapFunc)

When creating an instance of the MapOverlap2D skeleton, a pointer to an overlap user function must be provided. Also the environment is set and if SKEPU_OPENCL is defined, the appropriate OpenCL program and kernel are created. Also creates a default execution plan which the skeleton will use if no other is specified.

Parameters
mapOverlapFuncA pointer to a valid overlap user function. Will be deleted in the destructor.

References skepu::Environment< T >::getInstance().

Here is the call graph for this function:

template<typename MapOverlap2DFunc >
skepu::MapOverlap2D< MapOverlap2DFunc >::~MapOverlap2D ( )

When the MapOverlap2D skeleton is destroyed, it deletes the user function it was created with.

Member Function Documentation

template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::CL ( Matrix< T > &  input,
int  useNumGPU = 1 
)

Performs the 2D MapOverlap on a Matrix on the OpenCL with the same Matrix as output. The actual filter is specified in a user-function.

Parameters
inputA Matrix that is used for both input and output.
useNumGPUInteger specifying how many devices to use. 0 = Implementation decides.
template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::CL ( Matrix< T > &  input,
Matrix< T > &  output,
int  useNumGPU = 1 
)

Performs the 2D MapOverlap on a whole matrix on the OpenCL with a separate output matrix. The actual filter is specified in a user-function.

Parameters
inputA matrix which the mapping will be performed on.
outputThe result matrix, will be overwritten with the result and resized if needed.
useNumGPUInteger specifying how many devices to use. 0 = Implementation decides.
template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::CL ( Matrix< T > &  input,
Matrix< T > &  output,
Matrix< T > &  filter,
int  useNumGPU = 1 
)

Performs the 2D MapOverlap on the OpenCL, based on provided filter and input neighbouring elements on a whole Matrix With a separate Matrix as output.

Parameters
inputA matrix which the mapping will be performed on. It should include padded data as well considering the filter size
outputThe result matrix, will be overwritten with the result and resized if needed.
filterThe filter which will be applied for each element in the output.
useNumGPUInteger specifying how many devices to use. 0 = Implementation decides.

References skepu::Matrix< T >::at(), and skepu::printCLError().

Here is the call graph for this function:

template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::CL ( Matrix< T > &  input,
Matrix< T > &  output,
size_t  filter_rows,
size_t  filter_cols,
int  useNumGPU = 1 
)

Performs the 2D MapOverlap on the OpenCL, by taking average of neighbouring elements on a whole Matrix. With a separate Matrix as output.

Parameters
inputA matrix which the mapping will be performed on. It should include padded data as well considering the filter size
outputThe result matrix, will be overwritten with the result and resized if needed.
filter_rowsThe number of rows used as neighbouring elements to calculate new value for each output element.
filter_colsThe number of columns used as neighbouring elements to calculate new value for each output element.
useNumGPUInteger specifying how many devices to use. 0 = Implementation decides.

References skepu::Matrix< T >::at(), and skepu::printCLError().

Here is the call graph for this function:

template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::CPU ( Matrix< T > &  input)

Performs the 2D MapOverlap on a Matrix on the CPU with the same Matrix as output. The actual filter is specified in a user-function.

Parameters
inputA Matrix that is used for both input and output.
template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::CPU ( Matrix< T > &  input,
Matrix< T > &  output 
)

Performs the 2D MapOverlap on a whole matrix on the CPU with a separate output matrix. The actual filter is specified in a user-function.

Parameters
inputA matrix which the mapping will be performed on.
outputThe result matrix, will be overwritten with the result and resized if needed.
template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::CPU ( Matrix< T > &  input,
Matrix< T > &  output,
Matrix< T > &  filter 
)

Performs the 2D MapOverlap on the CPU, based on provided filter and input neighbouring elements on a whole Matrix. With a separate Matrix as output.

Parameters
inputA matrix which the mapping will be performed on. It should include padded data as well considering the filter size
outputThe result matrix, will be overwritten with the result and resized if needed.
filterThe filter which will be applied for each element in the output.
template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::CPU ( Matrix< T > &  input,
Matrix< T > &  output,
size_t  filter_rows,
size_t  filter_cols 
)

Performs the 2D MapOverlap on the CPU, by taking average of neighbouring elements on a whole Matrix. With a separate Matrix as output.

Parameters
inputA matrix which the mapping will be performed on. It should include padded data as well considering the filter size
outputThe result matrix, will be overwritten with the result and resized if needed.
filter_rowsThe number of rows used as neighbouring elements to calculate new value for each output element.
filter_colsThe number of columns used as neighbouring elements to calculate new value for each output element.
template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::CU ( Matrix< T > &  input,
int  useNumGPU = 1 
)

Performs the 2D MapOverlap on a Matrix on the CUDA with the same Matrix as output. The actual filter is specified in a user-function.

Parameters
inputA Matrix that is used for both input and output.
useNumGPUInteger specifying how many devices to use. 0 = Implementation decides.
template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::CU ( Matrix< T > &  input,
Matrix< T > &  output,
int  useNumGPU = 1 
)

Performs the 2D MapOverlap on a whole matrix on the CUDA with a separate output matrix. The actual filter is specified in a user-function.

Parameters
inputA matrix which the mapping will be performed on.
outputThe result matrix, will be overwritten with the result and resized if needed.
useNumGPUInteger specifying how many devices to use. 0 = Implementation decides.
template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::CU ( Matrix< T > &  input,
Matrix< T > &  output,
Matrix< T > &  filter,
bool  useTiling = false,
int  useNumGPU = 1 
)

Performs the 2D MapOverlap on the CUDA, based on provided filter and input neighbouring elements on a whole Matrix. With a separate Matrix as output.

Parameters
inputA matrix which the mapping will be performed on. It should include padded data as well considering the filter size
outputThe result matrix, will be overwritten with the result and resized if needed.
filterThe filter which will be applied for each element in the output.
useTilingThe boolean flag that specify whether to use tiling optimizations.
useNumGPUInteger specifying how many devices to use. 0 = Implementation decides.

References MAX_GPU_DEVICES.

template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::CU ( Matrix< T > &  input,
Matrix< T > &  output,
size_t  filter_rows,
size_t  filter_cols,
bool  useTiling = false,
int  useNumGPU = 1 
)

Performs the 2D MapOverlap on the CUDA, by taking average of neighbouring elements on a whole Matrix. With a separate Matrix as output.

Parameters
inputA matrix which the mapping will be performed on. It should include padded data as well considering the filter size
outputThe result matrix, will be overwritten with the result and resized if needed.
filter_rowsThe number of rows used as neighbouring elements to calculate new value for each output element.
filter_colsThe number of columns used as neighbouring elements to calculate new value for each output element.
useTilingThe boolean flag that specify whether to use tiling optimizations.
useNumGPUInteger specifying how many devices to use. 0 = Implementation decides.

copy

writeAccess

usePitch

References MAX_GPU_DEVICES.

template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::OMP ( Matrix< T > &  input)

Performs the 2D MapOverlap on a Matrix on the OpenMP with the same Matrix as output. The actual filter is specified in a user-function.

Parameters
inputA Matrix that is used for both input and output.
template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::OMP ( Matrix< T > &  input,
Matrix< T > &  output 
)

Performs the 2D MapOverlap on a whole matrix on the OpenMP with a separate output matrix. The actual filter is specified in a user-function.

Parameters
inputA matrix which the mapping will be performed on.
outputThe result matrix, will be overwritten with the result and resized if needed.
template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::OMP ( Matrix< T > &  input,
Matrix< T > &  output,
Matrix< T > &  filter 
)

Performs the 2D MapOverlap on the OpenMP, based on provided filter and input neighbouring elements on a whole Matrix With a separate Matrix as output.

Parameters
inputA matrix which the mapping will be performed on. It should include padded data as well considering the filter size
outputThe result matrix, will be overwritten with the result and resized if needed.
filterThe filter which will be applied for each element in the output.
template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::OMP ( Matrix< T > &  input,
Matrix< T > &  output,
size_t  filter_rows,
size_t  filter_cols 
)

Performs the 2D MapOverlap on the OpenMP, by taking average of neighbouring elements on a whole Matrix. With a separate Matrix as output.

Parameters
inputA matrix which the mapping will be performed on. It should include padded data as well considering the filter size
outputThe result matrix, will be overwritten with the result and resized if needed.
filter_rowsThe number of rows used as neighbouring elements to calculate new value for each output element.
filter_colsThe number of columns used as neighbouring elements to calculate new value for each output element.
template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::operator() ( Matrix< T > &  input)

Performs the MapOverlap2D on a whole Matrix where actual filter is specified in a user-function. With itself as output.

Depending on which backend was used, different versions of the skeleton is called. If SKEPU_CUDA is defined, the CUDA backend is used, similarly if SKEPU_OPENCL or SKEPU_OPENMP are defined then the OpenCL or OpenMP backend is used. As a fallback there is always a CPU version.

Parameters
inputA matrix which the mapping will be performed on. It will be overwritten with the result.
template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::operator() ( Matrix< T > &  input,
Matrix< T > &  output 
)

Performs the MapOverlap2D on a whole Matrix where actual filter is specified in a user-function. With a seperate Matrix as output.

Depending on which backend was used, different versions of the skeleton is called. If SKEPU_CUDA is defined, the CUDA backend is used, similarly if SKEPU_OPENCL or SKEPU_OPENMP are defined then the OpenCL or OpenMP backend is used. As a fallback there is always a CPU version.

Parameters
inputA matrix which the mapping will be performed on.
outputThe result matrix, will be overwritten with the result and resized if needed.
template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::operator() ( Matrix< T > &  input,
Matrix< T > &  output,
Matrix< T > &  filter,
bool  useTiling = false 
)

Performs the MapOverlap2D based on provided filter and input neighbouring elements on a whole Matrix. With a seperate Matrix as output.

Depending on which backend was used, different versions of the skeleton is called. If SKEPU_CUDA is defined, the CUDA backend is used, similarly if SKEPU_OPENCL or SKEPU_OPENMP are defined then the OpenCL or OpenMP backend is used. As a fallback there is always a CPU version.

Parameters
inputA matrix which the mapping will be performed on. It should include padded data as well considering the filter size
outputThe result matrix, will be overwritten with the result and resized if needed.
filterThe filter matrix which will be applied for each element in the output.
useTilingThe boolean flag that specify whether to use tiling optimizations especially when using the CUDA implementation.
template<typename MapOverlap2DFunc >
template<typename T >
void skepu::MapOverlap2D< MapOverlap2DFunc >::operator() ( Matrix< T > &  input,
Matrix< T > &  output,
size_t  filter_rows,
size_t  filter_cols,
bool  useTiling = false 
)

Performs the MapOverlap2D on a whole Matrix based on neighbouring elements by taking average of all neighbours. With a seperate Matrix as output.

Depending on which backend was used, different versions of the skeleton is called. If SKEPU_CUDA is defined, the CUDA backend is used, similarly if SKEPU_OPENCL or SKEPU_OPENMP are defined then the OpenCL or OpenMP backend is used. As a fallback there is always a CPU version.

Parameters
inputA matrix which the mapping will be performed on. It should include padded data as well considering the filter size
outputThe result matrix, will be overwritten with the result and resized if needed.
filter_rowsThe number of rows used as neighbouring elements to calculate new value for each output element.
filter_colsThe number of columns used as neighbouring elements to calculate new value for each output element.
useTilingThe boolean flag that specify whether to use tiling optimizations especially when using the CUDA implementation.

The documentation for this class was generated from the following files: