| 57 | namespace clMath { |
| 58 | |
| 59 | template <typename ElemType> class AxpyPerformanceTest : public PerformanceTest |
| 60 | { |
| 61 | public: |
| 62 | virtual ~AxpyPerformanceTest(); |
| 63 | |
| 64 | virtual int prepare(void); |
| 65 | virtual nano_time_t etalonPerfSingle(void); |
| 66 | virtual nano_time_t clblasPerfSingle(void); |
| 67 | |
| 68 | static void runInstance(BlasFunction fn, TestParams *params) |
| 69 | { |
| 70 | AxpyPerformanceTest<ElemType> perfCase(fn, params); |
| 71 | int ret = 0; |
| 72 | int opFactor; |
| 73 | BlasBase *base; |
| 74 | |
| 75 | base = clMath::BlasBase::getInstance(); |
| 76 | |
| 77 | opFactor =1; |
| 78 | |
| 79 | if (((fn == FN_DAXPY) || (fn == FN_ZAXPY)) && |
| 80 | !base->isDevSupportDoublePrecision()) { |
| 81 | |
| 82 | std::cerr << ">> WARNING: The target device doesn't support native " |
| 83 | "double precision floating point arithmetic" << |
| 84 | std::endl << ">> Test skipped" << std::endl; |
| 85 | return; |
| 86 | } |
| 87 | |
| 88 | if (!perfCase.areResourcesSufficient(params)) { |
| 89 | std::cerr << ">> RESOURCE CHECK: Skip due to unsufficient resources" << |
| 90 | std::endl; |
| 91 | return; |
| 92 | } |
| 93 | else { |
| 94 | ret = perfCase.run(opFactor); |
| 95 | } |
| 96 | |
| 97 | ASSERT_GE(ret, 0) << "Fatal error: can not allocate resources or " |
| 98 | "perform an OpenCL request!" << endl; |
| 99 | EXPECT_EQ(0, ret) << "The OpenCL version is slower in the case" << endl; |
| 100 | } |
| 101 | |
| 102 | private: |
| 103 | AxpyPerformanceTest(BlasFunction fn, TestParams *params); |
| 104 | |
| 105 | bool areResourcesSufficient(TestParams *params); |
| 106 | |
| 107 | TestParams params_; |
| 108 | ElemType alpha_; |
| 109 | ElemType *X_; |
| 110 | ElemType *Y_; |
| 111 | ElemType *blasX_; |
| 112 | ElemType *blasY_; |
| 113 | cl_mem mobjX_; |
| 114 | cl_mem mobjY_; |
| 115 | size_t lengthX; |
| 116 | size_t lengthY; |
nothing calls this directly
no outgoing calls
no test coverage detected