42 cout <<
"Test of \"Simple kernel\" function..." <<
flush;
46 copy(generateVEData<float>(10u,3u),vec0);
47 copy(generateVEData<float>(10u,1u),vec1);
51 using namespace elementOperators;
58 vector<cl_float> output0(10), output1(10), output2(10);
59 vector<cl_float> output3(10);
60 copy(vec0[0], output0);
61 copy(vec0[1], output1);
62 copy(vec0[2], output2);
63 copy(vec1[0], output3);
65 bool status(output0[9]<0.101 && output1[2] ==1 && output2[5] ==2. && output3[1] ==6.);
74 cout <<
"Test of advanced operations..." <<
flush;
85 copy(generateVEData<int>(11, 2), res);
89 vector<cl_int> output0(11, 0);
90 vector<cl_int> output1(11, 3);
91 vector<cl_int> expected0({10, 10, 10, 10, 10, 10, -4, -4, -4, -4, -4});
92 vector<cl_int> expected1({12, 12, 12, 12, 12, 12, -4, -4, -4, -4, -4});
97 k << (res =
select(vec0 + vec1, vec0 - vec1, ind > c));
102 copy(res[0], output0);
103 copy(res[1], output1);
105 bool status(output0 == expected0 && output1 == expected1);
114 bool allTestsPassed(
true);
119 return allTestsPassed ? EXIT_SUCCESS : EXIT_FAILURE;
VectorOfElements generateVEVariableSP(std::shared_ptr< T > a)
Generates VectorOfElements with 1 Element acl::VariableReference with reference on a.
Advanced Simulation Library.
Advanced Computational Language.
void errorMessage(cl_int status, const char *errorMessage)
Prints errorMessage and exits depending on the status.
Element select(Element e1, Element e2, Element e3)
Updatable value. This class stores value and its TimeStamp.
The class represents several Element.
VectorOfElements generateVEConstant(T a)
Generates VectorOfElements with 1 Element acl::Constant with value a.
void copy(MemBlock &source, T *destination)
bool testAdvancedOperations()
VectorOfElements generateVEIndex(unsigned int size=0)