Example #1
0
template<> void
xBiCGStab<float>::xBiCGStab_Function( bool flush )
{
    // solve x from y = Ax
    try {
    clsparseStatus status = clsparseScsrbicgStab(&x, &csrMtx, &y, solverControl, control);

//    std::vector<float> h_y(x.num_values);
//    clEnqueueReadBuffer(queue, x.values, CL_TRUE, 0, x.num_values * sizeof(float), h_y.data(), 0, NULL, NULL );
//    for (int i = 0; i < h_y.size(); i++)
//    {
//        std::cout << "hy [" << i << "] = " << h_y[i] << std::endl;
//    }
    }
    catch (std::out_of_range e)
    {
        std::cout << "e: " << std::endl;
    }
    catch (...)
    {
        std::cout << "xxx" << std::endl;
    }

    if( flush )
        clFinish( queue );
}
Example #2
0
    void test_bicg()
    {

        if ( typeid(T) == typeid(cl_float) )
        {
            clsparseStatus status =
                    clsparseScsrbicgStab(&gX, &CSRE::csrSMatrix, &gB, solverControl, CLSE::control);
            ASSERT_EQ(clsparseSuccess, status);
        }

        if ( typeid(T) == typeid(cl_double))
        {
            clsparseStatus status =
                    clsparseDcsrbicgStab(&gX, &CSRE::csrDMatrix, &gB, solverControl, CLSE::control);
            ASSERT_EQ(clsparseSuccess, status);
        }
    }