void SetUp() { // Setup solver control clsparseStatus status; solverControl = clsparseCreateSolverControl(precond, maxIterations, relativeTolerance, absoluteTolerance); ASSERT_NE(nullptr, solverControl); status = clsparseSolverPrintMode(solverControl, printMode); ASSERT_EQ(clsparseSuccess, status); // Setup rhs and vector of unknowns hX = uBLAS::vector<T>(CSRE::n_cols, (T) initialUnknownsValue); hB = uBLAS::vector<T>(CSRE::n_rows, (T) initialRhsValue); clsparseInitVector(&gX); clsparseInitVector(&gB); cl_int cl_status; gX.values = clCreateBuffer(CLSE::context, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, hX.size() * sizeof(T), hX.data().begin(), &cl_status); gX.num_values = hX.size(); ASSERT_EQ(CL_SUCCESS, cl_status); gB.values = clCreateBuffer(CLSE::context, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, hB.size() * sizeof(T), hB.data().begin(), &cl_status); gB.num_values = hB.size(); ASSERT_EQ(CL_SUCCESS, cl_status); }
xBiCGStab( PFCLSPARSETIMER sparseGetTimer, size_t profileCount, cl_device_type devType ): clsparseFunc( devType, CL_QUEUE_PROFILING_ENABLE ),/* gpuTimer( nullptr ),*/ cpuTimer( nullptr ) { // Create and initialize our timer class, if the external timer shared library loaded if( sparseGetTimer ) { // gpuTimer = sparseGetTimer( CLSPARSE_GPU ); // gpuTimer->Reserve( 1, profileCount ); // gpuTimer->setNormalize( true ); cpuTimer = sparseGetTimer( CLSPARSE_CPU ); cpuTimer->Reserve( 1, profileCount ); cpuTimer->setNormalize( true ); // gpuTimerID = gpuTimer->getUniqueID( "GPU xCGM", 0 ); cpuTimerID = cpuTimer->getUniqueID( "CPU xBiCGStab", 0 ); } clsparseEnableAsync( control, false ); solverControl = clsparseCreateSolverControl(DIAGONAL, 1000, 1e-6, 0); clsparseSolverPrintMode(solverControl, VERBOSE); }