#pragma once #include #include "../cl.hpp" class TestCase { protected: cl::Buffer clInputBuffer; cl::Buffer clResultBuffer; size_t data_size; public: virtual void collect_results(cl::CommandQueue* queue) = 0; virtual void gpu_compute( cl::Context* context, cl::CommandQueue* queue, cl::Program* program, cl::Event* Event ) = 0; virtual void cpu_compute() = 0; virtual bool validate_results() = 0; }; class Square : public TestCase { private: std::vector gpuResult; std::vector sourceData; std::vector cpuResult; public: Square(); void collect_results(cl::CommandQueue* queue); void gpu_compute(cl::Context* context, cl::CommandQueue* queue, cl::Program* program, cl::Event* Event); void cpu_compute(); bool validate_results(); }; class Histogram : public TestCase { private: bool global; size_t valueSet; std::vector gpuResult; std::vector sourceData; std::vector cpuResult; public: Histogram(bool _global, int _valueSet, int _data_size); void collect_results(cl::CommandQueue* queue); void gpu_compute(cl::Context* context, cl::CommandQueue* queue, cl::Program* program, cl::Event* Event); void cpu_compute(); bool validate_results(); }; class ReduceAdd : public TestCase { private: std::vector gpuResult; std::vector sourceData; float cpuResult; public: ReduceAdd(size_t max_size); void collect_results(cl::CommandQueue* queue); void gpu_compute(cl::Context* context, cl::CommandQueue* queue, cl::Program* program, cl::Event* Event); void cpu_compute(); bool validate_results(); }; class ExclusiveScan : public TestCase { private: std::vector gpuResult; std::vector sourceData; std::vector cpuResult; public: ExclusiveScan(size_t max_size); void collect_results(cl::CommandQueue* queue); void gpu_compute(cl::Context* context, cl::CommandQueue* queue, cl::Program* program, cl::Event* Event); void cpu_compute(); bool validate_results(); };