         PERFWARNING_LOG("AXPBY will not be done on-the-fly!");
         z->axpby(z,lhs,&seta,&sdelta);
     }
-    
-    if (origlhs != lhs) {
-        PERFWARNING_LOG("Scatter the result back");
-        GHOST_CALL_RETURN(origlhs->fromVec(origlhs,lhs,0,0));
-    }
-    
-    return GHOST_SUCCESS;
-}
-    
-    template<typename dt1, typename dt2>
-static ghost_error_t ghost_cu_sell1spmmv_cm_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_spmmv_cm_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);
-
-    GHOST_SPMV_PARSE_ARGS(options,argp,scale,beta,shift,localdot,z,sdelta,seta,dt2,dt1);
-
-    if (options & GHOST_SPMV_AXPY) {
-        one<dt1>(beta);
-    } else {
-        zero<dt1>(beta);
-    }
-    
-    sell1kernel(cusparse_handle,CUSPARSE_OPERATION_NON_TRANSPOSE,mat->nrows,rhs->traits.ncols,mat->ncols,mat->nnz,&scale,descr,(dt1 *)SELL(mat)->cumat->val, SELL(mat)->cumat->chunkStart, SELL(mat)->cumat->col, (dt1 *)rhs->cu_val, rhs->stride, &beta, (dt1 *)lhs->cu_val, lhs->stride);
-    
-    if (options & (GHOST_SPMV_SHIFT|GHOST_SPMV_VSHIFT)) {
-        PERFWARNING_LOG("Shift will not be applied on-the-fly!");
-        dt2 minusshift[rhs->traits.ncols];
-        ghost_lidx_t col;
-        if (options & GHOST_SPMV_SHIFT) {
-            for (col=0; col<rhs->traits.ncols; col++) {
-                minusshift[col] = -1.*(*(dt2 *)&scale)*(*(dt2 *)shift);
-            }
-        } else {
-            for (col=0; col<rhs->traits.ncols; col++) {
-                minusshift[col] = -1.*(*(dt2 *)&scale)*(((dt2 *)shift)[col]);
-            }
-        }
-        lhs->vaxpy(lhs,rhs,minusshift);
-    }
-
-    if (options & GHOST_SPMV_DOT_ANY) {
-        PERFWARNING_LOG("Dot product computation will be not be done on-the-fly!");
-        memset(localdot,0,lhs->traits.ncols*3*sizeof(dt1));
-        if (options & GHOST_SPMV_DOT_YY) {
-            lhs->localdot_vanilla(lhs,&localdot[0],lhs);
-        }
-        if (options & GHOST_SPMV_DOT_XY) {
-            lhs->localdot_vanilla(lhs,&localdot[lhs->traits.ncols],rhs);
-        }
-        if (options & GHOST_SPMV_DOT_XX) {
-            rhs->localdot_vanilla(rhs,&localdot[2*lhs->traits.ncols],rhs);
-        }
-            
-    }
-    if (options & GHOST_SPMV_CHAIN_AXPBY) {
-        PERFWARNING_LOG("AXPBY will not be done on-the-fly!");
-        z->axpby(z,lhs,&seta,&sdelta);
-    }
-    
-    
-    if (origlhs != lhs) {
-        PERFWARNING_LOG("Scatter the result back");
-        GHOST_CALL_RETURN(origlhs->fromVec(origlhs,lhs,0,0));
-    }
-
-    return GHOST_SUCCESS;
-}
-
-    template<typename dt1, typename dt2>
-static ghost_error_t ghost_cu_sell1spmmv_rm_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_spmmv_rm_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);
-
-    GHOST_SPMV_PARSE_ARGS(options,argp,scale,beta,shift,localdot,z,sdelta,seta,dt2,dt1);
-
-    if (options & GHOST_SPMV_AXPY) {
-        one<dt1>(beta);
-    } else if (!(options & GHOST_SPMV_AXPBY)) {
-        zero<dt1>(beta);
-    }
-    
-    CUSPARSE_CALL_RETURN(sell1kernel(cusparse_handle,CUSPARSE_OPERATION_NON_TRANSPOSE,CUSPARSE_OPERATION_TRANSPOSE,mat->nrows,rhs->traits.ncols,mat->ncols,mat->nnz,&scale,descr,(dt1 *)SELL(mat)->cumat->val, SELL(mat)->cumat->chunkStart, SELL(mat)->cumat->col, (dt1 *)rhs->cu_val, rhs->stride, &beta, (dt1 *)lhs->cu_val,lhs->stride));
-    
-    // This needs to be done prior to further computation because lhs is col-major and rhs is row-major.
-    if (origlhs != lhs) {
-        PERFWARNING_LOG("Transpose the result back");
-        GHOST_CALL_RETURN(origlhs->fromVec(origlhs,lhs,0,0));
-    }
-
-    if (options & (GHOST_SPMV_SHIFT|GHOST_SPMV_VSHIFT)) {
-        PERFWARNING_LOG("Shift will not be applied on-the-fly!");
-        dt2 minusshift[rhs->traits.ncols];
-        ghost_lidx_t col;
-        if (options & GHOST_SPMV_SHIFT) {
-            for (col=0; col<rhs->traits.ncols; col++) {
-                minusshift[col] = -1.*(*(dt2 *)&scale)*(*(dt2 *)shift);
-            }
-        } else {
-            for (col=0; col<rhs->traits.ncols; col++) {
-                minusshift[col] = -1.*(*(dt2 *)&scale)*(((dt2 *)shift)[col]);
-            }
-        }
-        lhs->vaxpy(lhs,rhs,minusshift);
-    }
-    
-    if (options & GHOST_SPMV_DOT_ANY) {
-        PERFWARNING_LOG("Dot product computation will be not be done on-the-fly!");
-        memset(localdot,0,lhs->traits.ncols*3*sizeof(dt1));
-        if (options & GHOST_SPMV_DOT_YY) {
-            origlhs->localdot_vanilla(origlhs,&localdot[0],origlhs);
-        }
-        if (options & GHOST_SPMV_DOT_XY) {
-            origlhs->localdot_vanilla(origlhs,&localdot[rhs->traits.ncols],rhs);
-        }
-        if (options & GHOST_SPMV_DOT_XX) {
-            rhs->localdot_vanilla(rhs,&localdot[2*lhs->traits.ncols],rhs);
-        }
-            
-    }
-    if (options & GHOST_SPMV_CHAIN_AXPBY) {
-        PERFWARNING_LOG("AXPBY will not be done on-the-fly!");
-        z->axpby(z,lhs,&seta,&sdelta);
-    }
-    
-    
-    return GHOST_SUCCESS;
+   
+    return GHOST_SUCCESS; 
 }
 
 ghost_error_t ghost_cu_sell1_spmv_selector(ghost_sparsemat_t *mat, ghost_densemat_t * lhs_in, ghost_densemat_t * rhs_in, ghost_spmv_flags_t options, va_list argp)
 {
     ghost_error_t ret = GHOST_SUCCESS;
-    ghost_densemat_t *lhs = lhs_in, *rhs = rhs_in;
-    ghost_densemat_traits_t lhstraits = lhs_in->traits;
-    ghost_densemat_traits_t rhstraits = rhs_in->traits;
+    ghost_densemat_t *lhs, *rhs;
+    va_list argpbackup;
+    va_copy(argpbackup,argp);
     
     if (mat->traits.datatype != lhs_in->traits.datatype) {
         ERROR_LOG("Mixed data types not implemented!");

            lhs->localdot_vanilla(lhs,&localdot[0],lhs);
        }
        if (options & GHOST_SPMV_DOT_XY) {
            lhs->localdot_vanilla(lhs,&localdot[lhs->traits.ncols],rhs);
        }
        if (options & GHOST_SPMV_DOT_XX) {
            rhs->localdot_vanilla(rhs,&localdot[2*lhs->traits.ncols],rhs);

    }
    
    CUSPARSE_CALL_RETURN(sell1kernel(cusparse_handle,CUSPARSE_OPERATION_NON_TRANSPOSE,mat->nrows,mat->ncols,mat->nnz,&scale,descr,(dt1 *)SELL(mat)->cumat->val, SELL(mat)->cumat->chunkStart, SELL(mat)->cumat->col, (dt1 *)rhs->cu_val, &beta, (dt1 *)lhs->cu_val));
   
    GHOST_FUNC_EXIT(GHOST_FUNCTYPE_MATH);
    return GHOST_SUCCESS;
}
    
    template<typename dt1, typename dt2>
