Hello, <br>           How should i fix the issue mentioned below ?<br><br>Sent from my HTC smartphone on the Now Network from Sprint!<br><br>----- Reply message -----<br>From: "Dharmendar Reddy" <dharmareddy84@gmail.com><br>To: "Jed Brown" <jed@jedbrown.org><br>Cc: "Barry Smith" <bsmith@mcs.anl.gov>, "PETSc users list" <petsc-users@mcs.anl.gov><br>Subject: [petsc-users] DMLocalToGlobal PETScSF is BROKEN<br>Date: Wed, Jan 22, 2014 5:26 pm<br><br><br>Hello,<br>       I have attached the test case which demonstrates the problem.<br><br>The following is the issue:<br>globalX1=1.0<br>globalX2=2.0<br><br>localX1=-1.0<br>localX2=-2.0<br><br><br>Begin: localX1 to globalX1<br>Begin: localX2 to globalX2<br><br>End:   localX1 to globalX1<br>End:   localX2 to globalX2<br><br><br>i get globalX1 = -2 and globalX2 = -1.0 instead of globalX1 = -1 and<br>globalX2 = -2.0<br><br><br>When my code crashed, i was doing this to set the ub and lb vectors<br>for SNES and (now) obviously the code did not progress as the ub and<br>lb were swaped. Should the snes warn for such case where lb < ub is<br>not valid, by user error or otherwise as in this case.<br><br>On Wed, Jan 22, 2014 at 4:39 PM, Jed Brown <jed@jedbrown.org> wrote:<br>> Barry Smith <bsmith@mcs.anl.gov> writes:<br>>>     Ok, well the damn code is so convoluted it is hard to see that it<br>>>     is even trying to do things right for multiple independent calls.<br>><br>> How would you change this to make it less convoluted?<br>><br>> static PetscErrorCode PetscSFReduceEnd_Basic(PetscSF sf,MPI_Datatype unit,const void *leafdata,void *rootdata,MPI_Op op)<br>> {<br>>   void             (*UnpackOp)(PetscInt,const PetscInt*,void*,const void*);<br>>   PetscErrorCode   ierr;<br>>   PetscSFBasicPack link;<br>>   PetscInt         i,nrootranks;<br>>   const PetscInt   *rootoffset,*rootloc;<br>><br>>   PetscFunctionBegin;<br>>   ierr = PetscSFBasicGetPackInUse(sf,unit,rootdata,PETSC_OWN_POINTER,&link);CHKERRQ(ierr);<br>>   /* This implementation could be changed to unpack as receives arrive, at the cost of non-determinism */<br>>   ierr = PetscSFBasicPackWaitall(sf,link);CHKERRQ(ierr);<br>>   ierr = PetscSFBasicGetRootInfo(sf,&nrootranks,NULL,&rootoffset,&rootloc);CHKERRQ(ierr);<br>>   ierr = PetscSFBasicPackGetUnpackOp(sf,link,op,&UnpackOp);CHKERRQ(ierr);<br>>   for (i=0; i<nrootranks; i++) {<br>>     PetscMPIInt n          = rootoffset[i+1] - rootoffset[i];<br>>     const void  *packstart = link->root+rootoffset[i]*link->unitbytes;<br>><br>>     (*UnpackOp)(n,rootloc+rootoffset[i],rootdata,packstart);<br>>   }<br>>   ierr = PetscSFBasicReclaimPack(sf,&link);CHKERRQ(ierr);<br>>   PetscFunctionReturn(0);<br>> }<br>><br>><br>>>     You’ll have to pry out of Dhamendar his test case that fails.<br>><br>> That would be useful.<br><br><br><br>-- <br>-----------------------------------------------------<br>Dharmendar Reddy Palle<br>Graduate Student<br>Microelectronics Research center,<br>University of Texas at Austin,<br>10100 Burnet Road, Bldg. 160<br>MER 2.608F, TX 78758-4445<br>e-mail: dharmareddy84@gmail.com<br>Phone: +1-512-350-9082<br>United States of America.<br>Homepage: https://webspace.utexas.edu/~dpr342<br>