MCPcopy Create free account
hub / github.com/clMathLibraries/clBLAS / DotPerformanceTest

Class DotPerformanceTest

src/tests/performance/perf-dot.cpp:48–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46namespace clMath {
47
48template <typename ElemType> class DotPerformanceTest : public PerformanceTest
49{
50public:
51 virtual ~DotPerformanceTest();
52
53 virtual int prepare(void);
54 virtual nano_time_t etalonPerfSingle(void);
55 virtual nano_time_t clblasPerfSingle(void);
56
57 static void runInstance(BlasFunction fn, TestParams *params)
58 {
59 DotPerformanceTest<ElemType> perfCase(fn, params);
60 int ret = 0;
61 int opFactor;
62 BlasBase *base;
63
64 base = clMath::BlasBase::getInstance();
65
66 opFactor =1;
67
68 if (((fn == FN_DDOT) || (fn == FN_ZDOTU)) &&
69 !base->isDevSupportDoublePrecision()) {
70
71 std::cerr << ">> WARNING: The target device doesn't support native "
72 "double precision floating point arithmetic" <<
73 std::endl << ">> Test skipped" << std::endl;
74 return;
75 }
76
77 if (!perfCase.areResourcesSufficient(params)) {
78 std::cerr << ">> RESOURCE CHECK: Skip due to insufficient resources" <<
79 std::endl;
80 return;
81 }
82 else {
83 ret = perfCase.run(opFactor);
84 }
85
86 ASSERT_GE(ret, 0) << "Fatal error: can not allocate resources or "
87 "perform an OpenCL request!" << endl;
88 EXPECT_EQ(0, ret) << "The OpenCL version is slower in the case" << endl;
89 }
90
91private:
92 DotPerformanceTest(BlasFunction fn, TestParams *params);
93
94 bool areResourcesSufficient(TestParams *params);
95
96 TestParams params_;
97 ElemType *blasX_;
98 ElemType *blasY_;
99 cl_mem mobjX_;
100 cl_mem mobjY_;
101 cl_mem mobjDP_;
102 cl_mem scratchBuff;
103 size_t lengthX;
104 size_t lengthY;
105 ::clMath::BlasBase *base_;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected