[petsc-users] PetscCommGetNewTag issue

Jed Brown jed at jedbrown.org
Tue Jan 6 19:21:01 CST 2015


Fande Kong <fd.kong at siat.ac.cn> writes:

> Hi all,
>
> I make a very simple code, but run into some error messages.
>
> Code:
>
> #include <petsc.h>
> static char help[] = " simple test.\n\n";
>
> #undef __FUNCT__
> #define __FUNCT__ "main"
> int main(int argc,char **argv)
> {
>   PetscMPIInt                   tag = 0;
>   PetscErrorCode                ierr;
>
>   ierr = PetscInitialize(&argc,&argv,(char *)0,help);CHKERRQ(ierr);

The error message is not ideal, but the pattern used in PETSc is that
each object should PetscCommDuplicate(usercomm,&mycomm,&first_tag).  If
you need more tags, you would pass "mycomm" to PetscCommGetNewTag().

>   ierr = PetscCommGetNewTag(PETSC_COMM_WORLD,&tag);CHKERRQ(ierr);
>   ierr = PetscPrintf(PETSC_COMM_SELF," tag %d \n", tag);CHKERRQ(ierr);
>   ierr = PetscFinalize();CHKERRQ(ierr);
> }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150106/35afd108/attachment.pgp>


More information about the petsc-users mailing list