summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorcnugteren <web@cedricnugteren.nl>2016-04-02 11:58:00 -0700
committercnugteren <web@cedricnugteren.nl>2016-04-02 11:58:00 -0700
commit1a82861a902e17f15486664b340c50530cce6542 (patch)
tree501c25dd3bcf86525052eb28c2c7ad4c6cb51647 /include
parent5c83217cf256984573924e8f89c46f393a5fcfcd (diff)
Added support for testing (performance and correctness) against a CPU BLAS library
Diffstat (limited to 'include')
-rw-r--r--include/internal/clpp11.h14
-rw-r--r--include/internal/utilities.h5
2 files changed, 13 insertions, 6 deletions
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<T> &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<T> &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<T> &host, const size_t offset = 0) {
+ void Read(const Queue &queue, const size_t size, std::vector<T> &host,
+ const size_t offset = 0) const {
Read(queue, size, host.data(), offset);
}
- void Read(const Queue &queue, const size_t size, BufferHost<T> &host, const size_t offset = 0) {
+ void Read(const Queue &queue, const size_t size, BufferHost<T> &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<double>;
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;