From 1a82861a902e17f15486664b340c50530cce6542 Mon Sep 17 00:00:00 2001 From: cnugteren Date: Sat, 2 Apr 2016 11:58:00 -0700 Subject: Added support for testing (performance and correctness) against a CPU BLAS library --- include/internal/clpp11.h | 14 ++++++++------ include/internal/utilities.h | 5 +++++ 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/internal/clpp11.h b/include/internal/clpp11.h index aac66396..00905ef7 100644 --- a/include/internal/clpp11.h +++ b/include/internal/clpp11.h @@ -465,31 +465,33 @@ class Buffer { } // Copies from device to host: reading the device buffer a-synchronously - void ReadAsync(const Queue &queue, const size_t size, T* host, const size_t offset = 0) { + void ReadAsync(const Queue &queue, const size_t size, T* host, const size_t offset = 0) const { if (access_ == BufferAccess::kWriteOnly) { Error("reading from a write-only buffer"); } CheckError(clEnqueueReadBuffer(queue(), *buffer_, CL_FALSE, offset*sizeof(T), size*sizeof(T), host, 0, nullptr, nullptr)); } void ReadAsync(const Queue &queue, const size_t size, std::vector &host, - const size_t offset = 0) { + const size_t offset = 0) const { if (host.size() < size) { Error("target host buffer is too small"); } ReadAsync(queue, size, host.data(), offset); } void ReadAsync(const Queue &queue, const size_t size, BufferHost &host, - const size_t offset = 0) { + const size_t offset = 0) const { if (host.size() < size) { Error("target host buffer is too small"); } ReadAsync(queue, size, host.data(), offset); } // Copies from device to host: reading the device buffer - void Read(const Queue &queue, const size_t size, T* host, const size_t offset = 0) { + void Read(const Queue &queue, const size_t size, T* host, const size_t offset = 0) const { ReadAsync(queue, size, host, offset); queue.Finish(); } - void Read(const Queue &queue, const size_t size, std::vector &host, const size_t offset = 0) { + void Read(const Queue &queue, const size_t size, std::vector &host, + const size_t offset = 0) const { Read(queue, size, host.data(), offset); } - void Read(const Queue &queue, const size_t size, BufferHost &host, const size_t offset = 0) { + void Read(const Queue &queue, const size_t size, BufferHost &host, + const size_t offset = 0) const { Read(queue, size, host.data(), offset); } diff --git a/include/internal/utilities.h b/include/internal/utilities.h index 35f76722..6adc1d0a 100644 --- a/include/internal/utilities.h +++ b/include/internal/utilities.h @@ -35,6 +35,9 @@ using double2 = std::complex; const std::string kKhronosHalfPrecision = "cl_khr_fp16"; const std::string kKhronosDoublePrecision = "cl_khr_fp64"; +// Catched an unknown error +constexpr auto kUnknownError = -999; + // ================================================================================================= // The routine-specific arguments in string form @@ -70,6 +73,7 @@ constexpr auto kArgFraction = "fraction"; // The client-specific arguments in string form constexpr auto kArgCompareclblas = "clblas"; +constexpr auto kArgComparecblas = "cblas"; constexpr auto kArgStepSize = "step"; constexpr auto kArgNumSteps = "num_steps"; constexpr auto kArgNumRuns = "runs"; @@ -128,6 +132,7 @@ struct Arguments { double fraction = 1.0; // Client-specific arguments int compare_clblas = 1; + int compare_cblas = 1; size_t step = 1; size_t num_steps = 0; size_t num_runs = 10; -- cgit v1.2.3