Re: [petsc-dev] MPI_Attr_get test fails

2018-02-10 Thread Mark Adams
On Sat, Feb 10, 2018 at 12:54 PM, Jed Brown  wrote:

> Mark Adams  writes:
>
> > On Fri, Feb 9, 2018 at 9:39 PM, Jeff Hammond 
> wrote:
> >
> >> https://msdn.microsoft.com/en-us/library/dn473234(v=vs.85).aspx
> >>
> >> This function name is archaic and removed in MPI-3. Use the new name.
> >>
> >>
> > OK, Jed did this a few months ago.
> >
> > It still fails because my code uses PETSC_COMM_WORLD. I guess I need to
> > change that.
>
> This runs cleanly with MPICH and Open MPI.  Mark, PETSC_COMM_WORLD is
> _usually_ equivalent to MPI_COMM_WORLD.  You should *never* use it in
> PETSc library code.


Now you tell me! 23 years later.


> It is not a "PETSc communicator" or "inner
> communicator" -- those terms refer to a dup'd communicator held by PETSc
> objects for PETSc's exclusive use.
>
>


Re: [petsc-dev] MPI_Attr_get test fails

2018-02-10 Thread Jed Brown
Mark Adams  writes:

> On Fri, Feb 9, 2018 at 9:39 PM, Jeff Hammond  wrote:
>
>> https://msdn.microsoft.com/en-us/library/dn473234(v=vs.85).aspx
>>
>> This function name is archaic and removed in MPI-3. Use the new name.
>>
>>
> OK, Jed did this a few months ago.
>
> It still fails because my code uses PETSC_COMM_WORLD. I guess I need to
> change that.

This runs cleanly with MPICH and Open MPI.  Mark, PETSC_COMM_WORLD is
_usually_ equivalent to MPI_COMM_WORLD.  You should *never* use it in
PETSc library code.  It is not a "PETSc communicator" or "inner
communicator" -- those terms refer to a dup'd communicator held by PETSc
objects for PETSc's exclusive use.

#include 

int main(int argc, char **args)
{
  PetscErrorCode ierr;
  MPI_Comm   newcomm;
  ierr = PetscInitialize(&argc, &args, NULL, NULL);CHKERRQ(ierr);
  ierr = PetscCommDuplicate(PETSC_COMM_WORLD, &newcomm, NULL);CHKERRQ(ierr);
  { // debug
PetscCommCounter *counter;
PetscMPIInt  flg;
ierr = 
MPI_Comm_get_attr(newcomm,Petsc_Counter_keyval,&counter,&flg);CHKERRQ(ierr);
if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_CORRUPT,"Bad MPI 
communicator supplied?");
  }
  ierr = PetscCommDestroy(&newcomm);CHKERRQ(ierr);
  return PetscFinalize();
}


Re: [petsc-dev] MPI_Attr_get test fails

2018-02-10 Thread Mark Adams
On Fri, Feb 9, 2018 at 9:39 PM, Jeff Hammond  wrote:

> https://msdn.microsoft.com/en-us/library/dn473234(v=vs.85).aspx
>
> This function name is archaic and removed in MPI-3. Use the new name.
>
>
OK, Jed did this a few months ago.

It still fails because my code uses PETSC_COMM_WORLD. I guess I need to
change that.

Thanks,



