> El 9 may 2020, a las 20:00, Stefano Zampini <[email protected]> 
> escribió:
> 
> 
> 
> Il giorno sab 9 mag 2020 alle ore 19:43 Jose E. Roman <[email protected]> ha 
> scritto:
> 
> 
> > El 9 may 2020, a las 12:45, Stefano Zampini <[email protected]> 
> > escribió:
> > 
> > Jose
> > 
> > I have just pushed a test 
> > https://gitlab.com/petsc/petsc/-/blob/d64c2bc63c8d5d1a8c689f1abc762ae2722bba26/src/mat/tests/ex69.c
> > See if it fits your framework, and feel free to modify the test to add more 
> > checks
> 
> Almost good. The following modification of the example fails with -test 1:
> 
> 
> diff --git a/src/mat/tests/ex69.c b/src/mat/tests/ex69.c
> index e562f1e2e3..2df2c89be1 100644
> --- a/src/mat/tests/ex69.c
> +++ b/src/mat/tests/ex69.c
> @@ -84,6 +84,10 @@ int main(int argc,char **argv)
>    }
>    ierr = VecCUDARestoreArray(v,&vv);CHKERRQ(ierr);
> 
> +  if (test==1) {
> +    ierr = MatDenseCUDAGetArray(B,&aa);CHKERRQ(ierr);
> +    if (aa) SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_USER,"Expected a null 
> pointer");
> +  }
> 
>    /* free work space */
>    ierr = MatDestroy(&B);CHKERRQ(ierr);
> 
> 
> 
> I would expect that after MatDenseCUDAResetArray() the pointer is NULL 
> because it was set so in line 60. In the CPU counterpart it works as expected.
> 
> Pushed a fix for this, thanks.
>  
> Another comment is: in line 60 you have changed MatDenseCUDAPlaceArray() to 
> MatDenseCUDAReplaceArray(). This is ok, but it is strange because 
> MatDenseReplaceArray() does not exist. So the interface is different in GPU 
> vs CPU, but I guess it is necessary here.
> 
> I think we do not support calling PlaceArray twice anywhere PETSc. This is 
> why I have added MatDenseCUDAReplaceArray(). If you need support for the CPU 
> case too, I can add it.

Yes, please. It is better to have the same thing in both cases.

I am attaching the modified example, now performs a mat-mat product. If I do 
A*B it works well, but if I replace A with a shell matrix I get a memory leak.

[ 0]32 bytes VecCUDAAllocateCheck() line 34 in 
/home/users/proy/copa/jroman/soft/petsc/src/vec/vec/impls/seq/seqcuda/veccuda2.cu
[ 0]32 bytes VecCUDAAllocateCheck() line 34 in 
/home/users/proy/copa/jroman/soft/petsc/src/vec/vec/impls/seq/seqcuda/veccuda2.cu



>  
> Thanks.
> Jose
> 
> 
> > 
> > 
> > Il giorno ven 8 mag 2020 alle ore 18:48 Jose E. Roman <[email protected]> 
> > ha scritto:
> > Attached. Run with -test 1 or -test 2
> > 
> > > El 8 may 2020, a las 17:14, Stefano Zampini <[email protected]> 
> > > escribió:
> > > 
> > > Jose
> > > 
> > > Just send me a MWE and I’ll fix the case for you
> > > 
> > > Thanks
> > > Stefano
> > 
> > 
> > -- 
> > Stefano
> 
> 
> 
> -- 
> Stefano

Attachment: ex69.c
Description: Binary data

Reply via email to