[Mpi-forum] about MPI_Scan

Jeff Hammond jeff.science at gmail.com
Fri Sep 2 14:38:46 CDT 2011


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 <likunt at andrew.cmu.edu> 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
> mpi-forum at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-forum
>



-- 
Jeff Hammond
jeff.science at gmail.com




More information about the mpi-forum mailing list