> Jeff
>
> On Fri, Feb 9, 2018 at 3:11 PM Mark Adams  wrote:
>
>> I get an error in PetscCommGetNewTag. So I copied the test to may main
>> and I get the same problem. So this code fails:
>>
>> int main( int argc, char **args )
>> {
>>   PetscErrorCode   ierr;
>>   ierr = PetscInitialize( &argc, &args, "./.petscrc", NULL
>> );CHKERRQ(ierr);
>>   { // debug
>> PetscCommCounter *counter;
>> PetscMPIInt  flg;
>> ierr = MPI_Attr_get(PETSC_COMM_WORLD,Petsc_Counter_keyval,&counter,
>> &flg);CHKERRQ(ierr);
>> if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_CORRUPT,"Bad MPI
>> communicator supplied ???");
>>   }
>>
>> Any ideas?
>>
>> Mark
>>
> --
> Jeff Hammond
> jeff.scie...@gmail.com
> http://jeffhammond.github.io/
>


Re: [petsc-dev] MPI_Attr_get test fails

2018-02-09 Thread Mark Adams
On Fri, Feb 9, 2018 at 6:22 PM, Jed Brown  wrote:

> Mark Adams  writes:
>
> > I get an error in PetscCommGetNewTag. So I copied the test to may main
> and
> > I get the same problem. So this code fails:
> >
> > int main( int argc, char **args )
> > {
> >   PetscErrorCode   ierr;
> >   ierr = PetscInitialize( &argc, &args, "./.petscrc", NULL
> );CHKERRQ(ierr);
> >   { // debug
> > PetscCommCounter *counter;
> > PetscMPIInt  flg;
> > ierr =
> > MPI_Attr_get(PETSC_COMM_WORLD,Petsc_Counter_keyval,&counter,
> &flg);CHKERRQ(ierr);
> > if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_CORRUPT,"Bad MPI
> > communicator supplied ???");
> >   }
> >
> > Any ideas?
>
> Why do you think there would be a value on PETSC_COMM_WORLD (an outer
> comm)?  Use PetscCommDuplicate() to get an inner comm or use the
> communicator on a PETSc object.
>

Get the same thing with this. This is an ancient code and I had an ugly
hack where I duplicated MPI_COMM_WORLD and set PETSC_COMM_WORLD with that.
I'm going over this code and trying to de-uglify it ...

int main( int argc, char **args )
{
  PetscErrorCode ierr;
  MPI_Comm   newcomm;
  ierr = PetscInitialize(&argc, &args, "./.petscrc", NULL);CHKERRQ(ierr);
  ierr = PetscCommDuplicate(PETSC_COMM_WORLD, &newcomm, NULL);CHKERRQ(ierr);
  { // debug
PetscCommCounter *counter;
PetscMPIInt  flg;
ierr =
MPI_Attr_get(newcomm,Petsc_Counter_keyval,&counter,&flg);CHKERRQ(ierr);
if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_CORRUPT,"Bad MPI
communicator supplied ???");
  }


Re: [petsc-dev] MPI_Attr_get test fails

2018-02-09 Thread Mark Adams
On Fri, Feb 9, 2018 at 6:18 PM, Smith, Barry F.  wrote:

>
>   Bad MPI. Do you get this with --download-mpich
>

yes, and I nuked it and rebuilt ...


>
>
> > On Feb 9, 2018, at 5:11 PM, Mark Adams  wrote:
> >
> > I get an error in PetscCommGetNewTag. So I copied the test to may main
> and I get the same problem. So this code fails:
> >
> > int main( int argc, char **args )
> > {
> >   PetscErrorCode   ierr;
> >   ierr = PetscInitialize( &argc, &args, "./.petscrc", NULL
> );CHKERRQ(ierr);
> >   { // debug
> > PetscCommCounter *counter;
> > PetscMPIInt  flg;
> > ierr = MPI_Attr_get(PETSC_COMM_WORLD,Petsc_Counter_keyval,&counter,
> &flg);CHKERRQ(ierr);
> > if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_CORRUPT,"Bad MPI
> communicator supplied ???");
> >   }
> >
> > Any ideas?
> >
> > Mark
>
>


Re: [petsc-dev] MPI_Attr_get test fails

2018-02-09 Thread Jeff Hammond
https://msdn.microsoft.com/en-us/library/dn473234(v=vs.85).aspx

This function name is archaic and removed in MPI-3. Use the new name.

Jeff

On Fri, Feb 9, 2018 at 3:11 PM Mark Adams  wrote:

> I get an error in PetscCommGetNewTag. So I copied the test to may main and
> I get the same problem. So this code fails:
>
> int main( int argc, char **args )
> {
>   PetscErrorCode   ierr;
>   ierr = PetscInitialize( &argc, &args, "./.petscrc", NULL );CHKERRQ(ierr);
>   { // debug
> PetscCommCounter *counter;
> PetscMPIInt  flg;
> ierr =
> MPI_Attr_get(PETSC_COMM_WORLD,Petsc_Counter_keyval,&counter,&flg);CHKERRQ(ierr);
> if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_CORRUPT,"Bad MPI
> communicator supplied ???");
>   }
>
> Any ideas?
>
> Mark
>
-- 
Jeff Hammond
jeff.scie...@gmail.com
http://jeffhammond.github.io/


Re: [petsc-dev] MPI_Attr_get test fails

2018-02-09 Thread Jed Brown
Mark Adams  writes:

> I get an error in PetscCommGetNewTag. So I copied the test to may main and
> I get the same problem. So this code fails:
>
> int main( int argc, char **args )
> {
>   PetscErrorCode   ierr;
>   ierr = PetscInitialize( &argc, &args, "./.petscrc", NULL );CHKERRQ(ierr);
>   { // debug
> PetscCommCounter *counter;
> PetscMPIInt  flg;
> ierr =
> MPI_Attr_get(PETSC_COMM_WORLD,Petsc_Counter_keyval,&counter,&flg);CHKERRQ(ierr);
> if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_CORRUPT,"Bad MPI
> communicator supplied ???");
>   }
>
> Any ideas?

Why do you think there would be a value on PETSC_COMM_WORLD (an outer
comm)?  Use PetscCommDuplicate() to get an inner comm or use the
communicator on a PETSc object.


Re: [petsc-dev] MPI_Attr_get test fails

2018-02-09 Thread Smith, Barry F.

  Bad MPI. Do you get this with --download-mpich


> On Feb 9, 2018, at 5:11 PM, Mark Adams  wrote:
> 
> I get an error in PetscCommGetNewTag. So I copied the test to may main and I 
> get the same problem. So this code fails:
> 
> int main( int argc, char **args ) 
> {
>   PetscErrorCode   ierr;
>   ierr = PetscInitialize( &argc, &args, "./.petscrc", NULL );CHKERRQ(ierr);
>   { // debug
> PetscCommCounter *counter;
> PetscMPIInt  flg;
> ierr = 
> MPI_Attr_get(PETSC_COMM_WORLD,Petsc_Counter_keyval,&counter,&flg);CHKERRQ(ierr);
> if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_CORRUPT,"Bad MPI 
> communicator supplied ???");
>   }
> 
> Any ideas?
> 
> Mark