[petsc-dev] possible bug in MatLoad_MPIBAIJ()
Barry Smith
bsmith at mcs.anl.gov
Mon Mar 11 15:10:19 CDT 2013
Hmm, looks like I got the two malloc sizes backwards? locrowlens should be size m and row lengths size mmax?
Barry
/* distribute row lengths to all processors */
ierr = PetscMalloc((mmax+1)*sizeof(PetscInt),&locrowlens);CHKERRQ(ierr);
if (!rank) {
mend = m;
if (size == 1) mend = mend - extra_rows;
ierr = PetscBinaryRead(fd,locrowlens,mend,PETSC_INT);CHKERRQ(ierr);
for (j=mend; j<m; j++) locrowlens[j] = 1;
ierr = PetscMalloc(m*sizeof(PetscInt),&rowlengths);CHKERRQ(ierr);
ierr = PetscMalloc(size*sizeof(PetscInt),&procsnz);CHKERRQ(ierr);
ierr = PetscMemzero(procsnz,size*sizeof(PetscInt));CHKERRQ(ierr);
for (j=0; j<m; j++) {
procsnz[0] += locrowlens[j];
}
for (i=1; i<size; i++) {
mend = browners[i+1] - browners[i];
if (i == size-1) mend = mend - extra_rows;
ierr = PetscBinaryRead(fd,rowlengths,mend,PETSC_INT);CHKERRQ(ierr);
for (j=mend; j<browners[i+1] - browners[i]; j++) rowlengths[j] = 1;
On Mar 11, 2013, at 1:34 PM, Lisandro Dalcin <dalcinl at gmail.com> wrote:
> Please review and apply the following patch for release-3.3 (if it is
> OK, should be pushed to dev, too).
>
>
> diff -r ec5e51fd886c src/mat/impls/baij/mpi/mpibaij.c
> --- a/src/mat/impls/baij/mpi/mpibaij.c Sat Mar 09 10:50:47 2013 -0600
> +++ b/src/mat/impls/baij/mpi/mpibaij.c Mon Mar 11 21:19:18 2013 +0300
> @@ -3718,7 +3718,7 @@
> if (size == 1) mend = mend - extra_rows;
> ierr = PetscBinaryRead(fd,locrowlens,mend,PETSC_INT);CHKERRQ(ierr);
> for (j=mend; j<m; j++) locrowlens[j] = 1;
> - ierr = PetscMalloc(m*sizeof(PetscInt),&rowlengths);CHKERRQ(ierr);
> + ierr = PetscMalloc(mmax*sizeof(PetscInt),&rowlengths);CHKERRQ(ierr);
> ierr = PetscMalloc(size*sizeof(PetscInt),&procsnz);CHKERRQ(ierr);
> ierr = PetscMemzero(procsnz,size*sizeof(PetscInt));CHKERRQ(ierr);
> for (j=0; j<m; j++) {
>
>
> --
> Lisandro Dalcin
> ---------------
> CIMEC (INTEC/CONICET-UNL)
> Predio CONICET-Santa Fe
> Colectora RN 168 Km 472, Paraje El Pozo
> 3000 Santa Fe, Argentina
> Tel: +54-342-4511594 (ext 1011)
> Tel/Fax: +54-342-4511169
More information about the petsc-dev
mailing list