<div class="gmail_quote">On Sun, Mar 6, 2011 at 07:39, Alexander Grayver <span dir="ltr">&lt;<a href="mailto:agrayver@gfz-potsdam.de">agrayver@gfz-potsdam.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello,<br>
<br>
I&#39;m newbie in PETSc.<br>
<br>
I use PETSc from FORTRAN under Windows, my build configuration is:<br>
Configure options: --with-cc=&quot;win32fe cl&quot; --with-fc=&quot;win32fe ifort&quot; --with-cxx=&quot;win32fe cl&quot; --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=&quot;[/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpi.lib,/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpifec.lib]&quot; --with-shared=0 --with-debugging=0 --with-fortran-kernels=1 --useThreads=0<br>

<br>
I wrote this code:<br>
<br>
                  call MatCreateSeqAIJ(PETSC_COMM_SELF, n, m, 2, PETSC_NULL, Gmat, ierr)<br>
                  CHKERRQ(ierr)<br>
<br>
                  call cpu_time(timetest(1))<br>
<br>
                  do irow=1,UBOUND(G, dim=1)<br>
                    call MatSetValue(Gmat, ir(i)-1, ic(i)-1, G(irow),e INSERT_VALUES, ierr)<br>
                  enddo<br>
<br>
                  call cpu_time(timetest(2))<br>
                  write(*,*) &#39;Time of setting matrix G was &#39;, timetest(2) - timetest(1), &#39; seconds&#39;<br>
<br>
                  call MatAssemblyBegin(Gmat,MAT_FINAL_ASSEMBLY,ierr)<br>
                  call MatAssemblyEnd(Gmat,MAT_FINAL_ASSEMBLY,ierr)<br></blockquote><div><br></div><div>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.</div>
<div><br></div><div>If you are familiar with debuggers, you could call</div><div><br></div><div>MatSetOption(Gmat,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE,ierr)</div><div><br></div><div>and then run with -start_in_debugger to find the first insertion that was not preallocated.</div>
<div><br></div></div>