Re: [petsc-dev] Segmentation faults in MatMatMult & MatTransposeMatMult

2019-01-14 Thread Pierre Jolivet via petsc-dev

> On 15 Jan 2019, at 6:26 AM, Jed Brown  wrote:
> 
> We should repair the MPI matrix implementations so that this works on 
> communicators of size 1

Great, I was worried that I missed somewhere that it is explicitly stated that 
you should not use MPI types on communicators of size 1.

> but why can't you use MatXAIJSetPreallocation().

OK, replace my if then else by if(comm_size == 1) VecCreateSeqWithArray else 
VecCreateMPIWithArray
There is also no MatXBAIJSetPreallocationCSR or MatXDenseSetPreallocation, so 
that's other if then elses.

Or am I missing something?

Thanks,
Pierre

> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatXAIJSetPreallocation.html
>  
> 
> 
> Pierre Jolivet via petsc-dev  > writes:
> 
>> Cf. the end of my sentence: "(I know, I could switch to SeqAIJ_SeqDense, but 
>> that is not an option I have right now)”
>> All my Mat are of type MATMPIX. Switching to MATX here as you suggested 
>> would mean that I need to add a bunch of if(comm_size == 1) 
>> MatSeqXSetPreallocation else MatMPIXSetPreallocation in the rest of my code, 
>> which is something I would rather avoid.
>> 
>> Thanks,
>> Pierre
>> 
>>> On 14 Jan 2019, at 10:30 PM, Zhang, Hong  wrote:
>>> 
>>> Replace 
>>> ierr = MatSetType(A, MATMPIAIJ);CHKERRQ(ierr);
>>> to
>>> ierr = MatSetType(A, MATAIJ);CHKERRQ(ierr);
>>> 
>>> Replace 
>>> ierr = MatSetType(B, MATMPIDENSE)i;CHKERRQ(ierr);
>>> to
>>> ierr = MatSetType(B, MATDENSE)i;CHKERRQ(ierr);
>>> 
>>> Then add
>>> MatSeqAIJSetPreallocation()
>>> MatSeqDenseSetPreallocation()
>>> 
>>> Hong
>>> 
>>> On Mon, Jan 14, 2019 at 2:51 PM Pierre Jolivet via petsc-dev 
>>> mailto:petsc-dev@mcs.anl.gov> 
>>> >> wrote:
>>> Hello,
>>> Is there any chance to get MatMatMult_MPIAIJ_MPIDense  and 
>>> MatTransposeMatMult_MPIAIJ_MPIDense fixed so that the attached program 
>>> could run _with a single_ process? (I know, I could switch to 
>>> SeqAIJ_SeqDense, but that is not an option I have right now)
>>> 
>>> Thanks in advance,
>>> Pierre



Re: [petsc-dev] Segmentation faults in MatMatMult & MatTransposeMatMult

2019-01-14 Thread Jed Brown via petsc-dev
We should repair the MPI matrix implementations so that this works on 
communicators of size 1, but why can't you use MatXAIJSetPreallocation().

https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatXAIJSetPreallocation.html

Pierre Jolivet via petsc-dev  writes:

> Cf. the end of my sentence: "(I know, I could switch to SeqAIJ_SeqDense, but 
> that is not an option I have right now)”
> All my Mat are of type MATMPIX. Switching to MATX here as you suggested would 
> mean that I need to add a bunch of if(comm_size == 1) MatSeqXSetPreallocation 
> else MatMPIXSetPreallocation in the rest of my code, which is something I 
> would rather avoid.
>
> Thanks,
> Pierre
>
>> On 14 Jan 2019, at 10:30 PM, Zhang, Hong  wrote:
>> 
>> Replace 
>> ierr = MatSetType(A, MATMPIAIJ);CHKERRQ(ierr);
>> to
>> ierr = MatSetType(A, MATAIJ);CHKERRQ(ierr);
>> 
>> Replace 
>> ierr = MatSetType(B, MATMPIDENSE)i;CHKERRQ(ierr);
>> to
>> ierr = MatSetType(B, MATDENSE)i;CHKERRQ(ierr);
>> 
>> Then add
>> MatSeqAIJSetPreallocation()
>> MatSeqDenseSetPreallocation()
>> 
>> Hong
>> 
>> On Mon, Jan 14, 2019 at 2:51 PM Pierre Jolivet via petsc-dev 
>> mailto:petsc-dev@mcs.anl.gov>> wrote:
>> Hello,
>> Is there any chance to get MatMatMult_MPIAIJ_MPIDense  and 
>> MatTransposeMatMult_MPIAIJ_MPIDense fixed so that the attached program could 
>> run _with a single_ process? (I know, I could switch to SeqAIJ_SeqDense, but 
>> that is not an option I have right now)
>> 
>> Thanks in advance,
>> Pierre
>> 


