 err:
     ERROR_LOG("Error in SELL-1 SpMV!");
 out:
-    if (lhs != lhs_in) {
-        lhs->destroy(lhs);
-    }
-    if (rhs != rhs_in) {
-        rhs->destroy(rhs);
-    }
 
     return ret;
 }

        void           *y, int ldy);

    template<typename dt1, typename dt2>
static ghost_error_t ghost_cu_sell1spmv_tmpl(ghost_sparsemat_t *mat, ghost_densemat_t * lhs, ghost_densemat_t *origlhs, ghost_densemat_t * rhs, ghost_spmv_flags_t options, va_list argp, cusparse_sell1_spmv_kernel_t sell1kernel)
{
    cusparseHandle_t cusparse_handle;
    cusparseMatDescr_t descr;

    cusparseCreateMatDescr(&descr);
    GHOST_CALL_RETURN(ghost_cu_cusparse_handle(&cusparse_handle));

    dt2 *localdot = NULL;
    dt1 *shift = NULL, scale, beta, sdelta, seta;
    ghost_densemat_t *z = NULL;

    one<dt1>(scale);


        goto err;
    }
    if ((lhs_in->traits.flags & GHOST_DENSEMAT_SCATTERED) || (lhs_in->traits.storage == GHOST_DENSEMAT_ROWMAJOR)) {
        PERFWARNING_LOG("Cloning lhs");
        if (lhs_in->traits.flags & GHOST_DENSEMAT_SCATTERED) {
            PERFWARNING_LOG("Cloning and compressing lhs before operation because it is scattered");
        }
        if (lhs_in->traits.storage == GHOST_DENSEMAT_ROWMAJOR) {
            PERFWARNING_LOG("Cloning and transposing lhs before operation because it is row-major");
        }
        ghost_densemat_traits_t lhstraits = lhs_in->traits;
        lhstraits.location = GHOST_LOCATION_DEVICE;
        lhstraits.storage = GHOST_DENSEMAT_COLMAJOR;
        lhstraits.flags &= (ghost_densemat_flags_t)(~GHOST_DENSEMAT_VIEW);
        GHOST_CALL_GOTO(ghost_densemat_create(&lhs,lhs_in->context,lhstraits),err,ret);
        GHOST_CALL_GOTO(lhs->fromVec(lhs,lhs_in,0,0),err,ret);
    } else {
        lhs = lhs_in;
    }
    if ((rhs_in->traits.flags & GHOST_DENSEMAT_SCATTERED) || ((rhs_in->traits.ncols == 1) && (rhs_in->traits.storage == GHOST_DENSEMAT_ROWMAJOR))) {
        PERFWARNING_LOG("Cloning rhs");
        if (rhs_in->traits.flags & GHOST_DENSEMAT_SCATTERED) {
            PERFWARNING_LOG("Cloning and compressing rhs before operation because it is scattered");
        }
        if ((rhs_in->traits.ncols == 1) && (rhs_in->traits.storage == GHOST_DENSEMAT_ROWMAJOR)) {
            PERFWARNING_LOG("Cloning and transposing lhs before operation because it is row-major");
        }
        ghost_densemat_traits_t rhstraits = rhs_in->traits;
        rhstraits.location = GHOST_LOCATION_DEVICE;
        rhstraits.storage = GHOST_DENSEMAT_COLMAJOR;
        rhstraits.flags &= (ghost_densemat_flags_t)(~GHOST_DENSEMAT_VIEW);
        GHOST_CALL_GOTO(ghost_densemat_create(&rhs,rhs_in->context,rhstraits),err,ret);
        GHOST_CALL_GOTO(rhs->fromVec(rhs,rhs_in,0,0),err,ret);
    } else {
