41 #include <pvsutil/Logger.h>
44 #include <SkelCL/Vector.h>
47 #include <SkelCL/detail/Device.h>
57 class ReduceTest :
public ::testing::Test {
72 TEST_F(ReduceTest, CreateReduce)
74 skelcl::Reduce<float(float)> r(
"float func(float x, float y){ return x+y; }");
77 TEST_F(ReduceTest, SimpleReduce)
79 skelcl::Reduce<float(float)> r(
"float func(float x, float y){ return x+y; }");
82 for (
size_t i = 0; i < input.size(); ++i) {
88 EXPECT_LE(1, output.
size());
89 EXPECT_EQ(4950, output[0]);
92 TEST_F(ReduceTest, AdditionalArg)
94 skelcl::Reduce<float(float)> r(
95 "float func(float x, float y, float a){ return a*(x+y); }");
98 for (
size_t i = 0; i < input.size(); ++i) {
104 EXPECT_LE(1, output.
size());
105 EXPECT_EQ(4950, output[0]);
108 TEST_F(ReduceTest, SimpleReduce2)
110 skelcl::Reduce<int(int)> r(
"int func(int x, int y){ return x+y; }");
113 for (
unsigned int i = 0; i < input.size(); ++i) {
119 EXPECT_LE(1, output.
size());
120 EXPECT_EQ(1258491, output[0]);
123 TEST_F(ReduceTest, LongReduce)
125 skelcl::Reduce<int(int)> r(
"int func(int x, int y){ return x+y; }");
128 for (
unsigned int i = 0; i < input.size(); ++i) {
134 EXPECT_LE(1, output.
size());
135 EXPECT_EQ(100000000, output[0]);
138 TEST_F(ReduceTest, nSizesReduce1)
140 skelcl::Reduce<float(float)> r(
"float func(float x, float y){ return x+y; }");
147 for (
int i = 1; i < N; ++i) {
151 EXPECT_EQ(input.
size(), output[0]);
155 TEST_F(ReduceTest, nSizesReduce2)
157 skelcl::Reduce<float(float)> r(
"float func(float x, float y){ return x+y; }");
164 for (
int i = 8192; i < (8192 + N); ++i) {
168 EXPECT_EQ(input.
size(), output[0]);
detail::Device::Type device_type
Public name for a type representing different types of device. E.g. CPU or GPU.
size_type size() const
Returns the number of elements in the Vector.
SKELCL_DLL void init(detail::DeviceProperties properties=allDevices())
Initializes the SkelCL library. This function (or another init function) has to be called prior to ev...
void resize(size_type count, T value=T())
Resizes the container to contain count elements.
SKELCL_DLL detail::DeviceProperties nDevices(size_t n)
Creates a detail::DeviceProperties object representing n devices. This object should be used as param...
The Vector class is a one dimensional container which makes its data accessible on the host as well a...
SKELCL_DLL void terminate()
Frees all resources allocated internally by SkelCL.