[petsc-users] AllReduce function for mat

Barry Smith bsmith at mcs.anl.gov
Mon Feb 9 11:22:20 CST 2015


  Use MatDenseGetArray() and call MPI_Allreduce() on the resulting array point as the output buffer. Past MPI_IN_PLACE as the input buffer.

  Barry


> On Feb 9, 2015, at 11:12 AM, Ghosh, Swarnava <sghosh2012 at gatech.edu> wrote:
> 
> The matrix is dense and each process has the same number of nonzeros.
> 
> ----- Original Message -----
> From: "Barry Smith" <bsmith at mcs.anl.gov>
> To: "Swarnava Ghosh" <sghosh2012 at gatech.edu>
> Cc: "PETSc users list" <petsc-users at mcs.anl.gov>
> Sent: Monday, February 9, 2015 12:11:07 PM
> Subject: Re: [petsc-users] AllReduce function for mat
> 
> 
>> On Feb 9, 2015, at 10:57 AM, Ghosh, Swarnava <sghosh2012 at gatech.edu> wrote:
>> 
>> Hi,
>> 
>>  I have sequential matrix on each process. I wanted to do something like MPI_Allreduce to this matrix to add entries from all processes. The resulting matrix is sequential. 
> 
>   Is the matrix dense or sparse?
>   If sparse is each process providing a different set of nonzero values? Or are all processes providing ALL nonzeros in the matrix (to be added together). 
> 
>>  I wanted to know if there is a PETSc function to do this?
>> 
>> -- 
>> SG
>> 
> 
> 
> -- 



More information about the petsc-users mailing list