PetscMalloc petsc-3.0.0-p4

David Fuentes fuentesdt at gmail.com
Mon Mar 23 18:41:57 CDT 2009



running on ubuntu 8.04.

the following code should reproduce the problem.



static char help[] = "MatCreateSeqDense\n\n";

#include "petscpc.h"

#undef __FUNCT__
#define __FUNCT__ "main"
int main(int argc,char **args)
{
   Mat            mat;
   PetscErrorCode ierr;
   PetscInt       npixel = 256*256*5;
   PetscInt       n= npixel * npixel;

   PetscInitialize(&argc,&args,(char *)0,help);


   /* Create and assemble matrix */
   ierr = MatCreateSeqDense(PETSC_COMM_SELF,n,n,PETSC_NULL,&mat);CHKERRQ(ierr);
   ierr = MatSetValue(mat,1,1,1.0,INSERT_VALUES);CHKERRQ(ierr);
   ierr = MatAssemblyBegin(mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
   ierr = MatAssemblyEnd(mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);

   /* Free data structures */
   ierr = MatDestroy(mat);CHKERRQ(ierr);
   ierr = PetscFinalize();CHKERRQ(ierr);
   return 0;
}



below is my error message.





[0]PETSC ERROR: --------------------- Error Message ------------------------------------
[0]PETSC ERROR: Argument out of range!
[0]PETSC ERROR: Row too large: row 1 max -1!
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: Petsc Release Version 3.0.0, Patch 4, Fri Mar  6
14:46:08 CST 2009
[0]PETSC ERROR: See docs/changes/index.html for recent updates.
[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[0]PETSC ERROR: See docs/index.html for manual pages.
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: ./ex4 on a intel-10. named setebos.ices.utexas.edu by
fuentes Mon Mar 23 18:39:32 2009
[0]PETSC ERROR: Libraries linked from
/org/groups/oden/LIBRARIES/PETSC/petsc-3.0.0-p4/intel-10.1-mpich2-1.0.7-cxx-dbg/lib
[0]PETSC ERROR: Configure run at Fri Mar 20 20:39:04 2009
[0]PETSC ERROR: Configure options
--with-mpi-dir=/org/groups/oden/LIBRARIES/MPI/mpich2-1.0.7-intel-10.1
--with-clanguage=C++ --with-shared=1
--with-blas-lapack-dir=/opt/intel/mkl/10.0.3.020 --download-mumps=1
--download-parmetis=1 --download-scalapack=1 --download-blacs=1
--download-plapack=1 --download-superlu_dist=1
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: MatSetValues_SeqDense() line 672 in
src/mat/impls/dense/seq/dense.c
[0]PETSC ERROR: MatSetValues() line 921 in src/mat/interface/matrix.c
[0]PETSC ERROR: main() line 21 in src/ksp/pc/examples/tests/ex4.c
application called MPI_Abort(MPI_COMM_WORLD, 63) - process 0[unset]:
aborting job:
application called MPI_Abort(MPI_COMM_WORLD, 63) - process 0






df




On Mon, 23 Mar 2009, Lisandro Dalcin wrote:

> 1) Which system are you running on?
>
> 2) are you completely sure BOTH things happens, I mean... that malloc
> returns null AND the error code is zero?
>
>
> On Mon, Mar 23, 2009 at 7:49 PM, David Fuentes <fuentesdt at gmail.com> wrote:
>> In 3.0.0-p4
>>
>> PetscMalloc doesn't seem to return an error code if the requested memory
>> wasn't allocated ? Is this correct ?
>>
>> I'm trying to allocate a dense matrix for which there was not enough memory
>> and PetscMalloc is returning a null pointer but no errorcode to
>> catch. which is causing seg faults later.
>>
>>
>>
>> thanks,
>> df
>>
>>
>
>
>
> --
> Lisandro Dalcín
> ---------------
> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
> Tel/Fax: +54-(0)342-451.1594
>


More information about the petsc-users mailing list