[petsc-dev] possible bug in MatLoad_MPIBAIJ()

Lisandro Dalcin dalcinl at gmail.com
Tue Mar 12 02:15:01 CDT 2013


On 11 March 2013 23:10, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
>    Hmm, looks like I got the two malloc sizes backwards? locrowlens should be size m and row lengths size mmax?
>

Oh! Yes, I think you are right. The following patch is working for me:

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 Tue Mar 12 10:12:21 2013 +0300
@@ -3712,13 +3712,13 @@
   rend   = rowners[rank+1];

   /* distribute row lengths to all processors */
-  ierr = PetscMalloc((mmax+1)*sizeof(PetscInt),&locrowlens);CHKERRQ(ierr);
+  ierr = PetscMalloc((m+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(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