This is not the appropriate list for this question. Please direct your question to the PETSc list since it is impossible to understand the context of your usage of MPI_Scan without knowledge of the PETSc API. Jeff On Fri, Sep 2, 2011 at 2:30 PM, Likun Tan <[email protected]> wrote:
Hello,
I have a rectangular matrix B with size M*N (where N>>M), i use the following command to create and compute the matrix by column:
PetscSplitOwnership(PETSC_COMM_WORLD, &n, &N); MPI_Scan(&n, &cstart, 1, MPI_INT, MPI_SUM, PETSC_COMM_WORLD); cstart -= n; MatCreateSeqDense(PETSC_COMM_SELF, M, n, PETSC_NULL, &B);
for(j=0; j<n; j++) { � for(i=0; i<M; i++) � { � � �MatSetValues(B, 1, &i, 1, &j, &value, INSERT_VALUES); � } }
MatAssemblyBegin(B, MAT_FINAL_ASSEMBLY); MatAssemblyEnd(B, MAT_FINAL_ASSEMBLY);
where n is the number of columns in each processor. Any problem with this?
Thanks, Likun
_______________________________________________ mpi-forum mailing list [email protected] http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-forum
-- Jeff Hammond [email protected]
participants (1)
-
Jeff Hammond