1. petsc
  2. PETSc
  3. petsc


Jed Brown  committed ec4fadc

sys comm: remove redundant self-call to MPI_Attr_get in DelComm_Outer

MS-MPI (2008 and 2012) invalidates the communicator before calling the
attribute destructor. This is considered a bug as evidenced by test
attrdeleteget added to MPICH in:

commit c532aacc14f77a04ffca0c212731700a5d3d9a01
Author: Jed Brown <jedbrown@mcs.anl.gov>
Date: Sat May 18 12:55:38 2013 -0500

test: add attrdeleteget, MPI_Attr_get called from delete_fn

With MS-MPI 64-bit from HPC Pack 2008 and 2012, MPI_Attr_get returns
error code 773 when called from delete_fn on a communicator obtained
from MPI_Comm_split.

The standard is not explicit that the 'comm' argument of delete_fn must
be valid, so this test is only in effect when !USE_STRICT_MPI.

Signed-off-by: Jed Brown <jedbrown@mcs.anl.gov>
Signed-off-by: Satish Balay <balay@mcs.anl.gov>

However, in PETSc, the attribute value is already passed as an argument,
so we need not call MPI_Attr_get to obtain it.

Note that although we still call MPI_Attr_delete and MPI_Attr_get on the
inner comm, that communicator has not been invalidated yet.

  • Participants
  • Parent commits da3039f
  • Branches master

Comments (0)

Files changed (1)

File src/sys/objects/pinit.c

View file
   if (keyval != Petsc_InnerComm_keyval) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_CORRUPT,"Unexpected keyval");
-  ierr = MPI_Attr_get(comm,Petsc_InnerComm_keyval,&icomm,&flg);CHKERRQ(ierr);
-  if (icomm.comm != *(MPI_Comm*)&attr_val) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_CORRUPT,"Unexpected attribute");
+  icomm.ptr = attr_val;
   ierr = MPI_Attr_get(icomm.comm,Petsc_OuterComm_keyval,&ocomm,&flg);CHKERRQ(ierr);
   if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_CORRUPT,"Inner MPI_Comm does not have expected reference to outer comm");