Hi,

I know how to define groups and communicators in MPI.

1.   My question is how can I define matices on small communicators (not
MPI_COMM_WORLD)?
I tried something like this but does not work:

    for (int i=0; i<6; i++) {
          MatCreate(comm1,&general_detM[i]);
          MatSetSizes(general_detM[i],PETSC_DECIDE,PETSC_DECIDE,
General_Dofs, General_Dofs);
          MatSetFromOptions(general_detM[i]);
          MatMPIAIJSetPreallocation(general_detM[i],300,NULL,300,NULL);
          MatSeqAIJSetPreallocation(general_detM[i],600,NULL);
          MatSetOption(general_detM[i], MAT_NEW_NONZERO_ALLOCATION_ERR,
PETSC_FALSE);   //to extend the preallocatted memory for more values
    }

If I change MatCreate(comm1,&general_detM[i]) to
MatCreate(MPI_COMM_WORLD,&general_detM[i]),
the code works.


2. Also, there is one more question, how can I use MatSetValues to insert
values to a matrix not based on MPI_COMM_WORLD?

Can anyone help me on this? Thank you very much!


-- 
Fangbo Wang, PhD student
Stochastic Geomechanics Research Group
Department of Civil, Structural and Environmental Engineering
University at Buffalo
Email: *[email protected] <[email protected]>*

Reply via email to