diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/clblast_blas.cpp | 4181 |
1 files changed, 2090 insertions, 2091 deletions
diff --git a/src/clblast_blas.cpp b/src/clblast_blas.cpp index 9b59a20d..6cc14583 100644 --- a/src/clblast_blas.cpp +++ b/src/clblast_blas.cpp @@ -19,16 +19,16 @@ #include "clblast.h" #include "utilities/utilities.hpp" -namespace clblast { - -// ================================================================================================= +// Shortcuts to the clblast namespace +using float2 = clblast::float2; +using double2 = clblast::double2; // Helper function to get a default OpenCL platform and device -Device get_device() { - auto platform_id = ConvertArgument(std::getenv("CLBLAST_PLATFORM"), size_t{0}); - auto device_id = ConvertArgument(std::getenv("CLBLAST_DEVICE"), size_t{0}); - auto platform = Platform(platform_id); - return Device(platform, device_id); +clblast::Device get_device() { + auto platform_id = clblast::ConvertArgument(std::getenv("CLBLAST_PLATFORM"), size_t{0}); + auto device_id = clblast::ConvertArgument(std::getenv("CLBLAST_DEVICE"), size_t{0}); + auto platform = clblast::Platform(platform_id); + return clblast::Device(platform, device_id); } // ================================================================================================= @@ -41,28 +41,28 @@ void cblas_srotg(float* sa, float* sc, float* ss) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto sa_size = 1; const auto sb_size = 1; const auto sc_size = 1; const auto ss_size = 1; - auto sa_buffer = Buffer<float>(context, sa_size); - auto sb_buffer = Buffer<float>(context, sb_size); - auto sc_buffer = Buffer<float>(context, sc_size); - auto ss_buffer = Buffer<float>(context, ss_size); + auto sa_buffer = clblast::Buffer<float>(context, sa_size); + auto sb_buffer = clblast::Buffer<float>(context, sb_size); + auto sc_buffer = clblast::Buffer<float>(context, sc_size); + auto ss_buffer = clblast::Buffer<float>(context, ss_size); sa_buffer.Write(queue, sa_size, reinterpret_cast<float*>(sa)); sb_buffer.Write(queue, sb_size, reinterpret_cast<float*>(sb)); sc_buffer.Write(queue, sc_size, reinterpret_cast<float*>(sc)); ss_buffer.Write(queue, ss_size, reinterpret_cast<float*>(ss)); auto queue_cl = queue(); - auto s = Rotg<float>(sa_buffer(), 0, - sb_buffer(), 0, - sc_buffer(), 0, - ss_buffer(), 0, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Rotg<float>(sa_buffer(), 0, + sb_buffer(), 0, + sc_buffer(), 0, + ss_buffer(), 0, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } sa_buffer.Read(queue, sa_size, reinterpret_cast<float*>(sa)); sb_buffer.Read(queue, sb_size, reinterpret_cast<float*>(sb)); @@ -74,28 +74,28 @@ void cblas_drotg(double* sa, double* sc, double* ss) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto sa_size = 1; const auto sb_size = 1; const auto sc_size = 1; const auto ss_size = 1; - auto sa_buffer = Buffer<double>(context, sa_size); - auto sb_buffer = Buffer<double>(context, sb_size); - auto sc_buffer = Buffer<double>(context, sc_size); - auto ss_buffer = Buffer<double>(context, ss_size); + auto sa_buffer = clblast::Buffer<double>(context, sa_size); + auto sb_buffer = clblast::Buffer<double>(context, sb_size); + auto sc_buffer = clblast::Buffer<double>(context, sc_size); + auto ss_buffer = clblast::Buffer<double>(context, ss_size); sa_buffer.Write(queue, sa_size, reinterpret_cast<double*>(sa)); sb_buffer.Write(queue, sb_size, reinterpret_cast<double*>(sb)); sc_buffer.Write(queue, sc_size, reinterpret_cast<double*>(sc)); ss_buffer.Write(queue, ss_size, reinterpret_cast<double*>(ss)); auto queue_cl = queue(); - auto s = Rotg<double>(sa_buffer(), 0, - sb_buffer(), 0, - sc_buffer(), 0, - ss_buffer(), 0, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Rotg<double>(sa_buffer(), 0, + sb_buffer(), 0, + sc_buffer(), 0, + ss_buffer(), 0, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } sa_buffer.Read(queue, sa_size, reinterpret_cast<double*>(sa)); sb_buffer.Read(queue, sb_size, reinterpret_cast<double*>(sb)); @@ -110,32 +110,32 @@ void cblas_srotmg(float* sd1, const float* sy1, float* sparam) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto sy1_size = 1; const auto sd1_size = 1; const auto sd2_size = 1; const auto sx1_size = 1; const auto sparam_size = 1; - auto sy1_buffer = Buffer<float>(context, sy1_size); - auto sd1_buffer = Buffer<float>(context, sd1_size); - auto sd2_buffer = Buffer<float>(context, sd2_size); - auto sx1_buffer = Buffer<float>(context, sx1_size); - auto sparam_buffer = Buffer<float>(context, sparam_size); + auto sy1_buffer = clblast::Buffer<float>(context, sy1_size); + auto sd1_buffer = clblast::Buffer<float>(context, sd1_size); + auto sd2_buffer = clblast::Buffer<float>(context, sd2_size); + auto sx1_buffer = clblast::Buffer<float>(context, sx1_size); + auto sparam_buffer = clblast::Buffer<float>(context, sparam_size); sy1_buffer.Write(queue, sy1_size, reinterpret_cast<const float*>(sy1)); sd1_buffer.Write(queue, sd1_size, reinterpret_cast<float*>(sd1)); sd2_buffer.Write(queue, sd2_size, reinterpret_cast<float*>(sd2)); sx1_buffer.Write(queue, sx1_size, reinterpret_cast<float*>(sx1)); sparam_buffer.Write(queue, sparam_size, reinterpret_cast<float*>(sparam)); auto queue_cl = queue(); - auto s = Rotmg<float>(sd1_buffer(), 0, - sd2_buffer(), 0, - sx1_buffer(), 0, - sy1_buffer(), 0, - sparam_buffer(), 0, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Rotmg<float>(sd1_buffer(), 0, + sd2_buffer(), 0, + sx1_buffer(), 0, + sy1_buffer(), 0, + sparam_buffer(), 0, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } sd1_buffer.Read(queue, sd1_size, reinterpret_cast<float*>(sd1)); sd2_buffer.Read(queue, sd2_size, reinterpret_cast<float*>(sd2)); @@ -148,32 +148,32 @@ void cblas_drotmg(double* sd1, const double* sy1, double* sparam) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto sy1_size = 1; const auto sd1_size = 1; const auto sd2_size = 1; const auto sx1_size = 1; const auto sparam_size = 1; - auto sy1_buffer = Buffer<double>(context, sy1_size); - auto sd1_buffer = Buffer<double>(context, sd1_size); - auto sd2_buffer = Buffer<double>(context, sd2_size); - auto sx1_buffer = Buffer<double>(context, sx1_size); - auto sparam_buffer = Buffer<double>(context, sparam_size); + auto sy1_buffer = clblast::Buffer<double>(context, sy1_size); + auto sd1_buffer = clblast::Buffer<double>(context, sd1_size); + auto sd2_buffer = clblast::Buffer<double>(context, sd2_size); + auto sx1_buffer = clblast::Buffer<double>(context, sx1_size); + auto sparam_buffer = clblast::Buffer<double>(context, sparam_size); sy1_buffer.Write(queue, sy1_size, reinterpret_cast<const double*>(sy1)); sd1_buffer.Write(queue, sd1_size, reinterpret_cast<double*>(sd1)); sd2_buffer.Write(queue, sd2_size, reinterpret_cast<double*>(sd2)); sx1_buffer.Write(queue, sx1_size, reinterpret_cast<double*>(sx1)); sparam_buffer.Write(queue, sparam_size, reinterpret_cast<double*>(sparam)); auto queue_cl = queue(); - auto s = Rotmg<double>(sd1_buffer(), 0, - sd2_buffer(), 0, - sx1_buffer(), 0, - sy1_buffer(), 0, - sparam_buffer(), 0, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Rotmg<double>(sd1_buffer(), 0, + sd2_buffer(), 0, + sx1_buffer(), 0, + sy1_buffer(), 0, + sparam_buffer(), 0, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } sd1_buffer.Read(queue, sd1_size, reinterpret_cast<double*>(sd1)); sd2_buffer.Read(queue, sd2_size, reinterpret_cast<double*>(sd2)); @@ -188,23 +188,23 @@ void cblas_srot(const int n, const float cos, const float sin) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; - auto x_buffer = Buffer<float>(context, x_size); - auto y_buffer = Buffer<float>(context, y_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto y_buffer = clblast::Buffer<float>(context, y_size); x_buffer.Write(queue, x_size, reinterpret_cast<float*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float*>(y)); auto queue_cl = queue(); - auto s = Rot(n, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - cos, - sin, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Rot(n, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + cos, + sin, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float*>(x)); y_buffer.Read(queue, y_size, reinterpret_cast<float*>(y)); @@ -215,23 +215,23 @@ void cblas_drot(const int n, const double cos, const double sin) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; - auto x_buffer = Buffer<double>(context, x_size); - auto y_buffer = Buffer<double>(context, y_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto y_buffer = clblast::Buffer<double>(context, y_size); x_buffer.Write(queue, x_size, reinterpret_cast<double*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double*>(y)); auto queue_cl = queue(); - auto s = Rot(n, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - cos, - sin, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Rot(n, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + cos, + sin, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double*>(x)); y_buffer.Read(queue, y_size, reinterpret_cast<double*>(y)); @@ -243,25 +243,25 @@ void cblas_srotm(const int n, float* y, const int y_inc, float* sparam) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; const auto sparam_size = 1; - auto x_buffer = Buffer<float>(context, x_size); - auto y_buffer = Buffer<float>(context, y_size); - auto sparam_buffer = Buffer<float>(context, sparam_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto y_buffer = clblast::Buffer<float>(context, y_size); + auto sparam_buffer = clblast::Buffer<float>(context, sparam_size); x_buffer.Write(queue, x_size, reinterpret_cast<float*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float*>(y)); sparam_buffer.Write(queue, sparam_size, reinterpret_cast<float*>(sparam)); auto queue_cl = queue(); - auto s = Rotm<float>(n, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - sparam_buffer(), 0, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Rotm<float>(n, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + sparam_buffer(), 0, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float*>(x)); y_buffer.Read(queue, y_size, reinterpret_cast<float*>(y)); @@ -272,25 +272,25 @@ void cblas_drotm(const int n, double* y, const int y_inc, double* sparam) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; const auto sparam_size = 1; - auto x_buffer = Buffer<double>(context, x_size); - auto y_buffer = Buffer<double>(context, y_size); - auto sparam_buffer = Buffer<double>(context, sparam_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto y_buffer = clblast::Buffer<double>(context, y_size); + auto sparam_buffer = clblast::Buffer<double>(context, sparam_size); x_buffer.Write(queue, x_size, reinterpret_cast<double*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double*>(y)); sparam_buffer.Write(queue, sparam_size, reinterpret_cast<double*>(sparam)); auto queue_cl = queue(); - auto s = Rotm<double>(n, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - sparam_buffer(), 0, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Rotm<double>(n, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + sparam_buffer(), 0, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double*>(x)); y_buffer.Read(queue, y_size, reinterpret_cast<double*>(y)); @@ -302,21 +302,21 @@ void cblas_sswap(const int n, float* x, const int x_inc, float* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; - auto x_buffer = Buffer<float>(context, x_size); - auto y_buffer = Buffer<float>(context, y_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto y_buffer = clblast::Buffer<float>(context, y_size); x_buffer.Write(queue, x_size, reinterpret_cast<float*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float*>(y)); auto queue_cl = queue(); - auto s = Swap<float>(n, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Swap<float>(n, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float*>(x)); y_buffer.Read(queue, y_size, reinterpret_cast<float*>(y)); @@ -325,21 +325,21 @@ void cblas_dswap(const int n, double* x, const int x_inc, double* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; - auto x_buffer = Buffer<double>(context, x_size); - auto y_buffer = Buffer<double>(context, y_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto y_buffer = clblast::Buffer<double>(context, y_size); x_buffer.Write(queue, x_size, reinterpret_cast<double*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double*>(y)); auto queue_cl = queue(); - auto s = Swap<double>(n, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Swap<double>(n, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double*>(x)); y_buffer.Read(queue, y_size, reinterpret_cast<double*>(y)); @@ -348,21 +348,21 @@ void cblas_cswap(const int n, void* x, const int x_inc, void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; - auto x_buffer = Buffer<float2>(context, x_size); - auto y_buffer = Buffer<float2>(context, y_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto y_buffer = clblast::Buffer<float2>(context, y_size); x_buffer.Write(queue, x_size, reinterpret_cast<float2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float2*>(y)); auto queue_cl = queue(); - auto s = Swap<float2>(n, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Swap<float2>(n, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float2*>(x)); y_buffer.Read(queue, y_size, reinterpret_cast<float2*>(y)); @@ -371,21 +371,21 @@ void cblas_zswap(const int n, void* x, const int x_inc, void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; - auto x_buffer = Buffer<double2>(context, x_size); - auto y_buffer = Buffer<double2>(context, y_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto y_buffer = clblast::Buffer<double2>(context, y_size); x_buffer.Write(queue, x_size, reinterpret_cast<double2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double2*>(y)); auto queue_cl = queue(); - auto s = Swap<double2>(n, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Swap<double2>(n, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double2*>(x)); y_buffer.Read(queue, y_size, reinterpret_cast<double2*>(y)); @@ -396,19 +396,19 @@ void cblas_sscal(const int n, const float alpha, float* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = n; - auto x_buffer = Buffer<float>(context, x_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); x_buffer.Write(queue, x_size, reinterpret_cast<float*>(x)); auto queue_cl = queue(); - auto s = Scal(n, - alpha_cpp, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Scal(n, + alpha_cpp, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float*>(x)); } @@ -416,19 +416,19 @@ void cblas_dscal(const int n, const double alpha, double* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = n; - auto x_buffer = Buffer<double>(context, x_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); x_buffer.Write(queue, x_size, reinterpret_cast<double*>(x)); auto queue_cl = queue(); - auto s = Scal(n, - alpha_cpp, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Scal(n, + alpha_cpp, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double*>(x)); } @@ -436,19 +436,19 @@ void cblas_cscal(const int n, const void* alpha, void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto x_size = n; - auto x_buffer = Buffer<float2>(context, x_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); x_buffer.Write(queue, x_size, reinterpret_cast<float2*>(x)); auto queue_cl = queue(); - auto s = Scal(n, - alpha_cpp, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Scal(n, + alpha_cpp, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float2*>(x)); } @@ -456,19 +456,19 @@ void cblas_zscal(const int n, const void* alpha, void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto x_size = n; - auto x_buffer = Buffer<double2>(context, x_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); x_buffer.Write(queue, x_size, reinterpret_cast<double2*>(x)); auto queue_cl = queue(); - auto s = Scal(n, - alpha_cpp, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Scal(n, + alpha_cpp, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double2*>(x)); } @@ -478,21 +478,21 @@ void cblas_scopy(const int n, const float* x, const int x_inc, float* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; - auto x_buffer = Buffer<float>(context, x_size); - auto y_buffer = Buffer<float>(context, y_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto y_buffer = clblast::Buffer<float>(context, y_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float*>(y)); auto queue_cl = queue(); - auto s = Copy<float>(n, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Copy<float>(n, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<float*>(y)); } @@ -500,21 +500,21 @@ void cblas_dcopy(const int n, const double* x, const int x_inc, double* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; - auto x_buffer = Buffer<double>(context, x_size); - auto y_buffer = Buffer<double>(context, y_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto y_buffer = clblast::Buffer<double>(context, y_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double*>(y)); auto queue_cl = queue(); - auto s = Copy<double>(n, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Copy<double>(n, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<double*>(y)); } @@ -522,21 +522,21 @@ void cblas_ccopy(const int n, const void* x, const int x_inc, void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; - auto x_buffer = Buffer<float2>(context, x_size); - auto y_buffer = Buffer<float2>(context, y_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto y_buffer = clblast::Buffer<float2>(context, y_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float2*>(y)); auto queue_cl = queue(); - auto s = Copy<float2>(n, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Copy<float2>(n, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<float2*>(y)); } @@ -544,21 +544,21 @@ void cblas_zcopy(const int n, const void* x, const int x_inc, void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; - auto x_buffer = Buffer<double2>(context, x_size); - auto y_buffer = Buffer<double2>(context, y_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto y_buffer = clblast::Buffer<double2>(context, y_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double2*>(y)); auto queue_cl = queue(); - auto s = Copy<double2>(n, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Copy<double2>(n, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<double2*>(y)); } @@ -569,23 +569,23 @@ void cblas_saxpy(const int n, const float* x, const int x_inc, float* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = n; const auto y_size = n; - auto x_buffer = Buffer<float>(context, x_size); - auto y_buffer = Buffer<float>(context, y_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto y_buffer = clblast::Buffer<float>(context, y_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float*>(y)); auto queue_cl = queue(); - auto s = Axpy(n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Axpy(n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<float*>(y)); } @@ -594,23 +594,23 @@ void cblas_daxpy(const int n, const double* x, const int x_inc, double* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = n; const auto y_size = n; - auto x_buffer = Buffer<double>(context, x_size); - auto y_buffer = Buffer<double>(context, y_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto y_buffer = clblast::Buffer<double>(context, y_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double*>(y)); auto queue_cl = queue(); - auto s = Axpy(n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Axpy(n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<double*>(y)); } @@ -619,23 +619,23 @@ void cblas_caxpy(const int n, const void* x, const int x_inc, void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto x_size = n; const auto y_size = n; - auto x_buffer = Buffer<float2>(context, x_size); - auto y_buffer = Buffer<float2>(context, y_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto y_buffer = clblast::Buffer<float2>(context, y_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float2*>(y)); auto queue_cl = queue(); - auto s = Axpy(n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Axpy(n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<float2*>(y)); } @@ -644,23 +644,23 @@ void cblas_zaxpy(const int n, const void* x, const int x_inc, void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto x_size = n; const auto y_size = n; - auto x_buffer = Buffer<double2>(context, x_size); - auto y_buffer = Buffer<double2>(context, y_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto y_buffer = clblast::Buffer<double2>(context, y_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double2*>(y)); auto queue_cl = queue(); - auto s = Axpy(n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Axpy(n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<double2*>(y)); } @@ -671,25 +671,25 @@ void cblas_sdot(const int n, const float* x, const int x_inc, const float* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; const auto dot_size = 1; - auto x_buffer = Buffer<float>(context, x_size); - auto y_buffer = Buffer<float>(context, y_size); - auto dot_buffer = Buffer<float>(context, dot_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto y_buffer = clblast::Buffer<float>(context, y_size); + auto dot_buffer = clblast::Buffer<float>(context, dot_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const float*>(y)); dot_buffer.Write(queue, dot_size, reinterpret_cast<float*>(dot)); auto queue_cl = queue(); - auto s = Dot<float>(n, - dot_buffer(), 0, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Dot<float>(n, + dot_buffer(), 0, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } dot_buffer.Read(queue, dot_size, reinterpret_cast<float*>(dot)); } @@ -698,25 +698,25 @@ void cblas_ddot(const int n, const double* x, const int x_inc, const double* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; const auto dot_size = 1; - auto x_buffer = Buffer<double>(context, x_size); - auto y_buffer = Buffer<double>(context, y_size); - auto dot_buffer = Buffer<double>(context, dot_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto y_buffer = clblast::Buffer<double>(context, y_size); + auto dot_buffer = clblast::Buffer<double>(context, dot_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const double*>(y)); dot_buffer.Write(queue, dot_size, reinterpret_cast<double*>(dot)); auto queue_cl = queue(); - auto s = Dot<double>(n, - dot_buffer(), 0, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Dot<double>(n, + dot_buffer(), 0, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } dot_buffer.Read(queue, dot_size, reinterpret_cast<double*>(dot)); } @@ -727,25 +727,25 @@ void cblas_cdotu(const int n, const void* x, const int x_inc, const void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; const auto dot_size = 1; - auto x_buffer = Buffer<float2>(context, x_size); - auto y_buffer = Buffer<float2>(context, y_size); - auto dot_buffer = Buffer<float2>(context, dot_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto y_buffer = clblast::Buffer<float2>(context, y_size); + auto dot_buffer = clblast::Buffer<float2>(context, dot_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const float2*>(y)); dot_buffer.Write(queue, dot_size, reinterpret_cast<float2*>(dot)); auto queue_cl = queue(); - auto s = Dotu<float2>(n, - dot_buffer(), 0, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Dotu<float2>(n, + dot_buffer(), 0, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } dot_buffer.Read(queue, dot_size, reinterpret_cast<float2*>(dot)); } @@ -754,25 +754,25 @@ void cblas_zdotu(const int n, const void* x, const int x_inc, const void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; const auto dot_size = 1; - auto x_buffer = Buffer<double2>(context, x_size); - auto y_buffer = Buffer<double2>(context, y_size); - auto dot_buffer = Buffer<double2>(context, dot_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto y_buffer = clblast::Buffer<double2>(context, y_size); + auto dot_buffer = clblast::Buffer<double2>(context, dot_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const double2*>(y)); dot_buffer.Write(queue, dot_size, reinterpret_cast<double2*>(dot)); auto queue_cl = queue(); - auto s = Dotu<double2>(n, - dot_buffer(), 0, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Dotu<double2>(n, + dot_buffer(), 0, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } dot_buffer.Read(queue, dot_size, reinterpret_cast<double2*>(dot)); } @@ -783,25 +783,25 @@ void cblas_cdotc(const int n, const void* x, const int x_inc, const void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; const auto dot_size = 1; - auto x_buffer = Buffer<float2>(context, x_size); - auto y_buffer = Buffer<float2>(context, y_size); - auto dot_buffer = Buffer<float2>(context, dot_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto y_buffer = clblast::Buffer<float2>(context, y_size); + auto dot_buffer = clblast::Buffer<float2>(context, dot_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const float2*>(y)); dot_buffer.Write(queue, dot_size, reinterpret_cast<float2*>(dot)); auto queue_cl = queue(); - auto s = Dotc<float2>(n, - dot_buffer(), 0, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Dotc<float2>(n, + dot_buffer(), 0, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } dot_buffer.Read(queue, dot_size, reinterpret_cast<float2*>(dot)); } @@ -810,25 +810,25 @@ void cblas_zdotc(const int n, const void* x, const int x_inc, const void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto y_size = n; const auto dot_size = 1; - auto x_buffer = Buffer<double2>(context, x_size); - auto y_buffer = Buffer<double2>(context, y_size); - auto dot_buffer = Buffer<double2>(context, dot_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto y_buffer = clblast::Buffer<double2>(context, y_size); + auto dot_buffer = clblast::Buffer<double2>(context, dot_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const double2*>(y)); dot_buffer.Write(queue, dot_size, reinterpret_cast<double2*>(dot)); auto queue_cl = queue(); - auto s = Dotc<double2>(n, - dot_buffer(), 0, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Dotc<double2>(n, + dot_buffer(), 0, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } dot_buffer.Read(queue, dot_size, reinterpret_cast<double2*>(dot)); } @@ -838,21 +838,21 @@ void cblas_snrm2(const int n, float* nrm2, const float* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto nrm2_size = 1; - auto x_buffer = Buffer<float>(context, x_size); - auto nrm2_buffer = Buffer<float>(context, nrm2_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto nrm2_buffer = clblast::Buffer<float>(context, nrm2_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); nrm2_buffer.Write(queue, nrm2_size, reinterpret_cast<float*>(nrm2)); auto queue_cl = queue(); - auto s = Nrm2<float>(n, - nrm2_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Nrm2<float>(n, + nrm2_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } nrm2_buffer.Read(queue, nrm2_size, reinterpret_cast<float*>(nrm2)); } @@ -860,21 +860,21 @@ void cblas_dnrm2(const int n, double* nrm2, const double* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto nrm2_size = 1; - auto x_buffer = Buffer<double>(context, x_size); - auto nrm2_buffer = Buffer<double>(context, nrm2_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto nrm2_buffer = clblast::Buffer<double>(context, nrm2_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); nrm2_buffer.Write(queue, nrm2_size, reinterpret_cast<double*>(nrm2)); auto queue_cl = queue(); - auto s = Nrm2<double>(n, - nrm2_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Nrm2<double>(n, + nrm2_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } nrm2_buffer.Read(queue, nrm2_size, reinterpret_cast<double*>(nrm2)); } @@ -882,21 +882,21 @@ void cblas_scnrm2(const int n, void* nrm2, const void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto nrm2_size = 1; - auto x_buffer = Buffer<float2>(context, x_size); - auto nrm2_buffer = Buffer<float2>(context, nrm2_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto nrm2_buffer = clblast::Buffer<float2>(context, nrm2_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); nrm2_buffer.Write(queue, nrm2_size, reinterpret_cast<float2*>(nrm2)); auto queue_cl = queue(); - auto s = Nrm2<float2>(n, - nrm2_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Nrm2<float2>(n, + nrm2_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } nrm2_buffer.Read(queue, nrm2_size, reinterpret_cast<float2*>(nrm2)); } @@ -904,21 +904,21 @@ void cblas_dznrm2(const int n, void* nrm2, const void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto nrm2_size = 1; - auto x_buffer = Buffer<double2>(context, x_size); - auto nrm2_buffer = Buffer<double2>(context, nrm2_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto nrm2_buffer = clblast::Buffer<double2>(context, nrm2_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); nrm2_buffer.Write(queue, nrm2_size, reinterpret_cast<double2*>(nrm2)); auto queue_cl = queue(); - auto s = Nrm2<double2>(n, - nrm2_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Nrm2<double2>(n, + nrm2_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } nrm2_buffer.Read(queue, nrm2_size, reinterpret_cast<double2*>(nrm2)); } @@ -928,21 +928,21 @@ void cblas_sasum(const int n, float* asum, const float* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto asum_size = 1; - auto x_buffer = Buffer<float>(context, x_size); - auto asum_buffer = Buffer<float>(context, asum_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto asum_buffer = clblast::Buffer<float>(context, asum_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); asum_buffer.Write(queue, asum_size, reinterpret_cast<float*>(asum)); auto queue_cl = queue(); - auto s = Asum<float>(n, - asum_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Asum<float>(n, + asum_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } asum_buffer.Read(queue, asum_size, reinterpret_cast<float*>(asum)); } @@ -950,21 +950,21 @@ void cblas_dasum(const int n, double* asum, const double* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto asum_size = 1; - auto x_buffer = Buffer<double>(context, x_size); - auto asum_buffer = Buffer<double>(context, asum_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto asum_buffer = clblast::Buffer<double>(context, asum_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); asum_buffer.Write(queue, asum_size, reinterpret_cast<double*>(asum)); auto queue_cl = queue(); - auto s = Asum<double>(n, - asum_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Asum<double>(n, + asum_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } asum_buffer.Read(queue, asum_size, reinterpret_cast<double*>(asum)); } @@ -972,21 +972,21 @@ void cblas_scasum(const int n, void* asum, const void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto asum_size = 1; - auto x_buffer = Buffer<float2>(context, x_size); - auto asum_buffer = Buffer<float2>(context, asum_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto asum_buffer = clblast::Buffer<float2>(context, asum_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); asum_buffer.Write(queue, asum_size, reinterpret_cast<float2*>(asum)); auto queue_cl = queue(); - auto s = Asum<float2>(n, - asum_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Asum<float2>(n, + asum_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } asum_buffer.Read(queue, asum_size, reinterpret_cast<float2*>(asum)); } @@ -994,21 +994,21 @@ void cblas_dzasum(const int n, void* asum, const void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto asum_size = 1; - auto x_buffer = Buffer<double2>(context, x_size); - auto asum_buffer = Buffer<double2>(context, asum_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto asum_buffer = clblast::Buffer<double2>(context, asum_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); asum_buffer.Write(queue, asum_size, reinterpret_cast<double2*>(asum)); auto queue_cl = queue(); - auto s = Asum<double2>(n, - asum_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Asum<double2>(n, + asum_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } asum_buffer.Read(queue, asum_size, reinterpret_cast<double2*>(asum)); } @@ -1018,21 +1018,21 @@ void cblas_ssum(const int n, float* sum, const float* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto sum_size = 1; - auto x_buffer = Buffer<float>(context, x_size); - auto sum_buffer = Buffer<float>(context, sum_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto sum_buffer = clblast::Buffer<float>(context, sum_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); sum_buffer.Write(queue, sum_size, reinterpret_cast<float*>(sum)); auto queue_cl = queue(); - auto s = Sum<float>(n, - sum_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Sum<float>(n, + sum_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } sum_buffer.Read(queue, sum_size, reinterpret_cast<float*>(sum)); } @@ -1040,21 +1040,21 @@ void cblas_dsum(const int n, double* sum, const double* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto sum_size = 1; - auto x_buffer = Buffer<double>(context, x_size); - auto sum_buffer = Buffer<double>(context, sum_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto sum_buffer = clblast::Buffer<double>(context, sum_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); sum_buffer.Write(queue, sum_size, reinterpret_cast<double*>(sum)); auto queue_cl = queue(); - auto s = Sum<double>(n, - sum_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Sum<double>(n, + sum_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } sum_buffer.Read(queue, sum_size, reinterpret_cast<double*>(sum)); } @@ -1062,21 +1062,21 @@ void cblas_scsum(const int n, void* sum, const void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto sum_size = 1; - auto x_buffer = Buffer<float2>(context, x_size); - auto sum_buffer = Buffer<float2>(context, sum_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto sum_buffer = clblast::Buffer<float2>(context, sum_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); sum_buffer.Write(queue, sum_size, reinterpret_cast<float2*>(sum)); auto queue_cl = queue(); - auto s = Sum<float2>(n, - sum_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Sum<float2>(n, + sum_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } sum_buffer.Read(queue, sum_size, reinterpret_cast<float2*>(sum)); } @@ -1084,21 +1084,21 @@ void cblas_dzsum(const int n, void* sum, const void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto sum_size = 1; - auto x_buffer = Buffer<double2>(context, x_size); - auto sum_buffer = Buffer<double2>(context, sum_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto sum_buffer = clblast::Buffer<double2>(context, sum_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); sum_buffer.Write(queue, sum_size, reinterpret_cast<double2*>(sum)); auto queue_cl = queue(); - auto s = Sum<double2>(n, - sum_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Sum<double2>(n, + sum_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } sum_buffer.Read(queue, sum_size, reinterpret_cast<double2*>(sum)); } @@ -1108,21 +1108,21 @@ void cblas_isamax(const int n, float* imax, const float* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto imax_size = 1; - auto x_buffer = Buffer<float>(context, x_size); - auto imax_buffer = Buffer<float>(context, imax_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto imax_buffer = clblast::Buffer<float>(context, imax_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); imax_buffer.Write(queue, imax_size, reinterpret_cast<float*>(imax)); auto queue_cl = queue(); - auto s = Amax<float>(n, - imax_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Amax<float>(n, + imax_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } imax_buffer.Read(queue, imax_size, reinterpret_cast<float*>(imax)); } @@ -1130,21 +1130,21 @@ void cblas_idamax(const int n, double* imax, const double* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto imax_size = 1; - auto x_buffer = Buffer<double>(context, x_size); - auto imax_buffer = Buffer<double>(context, imax_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto imax_buffer = clblast::Buffer<double>(context, imax_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); imax_buffer.Write(queue, imax_size, reinterpret_cast<double*>(imax)); auto queue_cl = queue(); - auto s = Amax<double>(n, - imax_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Amax<double>(n, + imax_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } imax_buffer.Read(queue, imax_size, reinterpret_cast<double*>(imax)); } @@ -1152,21 +1152,21 @@ void cblas_icamax(const int n, void* imax, const void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto imax_size = 1; - auto x_buffer = Buffer<float2>(context, x_size); - auto imax_buffer = Buffer<float2>(context, imax_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto imax_buffer = clblast::Buffer<float2>(context, imax_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); imax_buffer.Write(queue, imax_size, reinterpret_cast<float2*>(imax)); auto queue_cl = queue(); - auto s = Amax<float2>(n, - imax_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Amax<float2>(n, + imax_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } imax_buffer.Read(queue, imax_size, reinterpret_cast<float2*>(imax)); } @@ -1174,21 +1174,21 @@ void cblas_izamax(const int n, void* imax, const void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto imax_size = 1; - auto x_buffer = Buffer<double2>(context, x_size); - auto imax_buffer = Buffer<double2>(context, imax_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto imax_buffer = clblast::Buffer<double2>(context, imax_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); imax_buffer.Write(queue, imax_size, reinterpret_cast<double2*>(imax)); auto queue_cl = queue(); - auto s = Amax<double2>(n, - imax_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Amax<double2>(n, + imax_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } imax_buffer.Read(queue, imax_size, reinterpret_cast<double2*>(imax)); } @@ -1198,21 +1198,21 @@ void cblas_ismax(const int n, float* imax, const float* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto imax_size = 1; - auto x_buffer = Buffer<float>(context, x_size); - auto imax_buffer = Buffer<float>(context, imax_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto imax_buffer = clblast::Buffer<float>(context, imax_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); imax_buffer.Write(queue, imax_size, reinterpret_cast<float*>(imax)); auto queue_cl = queue(); - auto s = Max<float>(n, - imax_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Max<float>(n, + imax_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } imax_buffer.Read(queue, imax_size, reinterpret_cast<float*>(imax)); } @@ -1220,21 +1220,21 @@ void cblas_idmax(const int n, double* imax, const double* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto imax_size = 1; - auto x_buffer = Buffer<double>(context, x_size); - auto imax_buffer = Buffer<double>(context, imax_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto imax_buffer = clblast::Buffer<double>(context, imax_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); imax_buffer.Write(queue, imax_size, reinterpret_cast<double*>(imax)); auto queue_cl = queue(); - auto s = Max<double>(n, - imax_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Max<double>(n, + imax_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } imax_buffer.Read(queue, imax_size, reinterpret_cast<double*>(imax)); } @@ -1242,21 +1242,21 @@ void cblas_icmax(const int n, void* imax, const void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto imax_size = 1; - auto x_buffer = Buffer<float2>(context, x_size); - auto imax_buffer = Buffer<float2>(context, imax_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto imax_buffer = clblast::Buffer<float2>(context, imax_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); imax_buffer.Write(queue, imax_size, reinterpret_cast<float2*>(imax)); auto queue_cl = queue(); - auto s = Max<float2>(n, - imax_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Max<float2>(n, + imax_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } imax_buffer.Read(queue, imax_size, reinterpret_cast<float2*>(imax)); } @@ -1264,21 +1264,21 @@ void cblas_izmax(const int n, void* imax, const void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto imax_size = 1; - auto x_buffer = Buffer<double2>(context, x_size); - auto imax_buffer = Buffer<double2>(context, imax_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto imax_buffer = clblast::Buffer<double2>(context, imax_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); imax_buffer.Write(queue, imax_size, reinterpret_cast<double2*>(imax)); auto queue_cl = queue(); - auto s = Max<double2>(n, - imax_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Max<double2>(n, + imax_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } imax_buffer.Read(queue, imax_size, reinterpret_cast<double2*>(imax)); } @@ -1288,21 +1288,21 @@ void cblas_ismin(const int n, float* imin, const float* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto imin_size = 1; - auto x_buffer = Buffer<float>(context, x_size); - auto imin_buffer = Buffer<float>(context, imin_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto imin_buffer = clblast::Buffer<float>(context, imin_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); imin_buffer.Write(queue, imin_size, reinterpret_cast<float*>(imin)); auto queue_cl = queue(); - auto s = Min<float>(n, - imin_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Min<float>(n, + imin_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } imin_buffer.Read(queue, imin_size, reinterpret_cast<float*>(imin)); } @@ -1310,21 +1310,21 @@ void cblas_idmin(const int n, double* imin, const double* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto imin_size = 1; - auto x_buffer = Buffer<double>(context, x_size); - auto imin_buffer = Buffer<double>(context, imin_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto imin_buffer = clblast::Buffer<double>(context, imin_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); imin_buffer.Write(queue, imin_size, reinterpret_cast<double*>(imin)); auto queue_cl = queue(); - auto s = Min<double>(n, - imin_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Min<double>(n, + imin_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } imin_buffer.Read(queue, imin_size, reinterpret_cast<double*>(imin)); } @@ -1332,21 +1332,21 @@ void cblas_icmin(const int n, void* imin, const void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto imin_size = 1; - auto x_buffer = Buffer<float2>(context, x_size); - auto imin_buffer = Buffer<float2>(context, imin_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto imin_buffer = clblast::Buffer<float2>(context, imin_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); imin_buffer.Write(queue, imin_size, reinterpret_cast<float2*>(imin)); auto queue_cl = queue(); - auto s = Min<float2>(n, - imin_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Min<float2>(n, + imin_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } imin_buffer.Read(queue, imin_size, reinterpret_cast<float2*>(imin)); } @@ -1354,21 +1354,21 @@ void cblas_izmin(const int n, void* imin, const void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto x_size = n; const auto imin_size = 1; - auto x_buffer = Buffer<double2>(context, x_size); - auto imin_buffer = Buffer<double2>(context, imin_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto imin_buffer = clblast::Buffer<double2>(context, imin_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); imin_buffer.Write(queue, imin_size, reinterpret_cast<double2*>(imin)); auto queue_cl = queue(); - auto s = Min<double2>(n, - imin_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Min<double2>(n, + imin_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } imin_buffer.Read(queue, imin_size, reinterpret_cast<double2*>(imin)); } @@ -1386,31 +1386,31 @@ void cblas_sgemv(const CLBlastLayout layout, const CLBlastTranspose a_transpose, const float beta, float* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; const auto x_size = (a_transpose != CLBlastTransposeNo) ? m * x_inc : n * x_inc; const auto y_size = (a_transpose != CLBlastTransposeNo) ? n * y_inc : m * y_inc; - auto a_buffer = Buffer<float>(context, a_size); - auto x_buffer = Buffer<float>(context, x_size); - auto y_buffer = Buffer<float>(context, y_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto y_buffer = clblast::Buffer<float>(context, y_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float*>(y)); auto queue_cl = queue(); - auto s = Gemv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Transpose>(a_transpose), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Gemv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Transpose>(a_transpose), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<float*>(y)); } @@ -1422,31 +1422,31 @@ void cblas_dgemv(const CLBlastLayout layout, const CLBlastTranspose a_transpose, const double beta, double* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; const auto x_size = (a_transpose != CLBlastTransposeNo) ? m * x_inc : n * x_inc; const auto y_size = (a_transpose != CLBlastTransposeNo) ? n * y_inc : m * y_inc; - auto a_buffer = Buffer<double>(context, a_size); - auto x_buffer = Buffer<double>(context, x_size); - auto y_buffer = Buffer<double>(context, y_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto y_buffer = clblast::Buffer<double>(context, y_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double*>(y)); auto queue_cl = queue(); - auto s = Gemv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Transpose>(a_transpose), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Gemv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Transpose>(a_transpose), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<double*>(y)); } @@ -1458,31 +1458,31 @@ void cblas_cgemv(const CLBlastLayout layout, const CLBlastTranspose a_transpose, const void* beta, void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto beta_cpp = float2{reinterpret_cast<const float*>(beta)[0], reinterpret_cast<const float*>(beta)[1]}; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; const auto x_size = (a_transpose != CLBlastTransposeNo) ? m * x_inc : n * x_inc; const auto y_size = (a_transpose != CLBlastTransposeNo) ? n * y_inc : m * y_inc; - auto a_buffer = Buffer<float2>(context, a_size); - auto x_buffer = Buffer<float2>(context, x_size); - auto y_buffer = Buffer<float2>(context, y_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto y_buffer = clblast::Buffer<float2>(context, y_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float2*>(y)); auto queue_cl = queue(); - auto s = Gemv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Transpose>(a_transpose), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Gemv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Transpose>(a_transpose), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<float2*>(y)); } @@ -1494,31 +1494,31 @@ void cblas_zgemv(const CLBlastLayout layout, const CLBlastTranspose a_transpose, const void* beta, void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto beta_cpp = double2{reinterpret_cast<const double*>(beta)[0], reinterpret_cast<const double*>(beta)[1]}; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; const auto x_size = (a_transpose != CLBlastTransposeNo) ? m * x_inc : n * x_inc; const auto y_size = (a_transpose != CLBlastTransposeNo) ? n * y_inc : m * y_inc; - auto a_buffer = Buffer<double2>(context, a_size); - auto x_buffer = Buffer<double2>(context, x_size); - auto y_buffer = Buffer<double2>(context, y_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto y_buffer = clblast::Buffer<double2>(context, y_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double2*>(y)); auto queue_cl = queue(); - auto s = Gemv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Transpose>(a_transpose), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Gemv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Transpose>(a_transpose), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<double2*>(y)); } @@ -1532,31 +1532,31 @@ void cblas_sgbmv(const CLBlastLayout layout, const CLBlastTranspose a_transpose, const float beta, float* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; const auto x_size = (a_transpose != CLBlastTransposeNo) ? m * x_inc : n * x_inc; const auto y_size = (a_transpose != CLBlastTransposeNo) ? n * y_inc : m * y_inc; - auto a_buffer = Buffer<float>(context, a_size); - auto x_buffer = Buffer<float>(context, x_size); - auto y_buffer = Buffer<float>(context, y_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto y_buffer = clblast::Buffer<float>(context, y_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float*>(y)); auto queue_cl = queue(); - auto s = Gbmv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Transpose>(a_transpose), - m, n, kl, ku, - alpha_cpp, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Gbmv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Transpose>(a_transpose), + m, n, kl, ku, + alpha_cpp, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<float*>(y)); } @@ -1568,31 +1568,31 @@ void cblas_dgbmv(const CLBlastLayout layout, const CLBlastTranspose a_transpose, const double beta, double* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; const auto x_size = (a_transpose != CLBlastTransposeNo) ? m * x_inc : n * x_inc; const auto y_size = (a_transpose != CLBlastTransposeNo) ? n * y_inc : m * y_inc; - auto a_buffer = Buffer<double>(context, a_size); - auto x_buffer = Buffer<double>(context, x_size); - auto y_buffer = Buffer<double>(context, y_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto y_buffer = clblast::Buffer<double>(context, y_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double*>(y)); auto queue_cl = queue(); - auto s = Gbmv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Transpose>(a_transpose), - m, n, kl, ku, - alpha_cpp, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Gbmv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Transpose>(a_transpose), + m, n, kl, ku, + alpha_cpp, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<double*>(y)); } @@ -1604,31 +1604,31 @@ void cblas_cgbmv(const CLBlastLayout layout, const CLBlastTranspose a_transpose, const void* beta, void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto beta_cpp = float2{reinterpret_cast<const float*>(beta)[0], reinterpret_cast<const float*>(beta)[1]}; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; const auto x_size = (a_transpose != CLBlastTransposeNo) ? m * x_inc : n * x_inc; const auto y_size = (a_transpose != CLBlastTransposeNo) ? n * y_inc : m * y_inc; - auto a_buffer = Buffer<float2>(context, a_size); - auto x_buffer = Buffer<float2>(context, x_size); - auto y_buffer = Buffer<float2>(context, y_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto y_buffer = clblast::Buffer<float2>(context, y_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float2*>(y)); auto queue_cl = queue(); - auto s = Gbmv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Transpose>(a_transpose), - m, n, kl, ku, - alpha_cpp, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Gbmv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Transpose>(a_transpose), + m, n, kl, ku, + alpha_cpp, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<float2*>(y)); } @@ -1640,31 +1640,31 @@ void cblas_zgbmv(const CLBlastLayout layout, const CLBlastTranspose a_transpose, const void* beta, void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto beta_cpp = double2{reinterpret_cast<const double*>(beta)[0], reinterpret_cast<const double*>(beta)[1]}; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; const auto x_size = (a_transpose != CLBlastTransposeNo) ? m * x_inc : n * x_inc; const auto y_size = (a_transpose != CLBlastTransposeNo) ? n * y_inc : m * y_inc; - auto a_buffer = Buffer<double2>(context, a_size); - auto x_buffer = Buffer<double2>(context, x_size); - auto y_buffer = Buffer<double2>(context, y_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto y_buffer = clblast::Buffer<double2>(context, y_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double2*>(y)); auto queue_cl = queue(); - auto s = Gbmv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Transpose>(a_transpose), - m, n, kl, ku, - alpha_cpp, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Gbmv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Transpose>(a_transpose), + m, n, kl, ku, + alpha_cpp, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<double2*>(y)); } @@ -1678,31 +1678,31 @@ void cblas_chemv(const CLBlastLayout layout, const CLBlastTriangle triangle, const void* beta, void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto beta_cpp = float2{reinterpret_cast<const float*>(beta)[0], reinterpret_cast<const float*>(beta)[1]}; const auto a_size = n * a_ld; const auto x_size = n * x_inc; const auto y_size = n * y_inc; - auto a_buffer = Buffer<float2>(context, a_size); - auto x_buffer = Buffer<float2>(context, x_size); - auto y_buffer = Buffer<float2>(context, y_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto y_buffer = clblast::Buffer<float2>(context, y_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float2*>(y)); auto queue_cl = queue(); - auto s = Hemv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Hemv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<float2*>(y)); } @@ -1714,31 +1714,31 @@ void cblas_zhemv(const CLBlastLayout layout, const CLBlastTriangle triangle, const void* beta, void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto beta_cpp = double2{reinterpret_cast<const double*>(beta)[0], reinterpret_cast<const double*>(beta)[1]}; const auto a_size = n * a_ld; const auto x_size = n * x_inc; const auto y_size = n * y_inc; - auto a_buffer = Buffer<double2>(context, a_size); - auto x_buffer = Buffer<double2>(context, x_size); - auto y_buffer = Buffer<double2>(context, y_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto y_buffer = clblast::Buffer<double2>(context, y_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double2*>(y)); auto queue_cl = queue(); - auto s = Hemv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Hemv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<double2*>(y)); } @@ -1752,31 +1752,31 @@ void cblas_chbmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const void* beta, void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto beta_cpp = float2{reinterpret_cast<const float*>(beta)[0], reinterpret_cast<const float*>(beta)[1]}; const auto a_size = n * a_ld; const auto x_size = n * x_inc; const auto y_size = n * y_inc; - auto a_buffer = Buffer<float2>(context, a_size); - auto x_buffer = Buffer<float2>(context, x_size); - auto y_buffer = Buffer<float2>(context, y_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto y_buffer = clblast::Buffer<float2>(context, y_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float2*>(y)); auto queue_cl = queue(); - auto s = Hbmv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Hbmv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<float2*>(y)); } @@ -1788,31 +1788,31 @@ void cblas_zhbmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const void* beta, void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto beta_cpp = double2{reinterpret_cast<const double*>(beta)[0], reinterpret_cast<const double*>(beta)[1]}; const auto a_size = n * a_ld; const auto x_size = n * x_inc; const auto y_size = n * y_inc; - auto a_buffer = Buffer<double2>(context, a_size); - auto x_buffer = Buffer<double2>(context, x_size); - auto y_buffer = Buffer<double2>(context, y_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto y_buffer = clblast::Buffer<double2>(context, y_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double2*>(y)); auto queue_cl = queue(); - auto s = Hbmv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Hbmv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<double2*>(y)); } @@ -1826,31 +1826,31 @@ void cblas_chpmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const void* beta, void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto beta_cpp = float2{reinterpret_cast<const float*>(beta)[0], reinterpret_cast<const float*>(beta)[1]}; const auto ap_size = ((n*(n+1)) / 2); const auto x_size = n * x_inc; const auto y_size = n * y_inc; - auto ap_buffer = Buffer<float2>(context, ap_size); - auto x_buffer = Buffer<float2>(context, x_size); - auto y_buffer = Buffer<float2>(context, y_size); + auto ap_buffer = clblast::Buffer<float2>(context, ap_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto y_buffer = clblast::Buffer<float2>(context, y_size); ap_buffer.Write(queue, ap_size, reinterpret_cast<const float2*>(ap)); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float2*>(y)); auto queue_cl = queue(); - auto s = Hpmv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - ap_buffer(), 0, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Hpmv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + ap_buffer(), 0, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<float2*>(y)); } @@ -1862,31 +1862,31 @@ void cblas_zhpmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const void* beta, void* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto beta_cpp = double2{reinterpret_cast<const double*>(beta)[0], reinterpret_cast<const double*>(beta)[1]}; const auto ap_size = ((n*(n+1)) / 2); const auto x_size = n * x_inc; const auto y_size = n * y_inc; - auto ap_buffer = Buffer<double2>(context, ap_size); - auto x_buffer = Buffer<double2>(context, x_size); - auto y_buffer = Buffer<double2>(context, y_size); + auto ap_buffer = clblast::Buffer<double2>(context, ap_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto y_buffer = clblast::Buffer<double2>(context, y_size); ap_buffer.Write(queue, ap_size, reinterpret_cast<const double2*>(ap)); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double2*>(y)); auto queue_cl = queue(); - auto s = Hpmv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - ap_buffer(), 0, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Hpmv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + ap_buffer(), 0, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<double2*>(y)); } @@ -1900,31 +1900,31 @@ void cblas_ssymv(const CLBlastLayout layout, const CLBlastTriangle triangle, const float beta, float* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = n * a_ld; const auto x_size = n * x_inc; const auto y_size = n * y_inc; - auto a_buffer = Buffer<float>(context, a_size); - auto x_buffer = Buffer<float>(context, x_size); - auto y_buffer = Buffer<float>(context, y_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto y_buffer = clblast::Buffer<float>(context, y_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float*>(y)); auto queue_cl = queue(); - auto s = Symv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Symv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<float*>(y)); } @@ -1936,31 +1936,31 @@ void cblas_dsymv(const CLBlastLayout layout, const CLBlastTriangle triangle, const double beta, double* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = n * a_ld; const auto x_size = n * x_inc; const auto y_size = n * y_inc; - auto a_buffer = Buffer<double>(context, a_size); - auto x_buffer = Buffer<double>(context, x_size); - auto y_buffer = Buffer<double>(context, y_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto y_buffer = clblast::Buffer<double>(context, y_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double*>(y)); auto queue_cl = queue(); - auto s = Symv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Symv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<double*>(y)); } @@ -1974,31 +1974,31 @@ void cblas_ssbmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const float beta, float* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = n * a_ld; const auto x_size = n * x_inc; const auto y_size = n * y_inc; - auto a_buffer = Buffer<float>(context, a_size); - auto x_buffer = Buffer<float>(context, x_size); - auto y_buffer = Buffer<float>(context, y_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto y_buffer = clblast::Buffer<float>(context, y_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float*>(y)); auto queue_cl = queue(); - auto s = Sbmv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Sbmv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<float*>(y)); } @@ -2010,31 +2010,31 @@ void cblas_dsbmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const double beta, double* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = n * a_ld; const auto x_size = n * x_inc; const auto y_size = n * y_inc; - auto a_buffer = Buffer<double>(context, a_size); - auto x_buffer = Buffer<double>(context, x_size); - auto y_buffer = Buffer<double>(context, y_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto y_buffer = clblast::Buffer<double>(context, y_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double*>(y)); auto queue_cl = queue(); - auto s = Sbmv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Sbmv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<double*>(y)); } @@ -2048,31 +2048,31 @@ void cblas_sspmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const float beta, float* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto ap_size = ((n*(n+1)) / 2); const auto x_size = n * x_inc; const auto y_size = n * y_inc; - auto ap_buffer = Buffer<float>(context, ap_size); - auto x_buffer = Buffer<float>(context, x_size); - auto y_buffer = Buffer<float>(context, y_size); + auto ap_buffer = clblast::Buffer<float>(context, ap_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto y_buffer = clblast::Buffer<float>(context, y_size); ap_buffer.Write(queue, ap_size, reinterpret_cast<const float*>(ap)); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<float*>(y)); auto queue_cl = queue(); - auto s = Spmv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - ap_buffer(), 0, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Spmv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + ap_buffer(), 0, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<float*>(y)); } @@ -2084,31 +2084,31 @@ void cblas_dspmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const double beta, double* y, const int y_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto ap_size = ((n*(n+1)) / 2); const auto x_size = n * x_inc; const auto y_size = n * y_inc; - auto ap_buffer = Buffer<double>(context, ap_size); - auto x_buffer = Buffer<double>(context, x_size); - auto y_buffer = Buffer<double>(context, y_size); + auto ap_buffer = clblast::Buffer<double>(context, ap_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto y_buffer = clblast::Buffer<double>(context, y_size); ap_buffer.Write(queue, ap_size, reinterpret_cast<const double*>(ap)); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<double*>(y)); auto queue_cl = queue(); - auto s = Spmv(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - ap_buffer(), 0, - x_buffer(), 0, x_inc, - beta_cpp, - y_buffer(), 0, y_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Spmv(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + ap_buffer(), 0, + x_buffer(), 0, x_inc, + beta_cpp, + y_buffer(), 0, y_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } y_buffer.Read(queue, y_size, reinterpret_cast<double*>(y)); } @@ -2119,25 +2119,25 @@ void cblas_strmv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const float* a, const int a_ld, float* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto a_size = n * a_ld; const auto x_size = n * x_inc; - auto a_buffer = Buffer<float>(context, a_size); - auto x_buffer = Buffer<float>(context, x_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<float*>(x)); auto queue_cl = queue(); - auto s = Trmv<float>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Trmv<float>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float*>(x)); } @@ -2146,25 +2146,25 @@ void cblas_dtrmv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const double* a, const int a_ld, double* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto a_size = n * a_ld; const auto x_size = n * x_inc; - auto a_buffer = Buffer<double>(context, a_size); - auto x_buffer = Buffer<double>(context, x_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<double*>(x)); auto queue_cl = queue(); - auto s = Trmv<double>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Trmv<double>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double*>(x)); } @@ -2173,25 +2173,25 @@ void cblas_ctrmv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const void* a, const int a_ld, void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto a_size = n * a_ld; const auto x_size = n * x_inc; - auto a_buffer = Buffer<float2>(context, a_size); - auto x_buffer = Buffer<float2>(context, x_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<float2*>(x)); auto queue_cl = queue(); - auto s = Trmv<float2>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Trmv<float2>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float2*>(x)); } @@ -2200,25 +2200,25 @@ void cblas_ztrmv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const void* a, const int a_ld, void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto a_size = n * a_ld; const auto x_size = n * x_inc; - auto a_buffer = Buffer<double2>(context, a_size); - auto x_buffer = Buffer<double2>(context, x_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<double2*>(x)); auto queue_cl = queue(); - auto s = Trmv<double2>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Trmv<double2>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double2*>(x)); } @@ -2229,25 +2229,25 @@ void cblas_stbmv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const float* a, const int a_ld, float* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto a_size = n * a_ld; const auto x_size = n * x_inc; - auto a_buffer = Buffer<float>(context, a_size); - auto x_buffer = Buffer<float>(context, x_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<float*>(x)); auto queue_cl = queue(); - auto s = Tbmv<float>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, k, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Tbmv<float>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, k, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float*>(x)); } @@ -2256,25 +2256,25 @@ void cblas_dtbmv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const double* a, const int a_ld, double* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto a_size = n * a_ld; const auto x_size = n * x_inc; - auto a_buffer = Buffer<double>(context, a_size); - auto x_buffer = Buffer<double>(context, x_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<double*>(x)); auto queue_cl = queue(); - auto s = Tbmv<double>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, k, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Tbmv<double>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, k, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double*>(x)); } @@ -2283,25 +2283,25 @@ void cblas_ctbmv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const void* a, const int a_ld, void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto a_size = n * a_ld; const auto x_size = n * x_inc; - auto a_buffer = Buffer<float2>(context, a_size); - auto x_buffer = Buffer<float2>(context, x_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<float2*>(x)); auto queue_cl = queue(); - auto s = Tbmv<float2>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, k, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Tbmv<float2>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, k, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float2*>(x)); } @@ -2310,25 +2310,25 @@ void cblas_ztbmv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const void* a, const int a_ld, void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto a_size = n * a_ld; const auto x_size = n * x_inc; - auto a_buffer = Buffer<double2>(context, a_size); - auto x_buffer = Buffer<double2>(context, x_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<double2*>(x)); auto queue_cl = queue(); - auto s = Tbmv<double2>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, k, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Tbmv<double2>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, k, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double2*>(x)); } @@ -2339,25 +2339,25 @@ void cblas_stpmv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const float* ap, float* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto ap_size = ((n*(n+1)) / 2); const auto x_size = n * x_inc; - auto ap_buffer = Buffer<float>(context, ap_size); - auto x_buffer = Buffer<float>(context, x_size); + auto ap_buffer = clblast::Buffer<float>(context, ap_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); ap_buffer.Write(queue, ap_size, reinterpret_cast<const float*>(ap)); x_buffer.Write(queue, x_size, reinterpret_cast<float*>(x)); auto queue_cl = queue(); - auto s = Tpmv<float>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, - ap_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Tpmv<float>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, + ap_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float*>(x)); } @@ -2366,25 +2366,25 @@ void cblas_dtpmv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const double* ap, double* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto ap_size = ((n*(n+1)) / 2); const auto x_size = n * x_inc; - auto ap_buffer = Buffer<double>(context, ap_size); - auto x_buffer = Buffer<double>(context, x_size); + auto ap_buffer = clblast::Buffer<double>(context, ap_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); ap_buffer.Write(queue, ap_size, reinterpret_cast<const double*>(ap)); x_buffer.Write(queue, x_size, reinterpret_cast<double*>(x)); auto queue_cl = queue(); - auto s = Tpmv<double>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, - ap_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Tpmv<double>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, + ap_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double*>(x)); } @@ -2393,25 +2393,25 @@ void cblas_ctpmv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const void* ap, void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto ap_size = ((n*(n+1)) / 2); const auto x_size = n * x_inc; - auto ap_buffer = Buffer<float2>(context, ap_size); - auto x_buffer = Buffer<float2>(context, x_size); + auto ap_buffer = clblast::Buffer<float2>(context, ap_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); ap_buffer.Write(queue, ap_size, reinterpret_cast<const float2*>(ap)); x_buffer.Write(queue, x_size, reinterpret_cast<float2*>(x)); auto queue_cl = queue(); - auto s = Tpmv<float2>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, - ap_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Tpmv<float2>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, + ap_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float2*>(x)); } @@ -2420,25 +2420,25 @@ void cblas_ztpmv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const void* ap, void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto ap_size = ((n*(n+1)) / 2); const auto x_size = n * x_inc; - auto ap_buffer = Buffer<double2>(context, ap_size); - auto x_buffer = Buffer<double2>(context, x_size); + auto ap_buffer = clblast::Buffer<double2>(context, ap_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); ap_buffer.Write(queue, ap_size, reinterpret_cast<const double2*>(ap)); x_buffer.Write(queue, x_size, reinterpret_cast<double2*>(x)); auto queue_cl = queue(); - auto s = Tpmv<double2>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, - ap_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Tpmv<double2>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, + ap_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double2*>(x)); } @@ -2449,25 +2449,25 @@ void cblas_strsv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const float* a, const int a_ld, float* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto a_size = n * a_ld; const auto x_size = n * x_inc; - auto a_buffer = Buffer<float>(context, a_size); - auto x_buffer = Buffer<float>(context, x_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<float*>(x)); auto queue_cl = queue(); - auto s = Trsv<float>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Trsv<float>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float*>(x)); } @@ -2476,25 +2476,25 @@ void cblas_dtrsv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const double* a, const int a_ld, double* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto a_size = n * a_ld; const auto x_size = n * x_inc; - auto a_buffer = Buffer<double>(context, a_size); - auto x_buffer = Buffer<double>(context, x_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<double*>(x)); auto queue_cl = queue(); - auto s = Trsv<double>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Trsv<double>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double*>(x)); } @@ -2503,25 +2503,25 @@ void cblas_ctrsv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const void* a, const int a_ld, void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto a_size = n * a_ld; const auto x_size = n * x_inc; - auto a_buffer = Buffer<float2>(context, a_size); - auto x_buffer = Buffer<float2>(context, x_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<float2*>(x)); auto queue_cl = queue(); - auto s = Trsv<float2>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Trsv<float2>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float2*>(x)); } @@ -2530,25 +2530,25 @@ void cblas_ztrsv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const void* a, const int a_ld, void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto a_size = n * a_ld; const auto x_size = n * x_inc; - auto a_buffer = Buffer<double2>(context, a_size); - auto x_buffer = Buffer<double2>(context, x_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<double2*>(x)); auto queue_cl = queue(); - auto s = Trsv<double2>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Trsv<double2>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double2*>(x)); } @@ -2559,25 +2559,25 @@ void cblas_stbsv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const float* a, const int a_ld, float* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto a_size = n * a_ld; const auto x_size = n * x_inc; - auto a_buffer = Buffer<float>(context, a_size); - auto x_buffer = Buffer<float>(context, x_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<float*>(x)); auto queue_cl = queue(); - auto s = Tbsv<float>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, k, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Tbsv<float>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, k, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float*>(x)); } @@ -2586,25 +2586,25 @@ void cblas_dtbsv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const double* a, const int a_ld, double* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto a_size = n * a_ld; const auto x_size = n * x_inc; - auto a_buffer = Buffer<double>(context, a_size); - auto x_buffer = Buffer<double>(context, x_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<double*>(x)); auto queue_cl = queue(); - auto s = Tbsv<double>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, k, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Tbsv<double>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, k, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double*>(x)); } @@ -2613,25 +2613,25 @@ void cblas_ctbsv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const void* a, const int a_ld, void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto a_size = n * a_ld; const auto x_size = n * x_inc; - auto a_buffer = Buffer<float2>(context, a_size); - auto x_buffer = Buffer<float2>(context, x_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<float2*>(x)); auto queue_cl = queue(); - auto s = Tbsv<float2>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, k, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Tbsv<float2>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, k, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float2*>(x)); } @@ -2640,25 +2640,25 @@ void cblas_ztbsv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const void* a, const int a_ld, void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto a_size = n * a_ld; const auto x_size = n * x_inc; - auto a_buffer = Buffer<double2>(context, a_size); - auto x_buffer = Buffer<double2>(context, x_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); x_buffer.Write(queue, x_size, reinterpret_cast<double2*>(x)); auto queue_cl = queue(); - auto s = Tbsv<double2>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, k, - a_buffer(), 0, a_ld, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Tbsv<double2>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, k, + a_buffer(), 0, a_ld, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double2*>(x)); } @@ -2669,25 +2669,25 @@ void cblas_stpsv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const float* ap, float* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto ap_size = ((n*(n+1)) / 2); const auto x_size = n * x_inc; - auto ap_buffer = Buffer<float>(context, ap_size); - auto x_buffer = Buffer<float>(context, x_size); + auto ap_buffer = clblast::Buffer<float>(context, ap_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); ap_buffer.Write(queue, ap_size, reinterpret_cast<const float*>(ap)); x_buffer.Write(queue, x_size, reinterpret_cast<float*>(x)); auto queue_cl = queue(); - auto s = Tpsv<float>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, - ap_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Tpsv<float>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, + ap_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float*>(x)); } @@ -2696,25 +2696,25 @@ void cblas_dtpsv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const double* ap, double* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto ap_size = ((n*(n+1)) / 2); const auto x_size = n * x_inc; - auto ap_buffer = Buffer<double>(context, ap_size); - auto x_buffer = Buffer<double>(context, x_size); + auto ap_buffer = clblast::Buffer<double>(context, ap_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); ap_buffer.Write(queue, ap_size, reinterpret_cast<const double*>(ap)); x_buffer.Write(queue, x_size, reinterpret_cast<double*>(x)); auto queue_cl = queue(); - auto s = Tpsv<double>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, - ap_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Tpsv<double>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, + ap_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double*>(x)); } @@ -2723,25 +2723,25 @@ void cblas_ctpsv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const void* ap, void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto ap_size = ((n*(n+1)) / 2); const auto x_size = n * x_inc; - auto ap_buffer = Buffer<float2>(context, ap_size); - auto x_buffer = Buffer<float2>(context, x_size); + auto ap_buffer = clblast::Buffer<float2>(context, ap_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); ap_buffer.Write(queue, ap_size, reinterpret_cast<const float2*>(ap)); x_buffer.Write(queue, x_size, reinterpret_cast<float2*>(x)); auto queue_cl = queue(); - auto s = Tpsv<float2>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, - ap_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Tpsv<float2>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, + ap_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<float2*>(x)); } @@ -2750,25 +2750,25 @@ void cblas_ztpsv(const CLBlastLayout layout, const CLBlastTriangle triangle, con const void* ap, void* x, const int x_inc) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto ap_size = ((n*(n+1)) / 2); const auto x_size = n * x_inc; - auto ap_buffer = Buffer<double2>(context, ap_size); - auto x_buffer = Buffer<double2>(context, x_size); + auto ap_buffer = clblast::Buffer<double2>(context, ap_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); ap_buffer.Write(queue, ap_size, reinterpret_cast<const double2*>(ap)); x_buffer.Write(queue, x_size, reinterpret_cast<double2*>(x)); auto queue_cl = queue(); - auto s = Tpsv<double2>(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - n, - ap_buffer(), 0, - x_buffer(), 0, x_inc, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Tpsv<double2>(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + n, + ap_buffer(), 0, + x_buffer(), 0, x_inc, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } x_buffer.Read(queue, x_size, reinterpret_cast<double2*>(x)); } @@ -2781,28 +2781,28 @@ void cblas_sger(const CLBlastLayout layout, const float* y, const int y_inc, float* a, const int a_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = m * x_inc; const auto y_size = n * y_inc; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; - auto x_buffer = Buffer<float>(context, x_size); - auto y_buffer = Buffer<float>(context, y_size); - auto a_buffer = Buffer<float>(context, a_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto y_buffer = clblast::Buffer<float>(context, y_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const float*>(y)); a_buffer.Write(queue, a_size, reinterpret_cast<float*>(a)); auto queue_cl = queue(); - auto s = Ger(static_cast<clblast::Layout>(layout), - m, n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - a_buffer(), 0, a_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Ger(static_cast<clblast::Layout>(layout), + m, n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + a_buffer(), 0, a_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } a_buffer.Read(queue, a_size, reinterpret_cast<float*>(a)); } @@ -2813,28 +2813,28 @@ void cblas_dger(const CLBlastLayout layout, const double* y, const int y_inc, double* a, const int a_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = m * x_inc; const auto y_size = n * y_inc; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; - auto x_buffer = Buffer<double>(context, x_size); - auto y_buffer = Buffer<double>(context, y_size); - auto a_buffer = Buffer<double>(context, a_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto y_buffer = clblast::Buffer<double>(context, y_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const double*>(y)); a_buffer.Write(queue, a_size, reinterpret_cast<double*>(a)); auto queue_cl = queue(); - auto s = Ger(static_cast<clblast::Layout>(layout), - m, n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - a_buffer(), 0, a_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Ger(static_cast<clblast::Layout>(layout), + m, n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + a_buffer(), 0, a_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } a_buffer.Read(queue, a_size, reinterpret_cast<double*>(a)); } @@ -2847,28 +2847,28 @@ void cblas_cgeru(const CLBlastLayout layout, const void* y, const int y_inc, void* a, const int a_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto x_size = m * x_inc; const auto y_size = n * y_inc; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; - auto x_buffer = Buffer<float2>(context, x_size); - auto y_buffer = Buffer<float2>(context, y_size); - auto a_buffer = Buffer<float2>(context, a_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto y_buffer = clblast::Buffer<float2>(context, y_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const float2*>(y)); a_buffer.Write(queue, a_size, reinterpret_cast<float2*>(a)); auto queue_cl = queue(); - auto s = Geru(static_cast<clblast::Layout>(layout), - m, n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - a_buffer(), 0, a_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Geru(static_cast<clblast::Layout>(layout), + m, n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + a_buffer(), 0, a_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } a_buffer.Read(queue, a_size, reinterpret_cast<float2*>(a)); } @@ -2879,28 +2879,28 @@ void cblas_zgeru(const CLBlastLayout layout, const void* y, const int y_inc, void* a, const int a_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto x_size = m * x_inc; const auto y_size = n * y_inc; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; - auto x_buffer = Buffer<double2>(context, x_size); - auto y_buffer = Buffer<double2>(context, y_size); - auto a_buffer = Buffer<double2>(context, a_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto y_buffer = clblast::Buffer<double2>(context, y_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const double2*>(y)); a_buffer.Write(queue, a_size, reinterpret_cast<double2*>(a)); auto queue_cl = queue(); - auto s = Geru(static_cast<clblast::Layout>(layout), - m, n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - a_buffer(), 0, a_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Geru(static_cast<clblast::Layout>(layout), + m, n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + a_buffer(), 0, a_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } a_buffer.Read(queue, a_size, reinterpret_cast<double2*>(a)); } @@ -2913,28 +2913,28 @@ void cblas_cgerc(const CLBlastLayout layout, const void* y, const int y_inc, void* a, const int a_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto x_size = m * x_inc; const auto y_size = n * y_inc; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; - auto x_buffer = Buffer<float2>(context, x_size); - auto y_buffer = Buffer<float2>(context, y_size); - auto a_buffer = Buffer<float2>(context, a_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto y_buffer = clblast::Buffer<float2>(context, y_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const float2*>(y)); a_buffer.Write(queue, a_size, reinterpret_cast<float2*>(a)); auto queue_cl = queue(); - auto s = Gerc(static_cast<clblast::Layout>(layout), - m, n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - a_buffer(), 0, a_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Gerc(static_cast<clblast::Layout>(layout), + m, n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + a_buffer(), 0, a_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } a_buffer.Read(queue, a_size, reinterpret_cast<float2*>(a)); } @@ -2945,28 +2945,28 @@ void cblas_zgerc(const CLBlastLayout layout, const void* y, const int y_inc, void* a, const int a_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto x_size = m * x_inc; const auto y_size = n * y_inc; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; - auto x_buffer = Buffer<double2>(context, x_size); - auto y_buffer = Buffer<double2>(context, y_size); - auto a_buffer = Buffer<double2>(context, a_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto y_buffer = clblast::Buffer<double2>(context, y_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const double2*>(y)); a_buffer.Write(queue, a_size, reinterpret_cast<double2*>(a)); auto queue_cl = queue(); - auto s = Gerc(static_cast<clblast::Layout>(layout), - m, n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - a_buffer(), 0, a_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Gerc(static_cast<clblast::Layout>(layout), + m, n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + a_buffer(), 0, a_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } a_buffer.Read(queue, a_size, reinterpret_cast<double2*>(a)); } @@ -2978,25 +2978,25 @@ void cblas_cher(const CLBlastLayout layout, const CLBlastTriangle triangle, const void* x, const int x_inc, void* a, const int a_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = n * x_inc; const auto a_size = n * a_ld; - auto x_buffer = Buffer<float2>(context, x_size); - auto a_buffer = Buffer<float2>(context, a_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); a_buffer.Write(queue, a_size, reinterpret_cast<float2*>(a)); auto queue_cl = queue(); - auto s = Her(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - x_buffer(), 0, x_inc, - a_buffer(), 0, a_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Her(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + x_buffer(), 0, x_inc, + a_buffer(), 0, a_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } a_buffer.Read(queue, a_size, reinterpret_cast<float2*>(a)); } @@ -3006,25 +3006,25 @@ void cblas_zher(const CLBlastLayout layout, const CLBlastTriangle triangle, const void* x, const int x_inc, void* a, const int a_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = n * x_inc; const auto a_size = n * a_ld; - auto x_buffer = Buffer<double2>(context, x_size); - auto a_buffer = Buffer<double2>(context, a_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); a_buffer.Write(queue, a_size, reinterpret_cast<double2*>(a)); auto queue_cl = queue(); - auto s = Her(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - x_buffer(), 0, x_inc, - a_buffer(), 0, a_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Her(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + x_buffer(), 0, x_inc, + a_buffer(), 0, a_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } a_buffer.Read(queue, a_size, reinterpret_cast<double2*>(a)); } @@ -3036,25 +3036,25 @@ void cblas_chpr(const CLBlastLayout layout, const CLBlastTriangle triangle, const void* x, const int x_inc, void* ap) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = n * x_inc; const auto ap_size = ((n*(n+1)) / 2); - auto x_buffer = Buffer<float2>(context, x_size); - auto ap_buffer = Buffer<float2>(context, ap_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto ap_buffer = clblast::Buffer<float2>(context, ap_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); ap_buffer.Write(queue, ap_size, reinterpret_cast<float2*>(ap)); auto queue_cl = queue(); - auto s = Hpr(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - x_buffer(), 0, x_inc, - ap_buffer(), 0, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Hpr(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + x_buffer(), 0, x_inc, + ap_buffer(), 0, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } ap_buffer.Read(queue, ap_size, reinterpret_cast<float2*>(ap)); } @@ -3064,25 +3064,25 @@ void cblas_zhpr(const CLBlastLayout layout, const CLBlastTriangle triangle, const void* x, const int x_inc, void* ap) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = n * x_inc; const auto ap_size = ((n*(n+1)) / 2); - auto x_buffer = Buffer<double2>(context, x_size); - auto ap_buffer = Buffer<double2>(context, ap_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto ap_buffer = clblast::Buffer<double2>(context, ap_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); ap_buffer.Write(queue, ap_size, reinterpret_cast<double2*>(ap)); auto queue_cl = queue(); - auto s = Hpr(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - x_buffer(), 0, x_inc, - ap_buffer(), 0, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Hpr(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + x_buffer(), 0, x_inc, + ap_buffer(), 0, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } ap_buffer.Read(queue, ap_size, reinterpret_cast<double2*>(ap)); } @@ -3095,29 +3095,29 @@ void cblas_cher2(const CLBlastLayout layout, const CLBlastTriangle triangle, const void* y, const int y_inc, void* a, const int a_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto x_size = n * x_inc; const auto y_size = n * y_inc; const auto a_size = n * a_ld; - auto x_buffer = Buffer<float2>(context, x_size); - auto y_buffer = Buffer<float2>(context, y_size); - auto a_buffer = Buffer<float2>(context, a_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto y_buffer = clblast::Buffer<float2>(context, y_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const float2*>(y)); a_buffer.Write(queue, a_size, reinterpret_cast<float2*>(a)); auto queue_cl = queue(); - auto s = Her2(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - a_buffer(), 0, a_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Her2(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + a_buffer(), 0, a_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } a_buffer.Read(queue, a_size, reinterpret_cast<float2*>(a)); } @@ -3128,29 +3128,29 @@ void cblas_zher2(const CLBlastLayout layout, const CLBlastTriangle triangle, const void* y, const int y_inc, void* a, const int a_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto x_size = n * x_inc; const auto y_size = n * y_inc; const auto a_size = n * a_ld; - auto x_buffer = Buffer<double2>(context, x_size); - auto y_buffer = Buffer<double2>(context, y_size); - auto a_buffer = Buffer<double2>(context, a_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto y_buffer = clblast::Buffer<double2>(context, y_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const double2*>(y)); a_buffer.Write(queue, a_size, reinterpret_cast<double2*>(a)); auto queue_cl = queue(); - auto s = Her2(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - a_buffer(), 0, a_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Her2(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + a_buffer(), 0, a_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } a_buffer.Read(queue, a_size, reinterpret_cast<double2*>(a)); } @@ -3163,29 +3163,29 @@ void cblas_chpr2(const CLBlastLayout layout, const CLBlastTriangle triangle, const void* y, const int y_inc, void* ap) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto x_size = n * x_inc; const auto y_size = n * y_inc; const auto ap_size = ((n*(n+1)) / 2); - auto x_buffer = Buffer<float2>(context, x_size); - auto y_buffer = Buffer<float2>(context, y_size); - auto ap_buffer = Buffer<float2>(context, ap_size); + auto x_buffer = clblast::Buffer<float2>(context, x_size); + auto y_buffer = clblast::Buffer<float2>(context, y_size); + auto ap_buffer = clblast::Buffer<float2>(context, ap_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const float2*>(y)); ap_buffer.Write(queue, ap_size, reinterpret_cast<float2*>(ap)); auto queue_cl = queue(); - auto s = Hpr2(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - ap_buffer(), 0, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Hpr2(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + ap_buffer(), 0, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } ap_buffer.Read(queue, ap_size, reinterpret_cast<float2*>(ap)); } @@ -3196,29 +3196,29 @@ void cblas_zhpr2(const CLBlastLayout layout, const CLBlastTriangle triangle, const void* y, const int y_inc, void* ap) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto x_size = n * x_inc; const auto y_size = n * y_inc; const auto ap_size = ((n*(n+1)) / 2); - auto x_buffer = Buffer<double2>(context, x_size); - auto y_buffer = Buffer<double2>(context, y_size); - auto ap_buffer = Buffer<double2>(context, ap_size); + auto x_buffer = clblast::Buffer<double2>(context, x_size); + auto y_buffer = clblast::Buffer<double2>(context, y_size); + auto ap_buffer = clblast::Buffer<double2>(context, ap_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double2*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const double2*>(y)); ap_buffer.Write(queue, ap_size, reinterpret_cast<double2*>(ap)); auto queue_cl = queue(); - auto s = Hpr2(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - ap_buffer(), 0, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Hpr2(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + ap_buffer(), 0, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } ap_buffer.Read(queue, ap_size, reinterpret_cast<double2*>(ap)); } @@ -3230,25 +3230,25 @@ void cblas_ssyr(const CLBlastLayout layout, const CLBlastTriangle triangle, const float* x, const int x_inc, float* a, const int a_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = n * x_inc; const auto a_size = n * a_ld; - auto x_buffer = Buffer<float>(context, x_size); - auto a_buffer = Buffer<float>(context, a_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); a_buffer.Write(queue, a_size, reinterpret_cast<float*>(a)); auto queue_cl = queue(); - auto s = Syr(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - x_buffer(), 0, x_inc, - a_buffer(), 0, a_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Syr(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + x_buffer(), 0, x_inc, + a_buffer(), 0, a_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } a_buffer.Read(queue, a_size, reinterpret_cast<float*>(a)); } @@ -3258,25 +3258,25 @@ void cblas_dsyr(const CLBlastLayout layout, const CLBlastTriangle triangle, const double* x, const int x_inc, double* a, const int a_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = n * x_inc; const auto a_size = n * a_ld; - auto x_buffer = Buffer<double>(context, x_size); - auto a_buffer = Buffer<double>(context, a_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); a_buffer.Write(queue, a_size, reinterpret_cast<double*>(a)); auto queue_cl = queue(); - auto s = Syr(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - x_buffer(), 0, x_inc, - a_buffer(), 0, a_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Syr(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + x_buffer(), 0, x_inc, + a_buffer(), 0, a_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } a_buffer.Read(queue, a_size, reinterpret_cast<double*>(a)); } @@ -3288,25 +3288,25 @@ void cblas_sspr(const CLBlastLayout layout, const CLBlastTriangle triangle, const float* x, const int x_inc, float* ap) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = n * x_inc; const auto ap_size = ((n*(n+1)) / 2); - auto x_buffer = Buffer<float>(context, x_size); - auto ap_buffer = Buffer<float>(context, ap_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto ap_buffer = clblast::Buffer<float>(context, ap_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); ap_buffer.Write(queue, ap_size, reinterpret_cast<float*>(ap)); auto queue_cl = queue(); - auto s = Spr(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - x_buffer(), 0, x_inc, - ap_buffer(), 0, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Spr(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + x_buffer(), 0, x_inc, + ap_buffer(), 0, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } ap_buffer.Read(queue, ap_size, reinterpret_cast<float*>(ap)); } @@ -3316,25 +3316,25 @@ void cblas_dspr(const CLBlastLayout layout, const CLBlastTriangle triangle, const double* x, const int x_inc, double* ap) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = n * x_inc; const auto ap_size = ((n*(n+1)) / 2); - auto x_buffer = Buffer<double>(context, x_size); - auto ap_buffer = Buffer<double>(context, ap_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto ap_buffer = clblast::Buffer<double>(context, ap_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); ap_buffer.Write(queue, ap_size, reinterpret_cast<double*>(ap)); auto queue_cl = queue(); - auto s = Spr(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - x_buffer(), 0, x_inc, - ap_buffer(), 0, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Spr(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + x_buffer(), 0, x_inc, + ap_buffer(), 0, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } ap_buffer.Read(queue, ap_size, reinterpret_cast<double*>(ap)); } @@ -3347,29 +3347,29 @@ void cblas_ssyr2(const CLBlastLayout layout, const CLBlastTriangle triangle, const float* y, const int y_inc, float* a, const int a_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = n * x_inc; const auto y_size = n * y_inc; const auto a_size = n * a_ld; - auto x_buffer = Buffer<float>(context, x_size); - auto y_buffer = Buffer<float>(context, y_size); - auto a_buffer = Buffer<float>(context, a_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto y_buffer = clblast::Buffer<float>(context, y_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const float*>(y)); a_buffer.Write(queue, a_size, reinterpret_cast<float*>(a)); auto queue_cl = queue(); - auto s = Syr2(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - a_buffer(), 0, a_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Syr2(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + a_buffer(), 0, a_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } a_buffer.Read(queue, a_size, reinterpret_cast<float*>(a)); } @@ -3380,29 +3380,29 @@ void cblas_dsyr2(const CLBlastLayout layout, const CLBlastTriangle triangle, const double* y, const int y_inc, double* a, const int a_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = n * x_inc; const auto y_size = n * y_inc; const auto a_size = n * a_ld; - auto x_buffer = Buffer<double>(context, x_size); - auto y_buffer = Buffer<double>(context, y_size); - auto a_buffer = Buffer<double>(context, a_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto y_buffer = clblast::Buffer<double>(context, y_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const double*>(y)); a_buffer.Write(queue, a_size, reinterpret_cast<double*>(a)); auto queue_cl = queue(); - auto s = Syr2(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - a_buffer(), 0, a_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Syr2(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + a_buffer(), 0, a_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } a_buffer.Read(queue, a_size, reinterpret_cast<double*>(a)); } @@ -3415,29 +3415,29 @@ void cblas_sspr2(const CLBlastLayout layout, const CLBlastTriangle triangle, const float* y, const int y_inc, float* ap) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = n * x_inc; const auto y_size = n * y_inc; const auto ap_size = ((n*(n+1)) / 2); - auto x_buffer = Buffer<float>(context, x_size); - auto y_buffer = Buffer<float>(context, y_size); - auto ap_buffer = Buffer<float>(context, ap_size); + auto x_buffer = clblast::Buffer<float>(context, x_size); + auto y_buffer = clblast::Buffer<float>(context, y_size); + auto ap_buffer = clblast::Buffer<float>(context, ap_size); x_buffer.Write(queue, x_size, reinterpret_cast<const float*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const float*>(y)); ap_buffer.Write(queue, ap_size, reinterpret_cast<float*>(ap)); auto queue_cl = queue(); - auto s = Spr2(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - ap_buffer(), 0, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Spr2(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + ap_buffer(), 0, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } ap_buffer.Read(queue, ap_size, reinterpret_cast<float*>(ap)); } @@ -3448,29 +3448,29 @@ void cblas_dspr2(const CLBlastLayout layout, const CLBlastTriangle triangle, const double* y, const int y_inc, double* ap) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto x_size = n * x_inc; const auto y_size = n * y_inc; const auto ap_size = ((n*(n+1)) / 2); - auto x_buffer = Buffer<double>(context, x_size); - auto y_buffer = Buffer<double>(context, y_size); - auto ap_buffer = Buffer<double>(context, ap_size); + auto x_buffer = clblast::Buffer<double>(context, x_size); + auto y_buffer = clblast::Buffer<double>(context, y_size); + auto ap_buffer = clblast::Buffer<double>(context, ap_size); x_buffer.Write(queue, x_size, reinterpret_cast<const double*>(x)); y_buffer.Write(queue, y_size, reinterpret_cast<const double*>(y)); ap_buffer.Write(queue, ap_size, reinterpret_cast<double*>(ap)); auto queue_cl = queue(); - auto s = Spr2(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - n, - alpha_cpp, - x_buffer(), 0, x_inc, - y_buffer(), 0, y_inc, - ap_buffer(), 0, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Spr2(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + n, + alpha_cpp, + x_buffer(), 0, x_inc, + y_buffer(), 0, y_inc, + ap_buffer(), 0, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } ap_buffer.Read(queue, ap_size, reinterpret_cast<double*>(ap)); } @@ -3488,32 +3488,32 @@ void cblas_sgemm(const CLBlastLayout layout, const CLBlastTranspose a_transpose, const float beta, float* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = ((layout == CLBlastLayoutColMajor && a_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && a_transpose == CLBlastTransposeNo)) ? m * a_ld : k * a_ld; const auto b_size = ((layout == CLBlastLayoutColMajor && b_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && b_transpose == CLBlastTransposeNo)) ? k * b_ld : n * b_ld; const auto c_size = (layout == CLBlastLayoutRowMajor) ? m * c_ld : n * c_ld; - auto a_buffer = Buffer<float>(context, a_size); - auto b_buffer = Buffer<float>(context, b_size); - auto c_buffer = Buffer<float>(context, c_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); + auto b_buffer = clblast::Buffer<float>(context, b_size); + auto c_buffer = clblast::Buffer<float>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<const float*>(b)); c_buffer.Write(queue, c_size, reinterpret_cast<float*>(c)); auto queue_cl = queue(); - auto s = Gemm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Transpose>(b_transpose), - m, n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Gemm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Transpose>(b_transpose), + m, n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<float*>(c)); } @@ -3525,32 +3525,32 @@ void cblas_dgemm(const CLBlastLayout layout, const CLBlastTranspose a_transpose, const double beta, double* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = ((layout == CLBlastLayoutColMajor && a_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && a_transpose == CLBlastTransposeNo)) ? m * a_ld : k * a_ld; const auto b_size = ((layout == CLBlastLayoutColMajor && b_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && b_transpose == CLBlastTransposeNo)) ? k * b_ld : n * b_ld; const auto c_size = (layout == CLBlastLayoutRowMajor) ? m * c_ld : n * c_ld; - auto a_buffer = Buffer<double>(context, a_size); - auto b_buffer = Buffer<double>(context, b_size); - auto c_buffer = Buffer<double>(context, c_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); + auto b_buffer = clblast::Buffer<double>(context, b_size); + auto c_buffer = clblast::Buffer<double>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<const double*>(b)); c_buffer.Write(queue, c_size, reinterpret_cast<double*>(c)); auto queue_cl = queue(); - auto s = Gemm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Transpose>(b_transpose), - m, n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Gemm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Transpose>(b_transpose), + m, n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<double*>(c)); } @@ -3562,32 +3562,32 @@ void cblas_cgemm(const CLBlastLayout layout, const CLBlastTranspose a_transpose, const void* beta, void* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto beta_cpp = float2{reinterpret_cast<const float*>(beta)[0], reinterpret_cast<const float*>(beta)[1]}; const auto a_size = ((layout == CLBlastLayoutColMajor && a_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && a_transpose == CLBlastTransposeNo)) ? m * a_ld : k * a_ld; const auto b_size = ((layout == CLBlastLayoutColMajor && b_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && b_transpose == CLBlastTransposeNo)) ? k * b_ld : n * b_ld; const auto c_size = (layout == CLBlastLayoutRowMajor) ? m * c_ld : n * c_ld; - auto a_buffer = Buffer<float2>(context, a_size); - auto b_buffer = Buffer<float2>(context, b_size); - auto c_buffer = Buffer<float2>(context, c_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto b_buffer = clblast::Buffer<float2>(context, b_size); + auto c_buffer = clblast::Buffer<float2>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<const float2*>(b)); c_buffer.Write(queue, c_size, reinterpret_cast<float2*>(c)); auto queue_cl = queue(); - auto s = Gemm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Transpose>(b_transpose), - m, n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Gemm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Transpose>(b_transpose), + m, n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<float2*>(c)); } @@ -3599,32 +3599,32 @@ void cblas_zgemm(const CLBlastLayout layout, const CLBlastTranspose a_transpose, const void* beta, void* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto beta_cpp = double2{reinterpret_cast<const double*>(beta)[0], reinterpret_cast<const double*>(beta)[1]}; const auto a_size = ((layout == CLBlastLayoutColMajor && a_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && a_transpose == CLBlastTransposeNo)) ? m * a_ld : k * a_ld; const auto b_size = ((layout == CLBlastLayoutColMajor && b_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && b_transpose == CLBlastTransposeNo)) ? k * b_ld : n * b_ld; const auto c_size = (layout == CLBlastLayoutRowMajor) ? m * c_ld : n * c_ld; - auto a_buffer = Buffer<double2>(context, a_size); - auto b_buffer = Buffer<double2>(context, b_size); - auto c_buffer = Buffer<double2>(context, c_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto b_buffer = clblast::Buffer<double2>(context, b_size); + auto c_buffer = clblast::Buffer<double2>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<const double2*>(b)); c_buffer.Write(queue, c_size, reinterpret_cast<double2*>(c)); auto queue_cl = queue(); - auto s = Gemm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Transpose>(b_transpose), - m, n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Gemm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Transpose>(b_transpose), + m, n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<double2*>(c)); } @@ -3638,32 +3638,32 @@ void cblas_ssymm(const CLBlastLayout layout, const CLBlastSide side, const CLBla const float beta, float* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : ((side == CLBlastSideLeft) ? m : n) * a_ld; const auto b_size = (layout == CLBlastLayoutRowMajor) ? ((side == CLBlastSideLeft) ? m : n) * b_ld : n * b_ld; const auto c_size = (layout == CLBlastLayoutRowMajor) ? m * c_ld : n * c_ld; - auto a_buffer = Buffer<float>(context, a_size); - auto b_buffer = Buffer<float>(context, b_size); - auto c_buffer = Buffer<float>(context, c_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); + auto b_buffer = clblast::Buffer<float>(context, b_size); + auto c_buffer = clblast::Buffer<float>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<const float*>(b)); c_buffer.Write(queue, c_size, reinterpret_cast<float*>(c)); auto queue_cl = queue(); - auto s = Symm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Side>(side), - static_cast<clblast::Triangle>(triangle), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Symm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Side>(side), + static_cast<clblast::Triangle>(triangle), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<float*>(c)); } @@ -3675,32 +3675,32 @@ void cblas_dsymm(const CLBlastLayout layout, const CLBlastSide side, const CLBla const double beta, double* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : ((side == CLBlastSideLeft) ? m : n) * a_ld; const auto b_size = (layout == CLBlastLayoutRowMajor) ? ((side == CLBlastSideLeft) ? m : n) * b_ld : n * b_ld; const auto c_size = (layout == CLBlastLayoutRowMajor) ? m * c_ld : n * c_ld; - auto a_buffer = Buffer<double>(context, a_size); - auto b_buffer = Buffer<double>(context, b_size); - auto c_buffer = Buffer<double>(context, c_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); + auto b_buffer = clblast::Buffer<double>(context, b_size); + auto c_buffer = clblast::Buffer<double>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<const double*>(b)); c_buffer.Write(queue, c_size, reinterpret_cast<double*>(c)); auto queue_cl = queue(); - auto s = Symm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Side>(side), - static_cast<clblast::Triangle>(triangle), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Symm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Side>(side), + static_cast<clblast::Triangle>(triangle), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<double*>(c)); } @@ -3712,32 +3712,32 @@ void cblas_csymm(const CLBlastLayout layout, const CLBlastSide side, const CLBla const void* beta, void* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto beta_cpp = float2{reinterpret_cast<const float*>(beta)[0], reinterpret_cast<const float*>(beta)[1]}; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : ((side == CLBlastSideLeft) ? m : n) * a_ld; const auto b_size = (layout == CLBlastLayoutRowMajor) ? ((side == CLBlastSideLeft) ? m : n) * b_ld : n * b_ld; const auto c_size = (layout == CLBlastLayoutRowMajor) ? m * c_ld : n * c_ld; - auto a_buffer = Buffer<float2>(context, a_size); - auto b_buffer = Buffer<float2>(context, b_size); - auto c_buffer = Buffer<float2>(context, c_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto b_buffer = clblast::Buffer<float2>(context, b_size); + auto c_buffer = clblast::Buffer<float2>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<const float2*>(b)); c_buffer.Write(queue, c_size, reinterpret_cast<float2*>(c)); auto queue_cl = queue(); - auto s = Symm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Side>(side), - static_cast<clblast::Triangle>(triangle), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Symm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Side>(side), + static_cast<clblast::Triangle>(triangle), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<float2*>(c)); } @@ -3749,32 +3749,32 @@ void cblas_zsymm(const CLBlastLayout layout, const CLBlastSide side, const CLBla const void* beta, void* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto beta_cpp = double2{reinterpret_cast<const double*>(beta)[0], reinterpret_cast<const double*>(beta)[1]}; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : ((side == CLBlastSideLeft) ? m : n) * a_ld; const auto b_size = (layout == CLBlastLayoutRowMajor) ? ((side == CLBlastSideLeft) ? m : n) * b_ld : n * b_ld; const auto c_size = (layout == CLBlastLayoutRowMajor) ? m * c_ld : n * c_ld; - auto a_buffer = Buffer<double2>(context, a_size); - auto b_buffer = Buffer<double2>(context, b_size); - auto c_buffer = Buffer<double2>(context, c_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto b_buffer = clblast::Buffer<double2>(context, b_size); + auto c_buffer = clblast::Buffer<double2>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<const double2*>(b)); c_buffer.Write(queue, c_size, reinterpret_cast<double2*>(c)); auto queue_cl = queue(); - auto s = Symm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Side>(side), - static_cast<clblast::Triangle>(triangle), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Symm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Side>(side), + static_cast<clblast::Triangle>(triangle), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<double2*>(c)); } @@ -3788,32 +3788,32 @@ void cblas_chemm(const CLBlastLayout layout, const CLBlastSide side, const CLBla const void* beta, void* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto beta_cpp = float2{reinterpret_cast<const float*>(beta)[0], reinterpret_cast<const float*>(beta)[1]}; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : ((side == CLBlastSideLeft) ? m : n) * a_ld; const auto b_size = (layout == CLBlastLayoutRowMajor) ? ((side == CLBlastSideLeft) ? m : n) * b_ld : n * b_ld; const auto c_size = (layout == CLBlastLayoutRowMajor) ? m * c_ld : n * c_ld; - auto a_buffer = Buffer<float2>(context, a_size); - auto b_buffer = Buffer<float2>(context, b_size); - auto c_buffer = Buffer<float2>(context, c_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto b_buffer = clblast::Buffer<float2>(context, b_size); + auto c_buffer = clblast::Buffer<float2>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<const float2*>(b)); c_buffer.Write(queue, c_size, reinterpret_cast<float2*>(c)); auto queue_cl = queue(); - auto s = Hemm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Side>(side), - static_cast<clblast::Triangle>(triangle), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Hemm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Side>(side), + static_cast<clblast::Triangle>(triangle), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<float2*>(c)); } @@ -3825,32 +3825,32 @@ void cblas_zhemm(const CLBlastLayout layout, const CLBlastSide side, const CLBla const void* beta, void* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto beta_cpp = double2{reinterpret_cast<const double*>(beta)[0], reinterpret_cast<const double*>(beta)[1]}; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : ((side == CLBlastSideLeft) ? m : n) * a_ld; const auto b_size = (layout == CLBlastLayoutRowMajor) ? ((side == CLBlastSideLeft) ? m : n) * b_ld : n * b_ld; const auto c_size = (layout == CLBlastLayoutRowMajor) ? m * c_ld : n * c_ld; - auto a_buffer = Buffer<double2>(context, a_size); - auto b_buffer = Buffer<double2>(context, b_size); - auto c_buffer = Buffer<double2>(context, c_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto b_buffer = clblast::Buffer<double2>(context, b_size); + auto c_buffer = clblast::Buffer<double2>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<const double2*>(b)); c_buffer.Write(queue, c_size, reinterpret_cast<double2*>(c)); auto queue_cl = queue(); - auto s = Hemm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Side>(side), - static_cast<clblast::Triangle>(triangle), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Hemm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Side>(side), + static_cast<clblast::Triangle>(triangle), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<double2*>(c)); } @@ -3863,28 +3863,28 @@ void cblas_ssyrk(const CLBlastLayout layout, const CLBlastTriangle triangle, con const float beta, float* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = ((layout == CLBlastLayoutColMajor && a_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && a_transpose == CLBlastTransposeNo)) ? n * a_ld : k * a_ld; const auto c_size = n * c_ld; - auto a_buffer = Buffer<float>(context, a_size); - auto c_buffer = Buffer<float>(context, c_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); + auto c_buffer = clblast::Buffer<float>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float*>(a)); c_buffer.Write(queue, c_size, reinterpret_cast<float*>(c)); auto queue_cl = queue(); - auto s = Syrk(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Syrk(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<float*>(c)); } @@ -3895,28 +3895,28 @@ void cblas_dsyrk(const CLBlastLayout layout, const CLBlastTriangle triangle, con const double beta, double* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = ((layout == CLBlastLayoutColMajor && a_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && a_transpose == CLBlastTransposeNo)) ? n * a_ld : k * a_ld; const auto c_size = n * c_ld; - auto a_buffer = Buffer<double>(context, a_size); - auto c_buffer = Buffer<double>(context, c_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); + auto c_buffer = clblast::Buffer<double>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double*>(a)); c_buffer.Write(queue, c_size, reinterpret_cast<double*>(c)); auto queue_cl = queue(); - auto s = Syrk(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Syrk(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<double*>(c)); } @@ -3927,28 +3927,28 @@ void cblas_csyrk(const CLBlastLayout layout, const CLBlastTriangle triangle, con const void* beta, void* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto beta_cpp = float2{reinterpret_cast<const float*>(beta)[0], reinterpret_cast<const float*>(beta)[1]}; const auto a_size = ((layout == CLBlastLayoutColMajor && a_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && a_transpose == CLBlastTransposeNo)) ? n * a_ld : k * a_ld; const auto c_size = n * c_ld; - auto a_buffer = Buffer<float2>(context, a_size); - auto c_buffer = Buffer<float2>(context, c_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto c_buffer = clblast::Buffer<float2>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); c_buffer.Write(queue, c_size, reinterpret_cast<float2*>(c)); auto queue_cl = queue(); - auto s = Syrk(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Syrk(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<float2*>(c)); } @@ -3959,28 +3959,28 @@ void cblas_zsyrk(const CLBlastLayout layout, const CLBlastTriangle triangle, con const void* beta, void* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto beta_cpp = double2{reinterpret_cast<const double*>(beta)[0], reinterpret_cast<const double*>(beta)[1]}; const auto a_size = ((layout == CLBlastLayoutColMajor && a_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && a_transpose == CLBlastTransposeNo)) ? n * a_ld : k * a_ld; const auto c_size = n * c_ld; - auto a_buffer = Buffer<double2>(context, a_size); - auto c_buffer = Buffer<double2>(context, c_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto c_buffer = clblast::Buffer<double2>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); c_buffer.Write(queue, c_size, reinterpret_cast<double2*>(c)); auto queue_cl = queue(); - auto s = Syrk(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Syrk(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<double2*>(c)); } @@ -3993,28 +3993,28 @@ void cblas_cherk(const CLBlastLayout layout, const CLBlastTriangle triangle, con const float beta, void* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = ((layout == CLBlastLayoutColMajor && a_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && a_transpose == CLBlastTransposeNo)) ? n * a_ld : k * a_ld; const auto c_size = n * c_ld; - auto a_buffer = Buffer<float2>(context, a_size); - auto c_buffer = Buffer<float2>(context, c_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto c_buffer = clblast::Buffer<float2>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); c_buffer.Write(queue, c_size, reinterpret_cast<float2*>(c)); auto queue_cl = queue(); - auto s = Herk(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Herk(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<float2*>(c)); } @@ -4025,28 +4025,28 @@ void cblas_zherk(const CLBlastLayout layout, const CLBlastTriangle triangle, con const double beta, void* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = ((layout == CLBlastLayoutColMajor && a_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && a_transpose == CLBlastTransposeNo)) ? n * a_ld : k * a_ld; const auto c_size = n * c_ld; - auto a_buffer = Buffer<double2>(context, a_size); - auto c_buffer = Buffer<double2>(context, c_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto c_buffer = clblast::Buffer<double2>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); c_buffer.Write(queue, c_size, reinterpret_cast<double2*>(c)); auto queue_cl = queue(); - auto s = Herk(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Herk(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<double2*>(c)); } @@ -4060,32 +4060,32 @@ void cblas_ssyr2k(const CLBlastLayout layout, const CLBlastTriangle triangle, co const float beta, float* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = ((layout == CLBlastLayoutColMajor && ab_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && ab_transpose == CLBlastTransposeNo)) ? n * a_ld : k * a_ld; const auto b_size = ((layout == CLBlastLayoutColMajor && ab_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && ab_transpose == CLBlastTransposeNo)) ? n * b_ld : k * b_ld; const auto c_size = n * c_ld; - auto a_buffer = Buffer<float>(context, a_size); - auto b_buffer = Buffer<float>(context, b_size); - auto c_buffer = Buffer<float>(context, c_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); + auto b_buffer = clblast::Buffer<float>(context, b_size); + auto c_buffer = clblast::Buffer<float>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<const float*>(b)); c_buffer.Write(queue, c_size, reinterpret_cast<float*>(c)); auto queue_cl = queue(); - auto s = Syr2k(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(ab_transpose), - n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Syr2k(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(ab_transpose), + n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<float*>(c)); } @@ -4097,32 +4097,32 @@ void cblas_dsyr2k(const CLBlastLayout layout, const CLBlastTriangle triangle, co const double beta, double* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto beta_cpp = beta; const auto a_size = ((layout == CLBlastLayoutColMajor && ab_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && ab_transpose == CLBlastTransposeNo)) ? n * a_ld : k * a_ld; const auto b_size = ((layout == CLBlastLayoutColMajor && ab_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && ab_transpose == CLBlastTransposeNo)) ? n * b_ld : k * b_ld; const auto c_size = n * c_ld; - auto a_buffer = Buffer<double>(context, a_size); - auto b_buffer = Buffer<double>(context, b_size); - auto c_buffer = Buffer<double>(context, c_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); + auto b_buffer = clblast::Buffer<double>(context, b_size); + auto c_buffer = clblast::Buffer<double>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<const double*>(b)); c_buffer.Write(queue, c_size, reinterpret_cast<double*>(c)); auto queue_cl = queue(); - auto s = Syr2k(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(ab_transpose), - n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Syr2k(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(ab_transpose), + n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<double*>(c)); } @@ -4134,32 +4134,32 @@ void cblas_csyr2k(const CLBlastLayout layout, const CLBlastTriangle triangle, co const void* beta, void* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto beta_cpp = float2{reinterpret_cast<const float*>(beta)[0], reinterpret_cast<const float*>(beta)[1]}; const auto a_size = ((layout == CLBlastLayoutColMajor && ab_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && ab_transpose == CLBlastTransposeNo)) ? n * a_ld : k * a_ld; const auto b_size = ((layout == CLBlastLayoutColMajor && ab_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && ab_transpose == CLBlastTransposeNo)) ? n * b_ld : k * b_ld; const auto c_size = n * c_ld; - auto a_buffer = Buffer<float2>(context, a_size); - auto b_buffer = Buffer<float2>(context, b_size); - auto c_buffer = Buffer<float2>(context, c_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto b_buffer = clblast::Buffer<float2>(context, b_size); + auto c_buffer = clblast::Buffer<float2>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<const float2*>(b)); c_buffer.Write(queue, c_size, reinterpret_cast<float2*>(c)); auto queue_cl = queue(); - auto s = Syr2k(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(ab_transpose), - n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Syr2k(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(ab_transpose), + n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<float2*>(c)); } @@ -4171,32 +4171,32 @@ void cblas_zsyr2k(const CLBlastLayout layout, const CLBlastTriangle triangle, co const void* beta, void* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto beta_cpp = double2{reinterpret_cast<const double*>(beta)[0], reinterpret_cast<const double*>(beta)[1]}; const auto a_size = ((layout == CLBlastLayoutColMajor && ab_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && ab_transpose == CLBlastTransposeNo)) ? n * a_ld : k * a_ld; const auto b_size = ((layout == CLBlastLayoutColMajor && ab_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && ab_transpose == CLBlastTransposeNo)) ? n * b_ld : k * b_ld; const auto c_size = n * c_ld; - auto a_buffer = Buffer<double2>(context, a_size); - auto b_buffer = Buffer<double2>(context, b_size); - auto c_buffer = Buffer<double2>(context, c_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto b_buffer = clblast::Buffer<double2>(context, b_size); + auto c_buffer = clblast::Buffer<double2>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<const double2*>(b)); c_buffer.Write(queue, c_size, reinterpret_cast<double2*>(c)); auto queue_cl = queue(); - auto s = Syr2k(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(ab_transpose), - n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Syr2k(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(ab_transpose), + n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<double2*>(c)); } @@ -4210,32 +4210,32 @@ void cblas_cher2k(const CLBlastLayout layout, const CLBlastTriangle triangle, co const float beta, void* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto beta_cpp = beta; const auto a_size = ((layout == CLBlastLayoutColMajor && ab_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && ab_transpose == CLBlastTransposeNo)) ? n * a_ld : k * a_ld; const auto b_size = ((layout == CLBlastLayoutColMajor && ab_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && ab_transpose == CLBlastTransposeNo)) ? n * b_ld : k * b_ld; const auto c_size = n * c_ld; - auto a_buffer = Buffer<float2>(context, a_size); - auto b_buffer = Buffer<float2>(context, b_size); - auto c_buffer = Buffer<float2>(context, c_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto b_buffer = clblast::Buffer<float2>(context, b_size); + auto c_buffer = clblast::Buffer<float2>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<const float2*>(b)); c_buffer.Write(queue, c_size, reinterpret_cast<float2*>(c)); auto queue_cl = queue(); - auto s = Her2k(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(ab_transpose), - n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Her2k(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(ab_transpose), + n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<float2*>(c)); } @@ -4247,32 +4247,32 @@ void cblas_zher2k(const CLBlastLayout layout, const CLBlastTriangle triangle, co const double beta, void* c, const int c_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto beta_cpp = beta; const auto a_size = ((layout == CLBlastLayoutColMajor && ab_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && ab_transpose == CLBlastTransposeNo)) ? n * a_ld : k * a_ld; const auto b_size = ((layout == CLBlastLayoutColMajor && ab_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && ab_transpose == CLBlastTransposeNo)) ? n * b_ld : k * b_ld; const auto c_size = n * c_ld; - auto a_buffer = Buffer<double2>(context, a_size); - auto b_buffer = Buffer<double2>(context, b_size); - auto c_buffer = Buffer<double2>(context, c_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto b_buffer = clblast::Buffer<double2>(context, b_size); + auto c_buffer = clblast::Buffer<double2>(context, c_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<const double2*>(b)); c_buffer.Write(queue, c_size, reinterpret_cast<double2*>(c)); auto queue_cl = queue(); - auto s = Her2k(static_cast<clblast::Layout>(layout), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(ab_transpose), - n, k, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - beta_cpp, - c_buffer(), 0, c_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Her2k(static_cast<clblast::Layout>(layout), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(ab_transpose), + n, k, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + beta_cpp, + c_buffer(), 0, c_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } c_buffer.Read(queue, c_size, reinterpret_cast<double2*>(c)); } @@ -4284,28 +4284,28 @@ void cblas_strmm(const CLBlastLayout layout, const CLBlastSide side, const CLBla const float* a, const int a_ld, float* b, const int b_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto a_size = (side == CLBlastSideLeft) ? m * a_ld : n * a_ld; const auto b_size = (layout == CLBlastLayoutRowMajor) ? m * b_ld : n * b_ld; - auto a_buffer = Buffer<float>(context, a_size); - auto b_buffer = Buffer<float>(context, b_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); + auto b_buffer = clblast::Buffer<float>(context, b_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<float*>(b)); auto queue_cl = queue(); - auto s = Trmm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Side>(side), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Trmm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Side>(side), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } b_buffer.Read(queue, b_size, reinterpret_cast<float*>(b)); } @@ -4315,28 +4315,28 @@ void cblas_dtrmm(const CLBlastLayout layout, const CLBlastSide side, const CLBla const double* a, const int a_ld, double* b, const int b_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto a_size = (side == CLBlastSideLeft) ? m * a_ld : n * a_ld; const auto b_size = (layout == CLBlastLayoutRowMajor) ? m * b_ld : n * b_ld; - auto a_buffer = Buffer<double>(context, a_size); - auto b_buffer = Buffer<double>(context, b_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); + auto b_buffer = clblast::Buffer<double>(context, b_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<double*>(b)); auto queue_cl = queue(); - auto s = Trmm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Side>(side), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Trmm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Side>(side), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } b_buffer.Read(queue, b_size, reinterpret_cast<double*>(b)); } @@ -4346,28 +4346,28 @@ void cblas_ctrmm(const CLBlastLayout layout, const CLBlastSide side, const CLBla const void* a, const int a_ld, void* b, const int b_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto a_size = (side == CLBlastSideLeft) ? m * a_ld : n * a_ld; const auto b_size = (layout == CLBlastLayoutRowMajor) ? m * b_ld : n * b_ld; - auto a_buffer = Buffer<float2>(context, a_size); - auto b_buffer = Buffer<float2>(context, b_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto b_buffer = clblast::Buffer<float2>(context, b_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<float2*>(b)); auto queue_cl = queue(); - auto s = Trmm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Side>(side), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Trmm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Side>(side), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } b_buffer.Read(queue, b_size, reinterpret_cast<float2*>(b)); } @@ -4377,28 +4377,28 @@ void cblas_ztrmm(const CLBlastLayout layout, const CLBlastSide side, const CLBla const void* a, const int a_ld, void* b, const int b_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto a_size = (side == CLBlastSideLeft) ? m * a_ld : n * a_ld; const auto b_size = (layout == CLBlastLayoutRowMajor) ? m * b_ld : n * b_ld; - auto a_buffer = Buffer<double2>(context, a_size); - auto b_buffer = Buffer<double2>(context, b_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto b_buffer = clblast::Buffer<double2>(context, b_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<double2*>(b)); auto queue_cl = queue(); - auto s = Trmm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Side>(side), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Trmm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Side>(side), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } b_buffer.Read(queue, b_size, reinterpret_cast<double2*>(b)); } @@ -4410,28 +4410,28 @@ void cblas_strsm(const CLBlastLayout layout, const CLBlastSide side, const CLBla const float* a, const int a_ld, float* b, const int b_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto a_size = (side == CLBlastSideLeft) ? m * a_ld : n * a_ld; const auto b_size = (layout == CLBlastLayoutRowMajor) ? m * b_ld : n * b_ld; - auto a_buffer = Buffer<float>(context, a_size); - auto b_buffer = Buffer<float>(context, b_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); + auto b_buffer = clblast::Buffer<float>(context, b_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<float*>(b)); auto queue_cl = queue(); - auto s = Trsm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Side>(side), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Trsm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Side>(side), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } b_buffer.Read(queue, b_size, reinterpret_cast<float*>(b)); } @@ -4441,28 +4441,28 @@ void cblas_dtrsm(const CLBlastLayout layout, const CLBlastSide side, const CLBla const double* a, const int a_ld, double* b, const int b_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto a_size = (side == CLBlastSideLeft) ? m * a_ld : n * a_ld; const auto b_size = (layout == CLBlastLayoutRowMajor) ? m * b_ld : n * b_ld; - auto a_buffer = Buffer<double>(context, a_size); - auto b_buffer = Buffer<double>(context, b_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); + auto b_buffer = clblast::Buffer<double>(context, b_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<double*>(b)); auto queue_cl = queue(); - auto s = Trsm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Side>(side), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Trsm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Side>(side), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } b_buffer.Read(queue, b_size, reinterpret_cast<double*>(b)); } @@ -4472,28 +4472,28 @@ void cblas_ctrsm(const CLBlastLayout layout, const CLBlastSide side, const CLBla const void* a, const int a_ld, void* b, const int b_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto a_size = (side == CLBlastSideLeft) ? m * a_ld : n * a_ld; const auto b_size = (layout == CLBlastLayoutRowMajor) ? m * b_ld : n * b_ld; - auto a_buffer = Buffer<float2>(context, a_size); - auto b_buffer = Buffer<float2>(context, b_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto b_buffer = clblast::Buffer<float2>(context, b_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<float2*>(b)); auto queue_cl = queue(); - auto s = Trsm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Side>(side), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Trsm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Side>(side), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } b_buffer.Read(queue, b_size, reinterpret_cast<float2*>(b)); } @@ -4503,28 +4503,28 @@ void cblas_ztrsm(const CLBlastLayout layout, const CLBlastSide side, const CLBla const void* a, const int a_ld, void* b, const int b_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto a_size = (side == CLBlastSideLeft) ? m * a_ld : n * a_ld; const auto b_size = (layout == CLBlastLayoutRowMajor) ? m * b_ld : n * b_ld; - auto a_buffer = Buffer<double2>(context, a_size); - auto b_buffer = Buffer<double2>(context, b_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto b_buffer = clblast::Buffer<double2>(context, b_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<double2*>(b)); auto queue_cl = queue(); - auto s = Trsm(static_cast<clblast::Layout>(layout), - static_cast<clblast::Side>(side), - static_cast<clblast::Triangle>(triangle), - static_cast<clblast::Transpose>(a_transpose), - static_cast<clblast::Diagonal>(diagonal), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Trsm(static_cast<clblast::Layout>(layout), + static_cast<clblast::Side>(side), + static_cast<clblast::Triangle>(triangle), + static_cast<clblast::Transpose>(a_transpose), + static_cast<clblast::Diagonal>(diagonal), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } b_buffer.Read(queue, b_size, reinterpret_cast<double2*>(b)); } @@ -4540,25 +4540,25 @@ void cblas_somatcopy(const CLBlastLayout layout, const CLBlastTranspose a_transp const float* a, const int a_ld, float* b, const int b_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; const auto b_size = ((layout == CLBlastLayoutColMajor && a_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && a_transpose == CLBlastTransposeNo)) ? n * b_ld : m * b_ld; - auto a_buffer = Buffer<float>(context, a_size); - auto b_buffer = Buffer<float>(context, b_size); + auto a_buffer = clblast::Buffer<float>(context, a_size); + auto b_buffer = clblast::Buffer<float>(context, b_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<float*>(b)); auto queue_cl = queue(); - auto s = Omatcopy(static_cast<clblast::Layout>(layout), - static_cast<clblast::Transpose>(a_transpose), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Omatcopy(static_cast<clblast::Layout>(layout), + static_cast<clblast::Transpose>(a_transpose), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } b_buffer.Read(queue, b_size, reinterpret_cast<float*>(b)); } @@ -4568,25 +4568,25 @@ void cblas_domatcopy(const CLBlastLayout layout, const CLBlastTranspose a_transp const double* a, const int a_ld, double* b, const int b_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = alpha; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; const auto b_size = ((layout == CLBlastLayoutColMajor && a_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && a_transpose == CLBlastTransposeNo)) ? n * b_ld : m * b_ld; - auto a_buffer = Buffer<double>(context, a_size); - auto b_buffer = Buffer<double>(context, b_size); + auto a_buffer = clblast::Buffer<double>(context, a_size); + auto b_buffer = clblast::Buffer<double>(context, b_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<double*>(b)); auto queue_cl = queue(); - auto s = Omatcopy(static_cast<clblast::Layout>(layout), - static_cast<clblast::Transpose>(a_transpose), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Omatcopy(static_cast<clblast::Layout>(layout), + static_cast<clblast::Transpose>(a_transpose), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } b_buffer.Read(queue, b_size, reinterpret_cast<double*>(b)); } @@ -4596,25 +4596,25 @@ void cblas_comatcopy(const CLBlastLayout layout, const CLBlastTranspose a_transp const void* a, const int a_ld, void* b, const int b_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = float2{reinterpret_cast<const float*>(alpha)[0], reinterpret_cast<const float*>(alpha)[1]}; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; const auto b_size = ((layout == CLBlastLayoutColMajor && a_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && a_transpose == CLBlastTransposeNo)) ? n * b_ld : m * b_ld; - auto a_buffer = Buffer<float2>(context, a_size); - auto b_buffer = Buffer<float2>(context, b_size); + auto a_buffer = clblast::Buffer<float2>(context, a_size); + auto b_buffer = clblast::Buffer<float2>(context, b_size); a_buffer.Write(queue, a_size, reinterpret_cast<const float2*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<float2*>(b)); auto queue_cl = queue(); - auto s = Omatcopy(static_cast<clblast::Layout>(layout), - static_cast<clblast::Transpose>(a_transpose), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Omatcopy(static_cast<clblast::Layout>(layout), + static_cast<clblast::Transpose>(a_transpose), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } b_buffer.Read(queue, b_size, reinterpret_cast<float2*>(b)); } @@ -4624,28 +4624,27 @@ void cblas_zomatcopy(const CLBlastLayout layout, const CLBlastTranspose a_transp const void* a, const int a_ld, void* b, const int b_ld) { auto device = get_device(); - auto context = Context(device); - auto queue = Queue(context, device); + auto context = clblast::Context(device); + auto queue = clblast::Queue(context, device); const auto alpha_cpp = double2{reinterpret_cast<const double*>(alpha)[0], reinterpret_cast<const double*>(alpha)[1]}; const auto a_size = (layout == CLBlastLayoutRowMajor) ? m * a_ld : n * a_ld; const auto b_size = ((layout == CLBlastLayoutColMajor && a_transpose != CLBlastTransposeNo) || (layout == CLBlastLayoutRowMajor && a_transpose == CLBlastTransposeNo)) ? n * b_ld : m * b_ld; - auto a_buffer = Buffer<double2>(context, a_size); - auto b_buffer = Buffer<double2>(context, b_size); + auto a_buffer = clblast::Buffer<double2>(context, a_size); + auto b_buffer = clblast::Buffer<double2>(context, b_size); a_buffer.Write(queue, a_size, reinterpret_cast<const double2*>(a)); b_buffer.Write(queue, b_size, reinterpret_cast<double2*>(b)); auto queue_cl = queue(); - auto s = Omatcopy(static_cast<clblast::Layout>(layout), - static_cast<clblast::Transpose>(a_transpose), - m, n, - alpha_cpp, - a_buffer(), 0, a_ld, - b_buffer(), 0, b_ld, - &queue_cl); - if (s != StatusCode::kSuccess) { - throw std::runtime_error("CLBlast returned with error code " + ToString(s)); + auto s = clblast::Omatcopy(static_cast<clblast::Layout>(layout), + static_cast<clblast::Transpose>(a_transpose), + m, n, + alpha_cpp, + a_buffer(), 0, a_ld, + b_buffer(), 0, b_ld, + &queue_cl); + if (s != clblast::StatusCode::kSuccess) { + throw std::runtime_error("CLBlast returned with error code " + clblast::ToString(s)); } b_buffer.Read(queue, b_size, reinterpret_cast<double2*>(b)); } // ================================================================================================= -} // namespace clblast |