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) |
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.
| 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.
| mapOverlapFunc | A pointer to a valid overlap user function. Will be deleted in the destructor. |
References skepu::Environment< T >::getInstance().

| skepu::MapOverlap2D< MapOverlap2DFunc >::~MapOverlap2D | ( | ) |
When the MapOverlap2D skeleton is destroyed, it deletes the user function it was created with.
| 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.
| input | A Matrix that is used for both input and output. |
| useNumGPU | Integer specifying how many devices to use. 0 = Implementation decides. |
| 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.
| input | A matrix which the mapping will be performed on. |
| output | The result matrix, will be overwritten with the result and resized if needed. |
| useNumGPU | Integer specifying how many devices to use. 0 = Implementation decides. |
| 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.
| input | A matrix which the mapping will be performed on. It should include padded data as well considering the filter size |
| output | The result matrix, will be overwritten with the result and resized if needed. |
| filter | The filter which will be applied for each element in the output. |
| useNumGPU | Integer specifying how many devices to use. 0 = Implementation decides. |
References skepu::Matrix< T >::at(), and skepu::printCLError().

| 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.
| input | A matrix which the mapping will be performed on. It should include padded data as well considering the filter size |
| output | The result matrix, will be overwritten with the result and resized if needed. |
| filter_rows | The number of rows used as neighbouring elements to calculate new value for each output element. |
| filter_cols | The number of columns used as neighbouring elements to calculate new value for each output element. |
| useNumGPU | Integer specifying how many devices to use. 0 = Implementation decides. |
References skepu::Matrix< T >::at(), and skepu::printCLError().

| 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.
| input | A Matrix that is used for both input and output. |
| 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.
| input | A matrix which the mapping will be performed on. |
| output | The result matrix, will be overwritten with the result and resized if needed. |
| 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.
| input | A matrix which the mapping will be performed on. It should include padded data as well considering the filter size |
| output | The result matrix, will be overwritten with the result and resized if needed. |
| filter | The filter which will be applied for each element in the output. |
| 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.
| input | A matrix which the mapping will be performed on. It should include padded data as well considering the filter size |
| output | The result matrix, will be overwritten with the result and resized if needed. |
| filter_rows | The number of rows used as neighbouring elements to calculate new value for each output element. |
| filter_cols | The number of columns used as neighbouring elements to calculate new value for each output element. |
| 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.
| input | A Matrix that is used for both input and output. |
| useNumGPU | Integer specifying how many devices to use. 0 = Implementation decides. |
| 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.
| input | A matrix which the mapping will be performed on. |
| output | The result matrix, will be overwritten with the result and resized if needed. |
| useNumGPU | Integer specifying how many devices to use. 0 = Implementation decides. |
| 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.
| input | A matrix which the mapping will be performed on. It should include padded data as well considering the filter size |
| output | The result matrix, will be overwritten with the result and resized if needed. |
| filter | The filter which will be applied for each element in the output. |
| useTiling | The boolean flag that specify whether to use tiling optimizations. |
| useNumGPU | Integer specifying how many devices to use. 0 = Implementation decides. |
References MAX_GPU_DEVICES.
| 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.
| input | A matrix which the mapping will be performed on. It should include padded data as well considering the filter size |
| output | The result matrix, will be overwritten with the result and resized if needed. |
| filter_rows | The number of rows used as neighbouring elements to calculate new value for each output element. |
| filter_cols | The number of columns used as neighbouring elements to calculate new value for each output element. |
| useTiling | The boolean flag that specify whether to use tiling optimizations. |
| useNumGPU | Integer specifying how many devices to use. 0 = Implementation decides. |
copy
writeAccess
usePitch
References MAX_GPU_DEVICES.
| 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.
| input | A Matrix that is used for both input and output. |
| 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.
| input | A matrix which the mapping will be performed on. |
| output | The result matrix, will be overwritten with the result and resized if needed. |
| 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.
| input | A matrix which the mapping will be performed on. It should include padded data as well considering the filter size |
| output | The result matrix, will be overwritten with the result and resized if needed. |
| filter | The filter which will be applied for each element in the output. |
| 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.
| input | A matrix which the mapping will be performed on. It should include padded data as well considering the filter size |
| output | The result matrix, will be overwritten with the result and resized if needed. |
| filter_rows | The number of rows used as neighbouring elements to calculate new value for each output element. |
| filter_cols | The number of columns used as neighbouring elements to calculate new value for each output element. |
| 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.
| input | A matrix which the mapping will be performed on. It will be overwritten with the result. |
| 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.
| input | A matrix which the mapping will be performed on. |
| output | The result matrix, will be overwritten with the result and resized if needed. |
| 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.
| input | A matrix which the mapping will be performed on. It should include padded data as well considering the filter size |
| output | The result matrix, will be overwritten with the result and resized if needed. |
| filter | The filter matrix which will be applied for each element in the output. |
| useTiling | The boolean flag that specify whether to use tiling optimizations especially when using the CUDA implementation. |
| 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.
| input | A matrix which the mapping will be performed on. It should include padded data as well considering the filter size |
| output | The result matrix, will be overwritten with the result and resized if needed. |
| filter_rows | The number of rows used as neighbouring elements to calculate new value for each output element. |
| filter_cols | The number of columns used as neighbouring elements to calculate new value for each output element. |
| useTiling | The boolean flag that specify whether to use tiling optimizations especially when using the CUDA implementation. |
1.8.5