redefine (or remove) MatPreallocateSymmetricInitialize to MatPreallocateInitialize
The patch at the end is perhaps a little hard to read, but the basic idea is to redefine (or eventually remove) MatPreallocateSymmetricInitialize, and use MatPreallocateInitialize. For this, all what is required is to somehow trick the C compiler to not complain about unused-but-set-variable (the -W warning name for GCC). That is the "__start = 0; __end = __start;" change in the first hunk. If you agree, I'll like to push this change, and next I'll update the code to use MatPreallocateInitialize() in all cases... What I'm not sure is about removing MatPreallocateSymmetricInitialize, as it could potentially break user code. diff -r de0779566bd9 include/petscmat.h --- a/include/petscmat.h Fri Mar 30 16:54:32 2012 -0500 +++ b/include/petscmat.h Sat Mar 31 15:27:23 2012 +0300 @@ -735,7 +735,7 @@ PetscErrorCode _4_ierr; PetscInt __nrows = (nrows),__ctmp = (ncols),__rstart,__start,__end; \ _4_ierr = PetscMalloc2(__nrows,PetscInt,&dnz,__nrows,PetscInt,&onz);CHKERRQ(_4_ierr); \ _4_ierr = PetscMemzero(dnz,__nrows*sizeof(PetscInt));CHKERRQ(_4_ierr);\ - _4_ierr = PetscMemzero(onz,__nrows*sizeof(PetscInt));CHKERRQ(_4_ierr);\ + _4_ierr = PetscMemzero(onz,__nrows*sizeof(PetscInt));CHKERRQ(_4_ierr); __start = 0; __end = __start; \ _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __start = __end - __ctmp;\ _4_ierr = MPI_Scan(&__nrows,&__rstart,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __nrows; @@ -772,14 +772,7 @@ .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(), MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal() M*/ -#define MatPreallocateSymmetricInitialize(comm,nrows,ncols,dnz,onz) 0; \ -{ \ - PetscErrorCode _4_ierr; PetscInt __nrows = (nrows),__ctmp = (ncols),__rstart,__end; \ - _4_ierr = PetscMalloc2(__nrows,PetscInt,&dnz,__nrows,PetscInt,&onz);CHKERRQ(_4_ierr); \ - _4_ierr = PetscMemzero(dnz,__nrows*sizeof(PetscInt));CHKERRQ(_4_ierr);\ - _4_ierr = PetscMemzero(onz,__nrows*sizeof(PetscInt));CHKERRQ(_4_ierr);\ - _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr);\ - _4_ierr = MPI_Scan(&__nrows,&__rstart,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __nrows; +#define MatPreallocateSymmetricInitialize(comm,nrows,ncols,dnz,onz) MatPreallocateInitialize(comm,nrows,ncols,dnz,onz) /*MC MatPreallocateSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be -- 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
participants (1)
-
Lisandro Dalcin