         zero<dt1>(beta);
     }
     
-    CUSPARSE_CALL_RETURN(sell1kernel(cusparse_handle,CUSPARSE_OPERATION_NON_TRANSPOSE,CUSPARSE_OPERATION_TRANSPOSE,SPM_NROWS(mat),rhs->traits.ncols,DM_NROWS(rhs),mat->nEnts,&scale,descr,(dt1 *)mat->cu_val, mat->cu_chunkStart, mat->cu_col, (dt1 *)rhs->cu_val, rhs->stride, &beta, (dt1 *)lhs->cu_val,lhs->stride));
+    int matncols,nrank;
+    ghost_nrank(&nrank,mat->context->mpicomm);
+    if (nrank > 1) {
+        matncols = mat->context->col_map->dimhalo;
+    } else {
+        matncols = mat->context->col_map->dim;
+    }
+    CUSPARSE_CALL_RETURN(sell1kernel(cusparse_handle,CUSPARSE_OPERATION_NON_TRANSPOSE,CUSPARSE_OPERATION_TRANSPOSE,SPM_NROWS(mat),rhs->traits.ncols,matncols,mat->nEnts,&scale,descr,(dt1 *)mat->cu_val, mat->cu_chunkStart, mat->cu_col, (dt1 *)rhs->cu_val, rhs->stride, &beta, (dt1 *)lhs->cu_val,lhs->stride));
     
     
     GHOST_FUNC_EXIT(GHOST_FUNCTYPE_MATH);

#include "ghost/util.h"
#include "ghost/sparsemat.h"
#include "ghost/math.h"

#include <complex>
#include <cuda_runtime.h>

        rhstraits.flags &= (ghost_densemat_flags)(~GHOST_DENSEMAT_VIEW);
        GHOST_CALL_GOTO(ghost_densemat_create(&rhs,rhs_in->map,rhstraits),err,ret);
        GHOST_CALL_GOTO(ghost_densemat_init_densemat(rhs,rhs_in,0,0),err,ret);
        GHOST_CALL_GOTO(ghost_cu_memtranspose(rhs->map->nhalo,rhs->traits.ncols,
                    &rhs->cu_val[(rhs->map->dimhalo-rhs->map->nhalo)*rhs->elSize],rhs->stride,
                    &rhs_in->cu_val[(rhs_in->map->dimhalo-rhs_in->map->nhalo)*rhs_in->stride*rhs_in->elSize],rhs_in->stride,
                    rhs->traits.datatype),err,ret);
    } else {
        rhs = rhs_in;
    }
