#include <math.h>
{
cout <<
"Test of \"Simple kernel\" function..." <<
flush;
copy(generateVEData<float>(10u,3u),vec0);
copy(generateVEData<float>(10u,1u),vec1);
{
using namespace elementOperators;
}
vector<cl_float> output0(10), output1(10), output2(10);
vector<cl_float> output3(10);
bool status(output0[9]<0.101 && output1[2] ==1 && output2[5] ==2. && output3[1] ==6.);
return status;
}
{
cout <<
"Test of advanced operations..." <<
flush;
copy(generateVEData<int>(11, 2), res);
vector<cl_int> output0(11, 0);
vector<cl_int> output1(11, 3);
vector<cl_int> expected0({10, 10, 10, 10, 10, 10, -4, -4, -4, -4, -4});
vector<cl_int> expected1({12, 12, 12, 12, 12, 12, -4, -4, -4, -4, -4});
{
k << (res =
select(vec0 + vec1, vec0 - vec1, ind > c));
}
k.compute();
bool status(output0 == expected0 && output1 == expected1);
return status;
}
{
bool allTestsPassed(true);
return allTestsPassed ? EXIT_SUCCESS : EXIT_FAILURE;
}
void copy(const ComplexNumOfElements &source, ComplexNumOfElements &destination)
function copies the ComplexNumOfElements class.
The class represents several Element.
Updatable value. This class stores value and its TimeStamp.
void errorMessage(cl_int status, const char *errorMessage)
Prints errorMessage and exits depending on the status.
VectorOfElements select(const VectorOfElements &a, const VectorOfElements &b, const VectorOfElements &c)
VectorOfElements generateVEConstant(T a)
Generates VectorOfElements with 1 Element acl::Constant with value a.
VectorOfElements generateVEVariableSP(std::shared_ptr< T > a)
Generates VectorOfElements with 1 Element acl::VariableReference with reference on a.
VectorOfElements generateVEIndex(unsigned int size=0)
Advanced Computational Language.
Advanced Simulation Library.
bool testAdvancedOperations()