static ghost_error_t ghost_cu_sell1spmmv_cm_tmpl(ghost_sparsemat_t *mat, ghost_densemat_t * lhs, ghost_densemat_t * rhs, ghost_spmv_flags_t options, va_list argp, cusparse_sell1_spmmv_cm_kernel_t sell1kernel)
{
    GHOST_FUNC_ENTER(GHOST_FUNCTYPE_MATH);
    cusparseHandle_t cusparse_handle;
    cusparseMatDescr_t descr;

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

    dt2 * __attribute__((unused)) localdot = NULL;
    dt1 * __attribute__((unused)) shift = NULL, scale, beta, __attribute__((unused)) sdelta, __attribute__((unused)) seta;
    ghost_densemat_t * __attribute__((unused)) z = NULL;

    one<dt1>(scale);

    GHOST_SPMV_PARSE_ARGS(options,argp,scale,beta,shift,localdot,z,sdelta,seta,dt2,dt1);
    
    if (options & GHOST_SPMV_AXPY) {
        one<dt1>(beta);
    } else if (!(options & GHOST_SPMV_AXPBY)) {
        zero<dt1>(beta);
    }
    
    CUSPARSE_CALL_RETURN(sell1kernel(cusparse_handle,CUSPARSE_OPERATION_NON_TRANSPOSE,mat->nrows,rhs->traits.ncols,mat->ncols,mat->nnz,&scale,descr,(dt1 *)SELL(mat)->cumat->val, SELL(mat)->cumat->chunkStart, SELL(mat)->cumat->col, (dt1 *)rhs->cu_val, rhs->stride, &beta, (dt1 *)lhs->cu_val, lhs->stride));

    GHOST_FUNC_EXIT(GHOST_FUNCTYPE_MATH);
    return GHOST_SUCCESS;
}

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

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

    dt2 * __attribute__((unused)) localdot = NULL;
    dt1 * __attribute__((unused)) shift = NULL, scale, beta, __attribute__((unused)) sdelta, __attribute__((unused)) seta;
    ghost_densemat_t * __attribute__((unused)) z = NULL;

    one<dt1>(scale);

    GHOST_SPMV_PARSE_ARGS(options,argp,scale,beta,shift,localdot,z,sdelta,seta,dt2,dt1);

    if (options & GHOST_SPMV_AXPY) {
        one<dt1>(beta);
    } else if (!(options & GHOST_SPMV_AXPBY)) {
        zero<dt1>(beta);
    }
    
    CUSPARSE_CALL_RETURN(sell1kernel(cusparse_handle,CUSPARSE_OPERATION_NON_TRANSPOSE,CUSPARSE_OPERATION_TRANSPOSE,mat->nrows,rhs->traits.ncols,mat->ncols,mat->nnz,&scale,descr,(dt1 *)SELL(mat)->cumat->val, SELL(mat)->cumat->chunkStart, SELL(mat)->cumat->col, (dt1 *)rhs->cu_val, rhs->stride, &beta, (dt1 *)lhs->cu_val,lhs->stride));
    
    
    GHOST_FUNC_EXIT(GHOST_FUNCTYPE_MATH);
    return GHOST_SUCCESS;
}
    
    template<typename dt1, typename dt2>
static ghost_error_t ghost_cu_sell1spmv_augfunc_tmpl(ghost_densemat_t * lhs, ghost_densemat_t * rhs, ghost_spmv_flags_t options, va_list argp)
{
    dt2 *localdot = NULL;
    dt1 *shift = NULL, __attribute__((unused)) scale, __attribute__((unused)) beta, sdelta, seta;
    ghost_densemat_t *z = NULL;

    GHOST_SPMV_PARSE_ARGS(options,argp,scale,beta,shift,localdot,z,sdelta,seta,dt2,dt1);
    if (options & (GHOST_SPMV_SHIFT|GHOST_SPMV_VSHIFT)) {
        PERFWARNING_LOG("Shift will not be applied on-the-fly!");
        dt2 minusshift[rhs->traits.ncols];