Re: [petsc-dev] Segmentation faults in MatMatMult & MatTransposeMatMult

2019-01-14 Thread Pierre Jolivet via petsc-dev
Cf. the end of my sentence: "(I know, I could switch to SeqAIJ_SeqDense, but 
that is not an option I have right now)”
All my Mat are of type MATMPIX. Switching to MATX here as you suggested would 
mean that I need to add a bunch of if(comm_size == 1) MatSeqXSetPreallocation 
else MatMPIXSetPreallocation in the rest of my code, which is something I would 
rather avoid.

Thanks,
Pierre

> On 14 Jan 2019, at 10:30 PM, Zhang, Hong  wrote:
> 
> Replace 
> ierr = MatSetType(A, MATMPIAIJ);CHKERRQ(ierr);
> to
> ierr = MatSetType(A, MATAIJ);CHKERRQ(ierr);
> 
> Replace 
> ierr = MatSetType(B, MATMPIDENSE)i;CHKERRQ(ierr);
> to
> ierr = MatSetType(B, MATDENSE)i;CHKERRQ(ierr);
> 
> Then add
> MatSeqAIJSetPreallocation()
> MatSeqDenseSetPreallocation()
> 
> Hong
> 
> On Mon, Jan 14, 2019 at 2:51 PM Pierre Jolivet via petsc-dev 
> mailto:petsc-dev@mcs.anl.gov>> wrote:
> Hello,
> Is there any chance to get MatMatMult_MPIAIJ_MPIDense  and 
> MatTransposeMatMult_MPIAIJ_MPIDense fixed so that the attached program could 
> run _with a single_ process? (I know, I could switch to SeqAIJ_SeqDense, but 
> that is not an option I have right now)
> 
> Thanks in advance,
> Pierre
> 



Re: [petsc-dev] Segmentation faults in MatMatMult & MatTransposeMatMult

2019-01-14 Thread Zhang, Hong via petsc-dev
Replace
ierr = MatSetType(A, MATMPIAIJ);CHKERRQ(ierr);
to
ierr = MatSetType(A, MATAIJ);CHKERRQ(ierr);

Replace
ierr = MatSetType(B, MATMPIDENSE)i;CHKERRQ(ierr);
to
ierr = MatSetType(B, MATDENSE)i;CHKERRQ(ierr);

Then add
MatSeqAIJSetPreallocation()
MatSeqDenseSetPreallocation()

Hong

On Mon, Jan 14, 2019 at 2:51 PM Pierre Jolivet via petsc-dev 
mailto:petsc-dev@mcs.anl.gov>> wrote:
Hello,
Is there any chance to get MatMatMult_MPIAIJ_MPIDense  and 
MatTransposeMatMult_MPIAIJ_MPIDense fixed so that the attached program could 
run _with a single_ process? (I know, I could switch to SeqAIJ_SeqDense, but 
that is not an option I have right now)

Thanks in advance,
Pierre



[petsc-dev] Segmentation faults in MatMatMult & MatTransposeMatMult

2019-01-14 Thread Pierre Jolivet via petsc-dev
Hello,
Is there any chance to get MatMatMult_MPIAIJ_MPIDense  and 
MatTransposeMatMult_MPIAIJ_MPIDense fixed so that the attached program could 
run _with a single_ process? (I know, I could switch to SeqAIJ_SeqDense, but 
that is not an option I have right now)

Thanks in advance,
Pierre



ex15.c
Description: Binary data