diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2017-01-15 17:30:00 +0100 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2017-01-15 17:30:00 +0100 |
commit | 4b3ffd998904f5c848edc5917308f5942fa71da3 (patch) | |
tree | f264f9e0fe241fdbe25b623c4208da222a99d973 /src/routines/common.hpp | |
parent | 4a4be0c3a5e603a9c0c4c7aebcb660b5e62b99ad (diff) |
Added a first version of the diagonal block invert routine in preparation of TRSM
Diffstat (limited to 'src/routines/common.hpp')
-rw-r--r-- | src/routines/common.hpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/routines/common.hpp b/src/routines/common.hpp index 53ca6355..47f98de0 100644 --- a/src/routines/common.hpp +++ b/src/routines/common.hpp @@ -33,6 +33,27 @@ void RunKernel(Kernel &kernel, Queue &queue, const Device &device, // ================================================================================================= +// Sets all elements of a matrix to a constant value +template <typename T> +void FillMatrix(Queue &queue, const Device &device, + const Program &program, const Database &, + EventPointer event, const std::vector<Event> &waitForEvents, + const size_t n, const size_t ld, const size_t offset, + const Buffer<T> &dest, + const T constant_value) { + auto kernel = Kernel(program, "FillMatrix"); + kernel.SetArgument(0, static_cast<int>(n)); + kernel.SetArgument(1, static_cast<int>(ld)); + kernel.SetArgument(2, static_cast<int>(offset)); + kernel.SetArgument(3, dest()); + kernel.SetArgument(4, GetRealArg(constant_value)); + auto local = std::vector<size_t>{8, 8}; + auto global = std::vector<size_t>{Ceil(ld, 8), Ceil(n, 8)}; + RunKernel(kernel, queue, device, global, local, event, waitForEvents); +} + +// ================================================================================================= + // Copies or transposes a matrix and optionally pads/unpads it with zeros. This method is also able // to write to symmetric and triangular matrices through optional arguments. template <typename T> |