User visible communicators generally do not have a keyval attached. Rather the 
keyval is attached to the inner communicator; because we don't want both PETSc 
and the user doing MPI operations on the same communicator (to prevent mixing 
up tags).

  I think PetscShmCommGet() is wrong. I think it should not call 
MPI_Comm_get_attr(globcomm,Petsc_Counter_keyval,&counter,&flg); but should call 
PetscCommDuplicate() and use that communicator to stash the pshmcomm; then you 
would not have the problem you are having.


Barry

  

> On Aug 12, 2021, at 11:05 AM, Pierre Jolivet <pie...@joliv.et> wrote:
> 
> Hello,
> Is there a specific reason why PETSC_COMM_WORLD is not a PETSc communicator, 
> i.e., has no Petsc_Counter_keyval attached?
> ierr = PetscOmpCtrlCreate(PETSC_COMM_WORLD,nthreads,&ctrl);CHKERRQ(ierr);
> yields
> [0]PETSC ERROR: Bad MPI communicator supplied must be a PETSc communicator
> [0]PETSC ERROR: #1 PetscShmCommGet() at src/sys/utils/mpishm.c:60
> [0]PETSC ERROR: #2 PetscOmpCtrlCreate() at src/sys/utils/mpishm.c:340
> 
> Thanks,
> Pierre

Reply via email to