diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2016-03-30 16:17:16 +0200 |
---|---|---|
committer | cnugteren <web@cedricnugteren.nl> | 2016-03-30 16:13:32 -0700 |
commit | 6ecc0d089c80296cce3089734771279a30783f81 (patch) | |
tree | fb7e0dc3c8e04e6fe2f1e4761c386f98630689b8 /test | |
parent | 6e5f558746eec09eda6132754649419430a86f41 (diff) |
Added prototypes for the xROT and xROTG functions
Diffstat (limited to 'test')
-rw-r--r-- | test/correctness/routines/level1/xrot.cc | 26 | ||||
-rw-r--r-- | test/correctness/routines/level1/xrotg.cc | 26 | ||||
-rw-r--r-- | test/performance/routines/level1/xrot.cc | 33 | ||||
-rw-r--r-- | test/performance/routines/level1/xrotg.cc | 33 | ||||
-rw-r--r-- | test/wrapper_clblas.h | 65 |
5 files changed, 183 insertions, 0 deletions
diff --git a/test/correctness/routines/level1/xrot.cc b/test/correctness/routines/level1/xrot.cc new file mode 100644 index 00000000..4020ff13 --- /dev/null +++ b/test/correctness/routines/level1/xrot.cc @@ -0,0 +1,26 @@ + +// ================================================================================================= +// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This +// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max- +// width of 100 characters per line. +// +// Author(s): +// Cedric Nugteren <www.cedricnugteren.nl> +// +// ================================================================================================= + +#include "correctness/testblas.h" +#include "routines/level1/xrot.h" + +// Shortcuts to the clblast namespace +using float2 = clblast::float2; +using double2 = clblast::double2; + +// Main function (not within the clblast namespace) +int main(int argc, char *argv[]) { + clblast::RunTests<clblast::TestXrot<float>, float, float>(argc, argv, false, "SROT"); + clblast::RunTests<clblast::TestXrot<double>, double, double>(argc, argv, true, "DROT"); + return 0; +} + +// ================================================================================================= diff --git a/test/correctness/routines/level1/xrotg.cc b/test/correctness/routines/level1/xrotg.cc new file mode 100644 index 00000000..dd068992 --- /dev/null +++ b/test/correctness/routines/level1/xrotg.cc @@ -0,0 +1,26 @@ + +// ================================================================================================= +// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This +// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max- +// width of 100 characters per line. +// +// Author(s): +// Cedric Nugteren <www.cedricnugteren.nl> +// +// ================================================================================================= + +#include "correctness/testblas.h" +#include "routines/level1/xrotg.h" + +// Shortcuts to the clblast namespace +using float2 = clblast::float2; +using double2 = clblast::double2; + +// Main function (not within the clblast namespace) +int main(int argc, char *argv[]) { + clblast::RunTests<clblast::TestXrotg<float>, float, float>(argc, argv, false, "SROTG"); + clblast::RunTests<clblast::TestXrotg<double>, double, double>(argc, argv, true, "DROTG"); + return 0; +} + +// ================================================================================================= diff --git a/test/performance/routines/level1/xrot.cc b/test/performance/routines/level1/xrot.cc new file mode 100644 index 00000000..3ff59ace --- /dev/null +++ b/test/performance/routines/level1/xrot.cc @@ -0,0 +1,33 @@ + +// ================================================================================================= +// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This +// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max- +// width of 100 characters per line. +// +// Author(s): +// Cedric Nugteren <www.cedricnugteren.nl> +// +// ================================================================================================= + +#include "performance/client.h" +#include "routines/level1/xrot.h" + +// Shortcuts to the clblast namespace +using float2 = clblast::float2; +using double2 = clblast::double2; + +// Main function (not within the clblast namespace) +int main(int argc, char *argv[]) { + switch(clblast::GetPrecision(argc, argv, clblast::Precision::kSingle)) { + case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode"); + case clblast::Precision::kSingle: + clblast::RunClient<clblast::TestXrot<float>, float, float>(argc, argv); break; + case clblast::Precision::kDouble: + clblast::RunClient<clblast::TestXrot<double>, double, double>(argc, argv); break; + case clblast::Precision::kComplexSingle: throw std::runtime_error("Unsupported precision mode"); + case clblast::Precision::kComplexDouble: throw std::runtime_error("Unsupported precision mode"); + } + return 0; +} + +// ================================================================================================= diff --git a/test/performance/routines/level1/xrotg.cc b/test/performance/routines/level1/xrotg.cc new file mode 100644 index 00000000..0320c314 --- /dev/null +++ b/test/performance/routines/level1/xrotg.cc @@ -0,0 +1,33 @@ + +// ================================================================================================= +// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This +// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max- +// width of 100 characters per line. +// +// Author(s): +// Cedric Nugteren <www.cedricnugteren.nl> +// +// ================================================================================================= + +#include "performance/client.h" +#include "routines/level1/xrotg.h" + +// Shortcuts to the clblast namespace +using float2 = clblast::float2; +using double2 = clblast::double2; + +// Main function (not within the clblast namespace) +int main(int argc, char *argv[]) { + switch(clblast::GetPrecision(argc, argv, clblast::Precision::kSingle)) { + case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode"); + case clblast::Precision::kSingle: + clblast::RunClient<clblast::TestXrotg<float>, float, float>(argc, argv); break; + case clblast::Precision::kDouble: + clblast::RunClient<clblast::TestXrotg<double>, double, double>(argc, argv); break; + case clblast::Precision::kComplexSingle: throw std::runtime_error("Unsupported precision mode"); + case clblast::Precision::kComplexDouble: throw std::runtime_error("Unsupported precision mode"); + } + return 0; +} + +// ================================================================================================= diff --git a/test/wrapper_clblas.h b/test/wrapper_clblas.h index 23a02a45..553e3e66 100644 --- a/test/wrapper_clblas.h +++ b/test/wrapper_clblas.h @@ -25,6 +25,71 @@ namespace clblast { // BLAS level-1 (vector-vector) routines // ================================================================================================= +// Forwards the clBLAS calls for SROTG/DROTG +template <typename T> +clblasStatus clblasXrotg(cl_mem SA_buffer, const size_t SA_offset, + cl_mem SB_buffer, const size_t SB_offset, + cl_mem C_buffer, const size_t C_offset, + cl_mem S_buffer, const size_t S_offset, + cl_uint num_queues, cl_command_queue *queues, + cl_uint num_wait_events, const cl_event *wait_events, cl_event *events); +template <> +clblasStatus clblasXrotg<float>(cl_mem SA_buffer, const size_t SA_offset, + cl_mem SB_buffer, const size_t SB_offset, + cl_mem C_buffer, const size_t C_offset, + cl_mem S_buffer, const size_t S_offset, + cl_uint num_queues, cl_command_queue *queues, + cl_uint num_wait_events, const cl_event *wait_events, cl_event *events) { + return clblasSrotg(SA_buffer, SA_offset, + SB_buffer, SB_offset, + C_buffer, C_offset, + S_buffer, S_offset, + num_queues, queues, num_wait_events, wait_events, events); +} +template <> +clblasStatus clblasXrotg<double>(cl_mem SA_buffer, const size_t SA_offset, + cl_mem SB_buffer, const size_t SB_offset, + cl_mem C_buffer, const size_t C_offset, + cl_mem S_buffer, const size_t S_offset, + cl_uint num_queues, cl_command_queue *queues, + cl_uint num_wait_events, const cl_event *wait_events, cl_event *events) { + return clblasDrotg(SA_buffer, SA_offset, + SB_buffer, SB_offset, + C_buffer, C_offset, + S_buffer, S_offset, + num_queues, queues, num_wait_events, wait_events, events); +} + +// Forwards the clBLAS calls for SROT/DROT +clblasStatus clblasXrot(const size_t n, + cl_mem x_buffer, const size_t x_offset, const size_t x_inc, + cl_mem y_buffer, const size_t y_offset, const size_t y_inc, + const float C, + const float S, + cl_uint num_queues, cl_command_queue *queues, + cl_uint num_wait_events, const cl_event *wait_events, cl_event *events) { + return clblasSrot(n, + x_buffer, x_offset, static_cast<int>(x_inc), + y_buffer, y_offset, static_cast<int>(y_inc), + C, + S, + num_queues, queues, num_wait_events, wait_events, events); +} +clblasStatus clblasXrot(const size_t n, + cl_mem x_buffer, const size_t x_offset, const size_t x_inc, + cl_mem y_buffer, const size_t y_offset, const size_t y_inc, + const double C, + const double S, + cl_uint num_queues, cl_command_queue *queues, + cl_uint num_wait_events, const cl_event *wait_events, cl_event *events) { + return clblasDrot(n, + x_buffer, x_offset, static_cast<int>(x_inc), + y_buffer, y_offset, static_cast<int>(y_inc), + C, + S, + num_queues, queues, num_wait_events, wait_events, events); +} + // Forwards the clBLAS calls for SSWAP/DSWAP/CSWAP/ZSWAP template <typename T> clblasStatus clblasXswap(const size_t n, |