From b84d2296b87ac212474af855d916b12adf96bdb7 Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Sat, 1 Apr 2017 13:36:24 +0200 Subject: Separated host-device and device-host memory copies from execution of the CBLAS reference code; for fair timing and code de-duplication --- test/routines/level2/xspmv.hpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'test/routines/level2/xspmv.hpp') diff --git a/test/routines/level2/xspmv.hpp b/test/routines/level2/xspmv.hpp index 352c8cfd..560f5baa 100644 --- a/test/routines/level2/xspmv.hpp +++ b/test/routines/level2/xspmv.hpp @@ -45,6 +45,8 @@ class TestXspmv { kArgAPOffset, kArgXOffset, kArgYOffset, kArgAlpha, kArgBeta}; } + static std::vector BuffersIn() { return {kBufMatAP, kBufVecX, kBufVecY}; } + static std::vector BuffersOut() { return {kBufVecY}; } // Describes how to obtain the sizes of the buffers static size_t GetSizeX(const Arguments &args) { @@ -112,20 +114,13 @@ class TestXspmv { // Describes how to run the CPU BLAS routine (for correctness/performance comparison) #ifdef CLBLAST_REF_CBLAS - static StatusCode RunReference2(const Arguments &args, Buffers &buffers, Queue &queue) { - std::vector ap_mat_cpu(args.ap_size, static_cast(0)); - std::vector x_vec_cpu(args.x_size, static_cast(0)); - std::vector y_vec_cpu(args.y_size, static_cast(0)); - buffers.ap_mat.Read(queue, args.ap_size, ap_mat_cpu); - buffers.x_vec.Read(queue, args.x_size, x_vec_cpu); - buffers.y_vec.Read(queue, args.y_size, y_vec_cpu); + static StatusCode RunReference2(const Arguments &args, BuffersHost &buffers_host, Queue &) { cblasXspmv(convertToCBLAS(args.layout), convertToCBLAS(args.triangle), args.n, args.alpha, - ap_mat_cpu, args.ap_offset, - x_vec_cpu, args.x_offset, args.x_inc, args.beta, - y_vec_cpu, args.y_offset, args.y_inc); - buffers.y_vec.Write(queue, args.y_size, y_vec_cpu); + buffers_host.ap_mat, args.ap_offset, + buffers_host.x_vec, args.x_offset, args.x_inc, args.beta, + buffers_host.y_vec, args.y_offset, args.y_inc); return StatusCode::kSuccess; } #endif -- cgit v1.2.3