Problem using MatView

Cristiano Calonaci c.calonaci at cineca.it
Thu Dec 7 09:07:51 CST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

	I'm trying to plot using X a sparse matrix of order 100.000, with
about 7.000.000 not zero elements using

      ierr = PetscViewerDrawOpen(PETSC_COMM_WORLD, NULL, "matrix ATA",
PETSC_DECIDE, PETSC_DECIDE, PETSC_DECIDE, PETSC_DECIDE, &ataviewer);
CHKERRQ(ierr);
......
      ierr = MatView(ATA, ataviewer); CHKERRQ(ierr);

When I run with one processors all is ok (fast plot), when I run with more
processors, for examples 2, the time need to plot becomes infinite.

Using gdb I fount that processors zero is always memcpying,

#0  0x0000002a96a1b6c6 in memcpy () from /lib64/tls/libc.so.6
#1  0x00000000009cd6ff in PetscMemcpy (a=0x2a9c88f200, b=0x2a9c50b200,
n=1362576) at memc.c:102
#2  0x00000000005f29af in MatSetValues_MPIAIJ (mat=0xdec4c0, m=1,
im=0x7fbfffe5fc, n=121, in=0x2a9a420328, v=0x2a9758c450,
addv=INSERT_VALUES) at mpiaij.c:187
#3  0x000000000052fe23 in MatSetValues (mat=0xdec4c0, m=1,
idxm=0x7fbfffe5fc, n=121, idxn=0x2a9a420328, v=0x2a9758c450,
addv=INSERT_VALUES) at matrix.c:826
#4  0x00000000005fe647 in MatView_MPIAIJ_ASCIIorDraworSocket
(mat=0xdbaa50, viewer=0xd78c90) at mpiaij.c:957
#5  0x00000000005ff229 in MatView_MPIAIJ (mat=0xdbaa50, viewer=0xd78c90)
at mpiaij.c:1005
#6  0x000000000052cfa8 in MatView (mat=0xdbaa50, viewer=0xd78c90) at
matrix.c:549

here (frame #4) in the MatSetValues

    /* This is just a temporary matrix, so explicitly using MATMPIAIJ is
probably best */
    ierr = MatSetType(A,MATMPIAIJ);CHKERRQ(ierr);
    ierr =
MatMPIAIJSetPreallocation(A,0,PETSC_NULL,0,PETSC_NULL);CHKERRQ(ierr);
    ierr = PetscLogObjectParent(mat,A);CHKERRQ(ierr);

    /* copy over the A part */
    Aloc = (Mat_SeqAIJ*)aij->A->data;
    m = aij->A->rmap.n; ai = Aloc->i; aj = Aloc->j; a = Aloc->a;
    row = mat->rmap.rstart;
    for (i=0; i<ai[m]; i++) {aj[i] += mat->cmap.rstart ;}
    for (i=0; i<m; i++) {
      ierr =
MatSetValues(A,1,&row,ai[i+1]-ai[i],aj,a,INSERT_VALUES);CHKERRQ(ierr);
      row++; a += ai[i+1]-ai[i]; aj += ai[i+1]-ai[i];
    }

I think the problem is a lot of MatSetValues without preallocation
(ierr =
MatMPIAIJSetPreallocation(A,0,PETSC_NULL,0,PETSC_NULL);CHKERRQ(ierr);),
isn't it ? There is a solution ?

		Thaks a lot

				Cristiano
- --
______________________________________________________________________

"Un programma di computer fa quello che gli dici, non quello che vuoi"
                                                 Terza legge di Greer
______________________________________________________________________

Cristiano Calonaci - Supercomputing Group - CINECA
Via Magnanelli 6/3 - 40033 Casalecchio di Reno - Bologna - Italy
Tel.+39-0516171421 - Fax.+39-0516137273 - e-mail: c.calonaci at cineca.it
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFFeC5Hvt08LyoFZwMRAjD8AJ4kp8FPo0kdgbLLg1l6sfjf/AAihQCfewSs
06+THVFfozPmQi4Ro5um4zM=
=6A1q
-----END PGP SIGNATURE-----




More information about the petsc-users mailing list