[petsc-users] loosing preallocation information
Alexander Grayver
agrayver at gfz-potsdam.de
Mon Mar 7 07:50:36 CST 2011
Hi Jed,
It's getting even stranger.
When I run this code under linux I've got error:
[0]PETSC ERROR: --------------------- Error Message
------------------------------------
[0]PETSC ERROR: Argument out of range!
[0]PETSC ERROR: nnz cannot be greater than row length: local row 98
value 1455203639 rowlength 343!
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: Petsc Release Version 3.1.0, Patch 7, Mon Dec 20
14:26:37 CST 2010
[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: /home/mt/agrayver/mt-soft/multiem/INV3D/_tiger/em_model
on a openmpi-i named glic by agrayver Mon Mar 7 14:49:43 2011
[0]PETSC ERROR: Libraries linked from
/panfs/panfs.gfz-hpcc.cluster/home/mt/agrayver/lib/petsc-3.1-p7/openmpi-intel-complex-debug/lib
[0]PETSC ERROR: Configure run at Fri Mar 4 12:43:58 2011
[0]PETSC ERROR: Configure options
--with-petsc-arch=openmpi-intel-complex-debug
--with-mpi-dir=/opt/mpi/intel/openmpi-1.4.2 --with-scalar-type=complex
--with-blas-lapack-dir=/opt/intel/Compiler/11.1/072/mkl/lib/em64t
--with-precision=double --with-x=0
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: MatSeqAIJSetPreallocation_SeqAIJ() line 3003 in
src/mat/impls/aij/seq/aij.c
[0]PETSC ERROR: MatCreateSeqAIJ() line 2906 in src/mat/impls/aij/seq/aij.c
Then I traced it under debugger both on Windows and Linux and realized
that it doesn't crash under Windows only by luck.
The call stack if the folowing:
[C] MatSeqAIJSetPreallocation_SeqAIJ, FP=7fffb4513880
[C] MatCreateSeqAIJ, FP=7fffb4513900
[C] matcreateseqaij_, FP=7fffb4513960
[F90] MODELING_MOD`modeling, FP=7fffb4517740
As far as I understand after debugging the problem is that nnz in
MatSeqAIJSetPreallocation isn't 0 and I go through this code:
if (nnz) {
for (i=0; i<B->rmap->n; i++) {
if (nnz[i] < 0) SETERRQ2(PETSC_ERR_ARG_OUTOFRANGE,"nnz cannot be
less than 0: local row %d value %d",i,nnz[i]);
if (nnz[i] > B->cmap->n) SETERRQ3(PETSC_ERR_ARG_OUTOFRANGE,"nnz
cannot be greater than row length: local row %d value %d rowlength
%d",i,nnz[i],B->cmap->n);
}
}
But why is nnz nonzero? I passed PETSC_NULL. It seems like macros
CHKFORTRANNULLINTEGER in matcreateseqaij_ should set it to zero, but it
doesn't.
Thanks.
On 06.03.2011 16:49, Jed Brown wrote:
> On Sun, Mar 6, 2011 at 07:39, Alexander Grayver
> <agrayver at gfz-potsdam.de <mailto:agrayver at gfz-potsdam.de>> wrote:
>
> Hello,
>
> I'm newbie in PETSc.
>
> I use PETSc from FORTRAN under Windows, my build configuration is:
> Configure options: --with-cc="win32fe cl" --with-fc="win32fe
> ifort" --with-cxx="win32fe cl" --with-windows-graphics=0
> --download-f-blas-lapack=1 --with-precision=double
> --with-scalar-type=complex --with-clanguage=cxx
> --with-mpi-include=/cygdrive/d/Dev/HPC_2008_SDK/Include
> --with-mpi-lib="[/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpi.lib,/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpifec.lib]"
> --with-shared=0 --with-debugging=0 --with-fortran-kernels=1
> --useThreads=0
>
> I wrote this code:
>
> call MatCreateSeqAIJ(PETSC_COMM_SELF, n, m, 2,
> PETSC_NULL, Gmat, ierr)
> CHKERRQ(ierr)
>
> call cpu_time(timetest(1))
>
> do irow=1,UBOUND(G, dim=1)
> call MatSetValue(Gmat, ir(i)-1, ic(i)-1,
> G(irow),e INSERT_VALUES, ierr)
> enddo
>
> call cpu_time(timetest(2))
> write(*,*) 'Time of setting matrix G was ',
> timetest(2) - timetest(1), ' seconds'
>
> call MatAssemblyBegin(Gmat,MAT_FINAL_ASSEMBLY,ierr)
> call MatAssemblyEnd(Gmat,MAT_FINAL_ASSEMBLY,ierr)
>
>
> Are you sure this is how your code looks, in particular that there is
> no MatAssembly before setting the values. Could you send the whole file.
>
> If you are familiar with debuggers, you could call
>
> MatSetOption(Gmat,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE,ierr)
>
> and then run with -start_in_debugger to find the first insertion that
> was not preallocated.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110307/e4a7d1e0/attachment-0001.htm>
More information about the petsc-users
mailing list