[petsc-dev] PETSC_COMM_SELF == 0

Mark Adams mfadams at lbl.gov
Tue Mar 31 15:30:17 CDT 2015


On Tue, Mar 31, 2015 at 4:13 PM, Matthew Knepley <knepley at gmail.com> wrote:

> On Tue, Mar 31, 2015 at 3:05 PM, Mark Adams <mfadams at lbl.gov> wrote:
>
>> Humm, that is what I see (appended).  I put a print in PETSC and see this
>> but I still have PETSC_COMM_SELF==0 in my fortran code.
>>
>
> Is it possible that you do not have the right #include? Can you put
> exactly the same includes as ex61f
>

Yea, I tried that. and changed it to .h90

BTW, I spent most of Friday finding that if I did not include the .h90 file
ISGetIndicesF90 would segv at the call site.




>
>   Matt
>
>
>> Strange, the compile lines look close enough and the example ex61f sees a
>> good PETSC_COMM_SELF ...
>>
>> Mark
>>
>> (gdb) where
>> #0  PetscInitializeFortran () at
>> /Users/markadams/Codes/petsc/src/sys/objects/ftn-custom/zstartf.c:48
>> #1  0x000000010027d985 in petscinitialize_ (filename=0x101eaab40 "",
>> ierr=0x7fff5fbff18c, len=80) at
>> /Users/markadams/Codes/petsc/src/sys/objects/ftn-custom/zstart.c:398
>> #2  0x00000001000015b2 in tpetsc () at ex61f.F90:111
>> #3  0x0000000100002a3d in main (argc=1, argv=0x7fff5fbff968
>> "/Users/markadams/Codes/petsc/src/ksp/ksp/examples/tutorials/ex61f") at
>> ex61f.F90:60
>> Current language:  auto; currently minimal
>> (gdb) n
>> 50        if (PETSC_COMM_WORLD) c1 =  MPI_Comm_c2f(PETSC_COMM_WORLD);
>> (gdb) p c1
>> $1 = 0
>> (gdb) n
>> 51        c2 =  MPI_Comm_c2f(PETSC_COMM_SELF);
>> (gdb) p c1
>> $2 = 1140850688
>> (gdb)
>>
>> On Tue, Mar 31, 2015 at 1:32 PM, Satish Balay <balay at mcs.anl.gov> wrote:
>>
>>> 1. Check if this is reproduceable with a petsc example for your build.
>>>
>>> 2. if you run in the debugger - and place a breakpoint in
>>> PetscInitializeFortran() - you should see the following trace.
>>>
>>> (gdb) where
>>> #0  PetscInitializeFortran () at
>>> /home/balay/petsc/src/sys/objects/ftn-custom/zstartf.c:48
>>> #1  0x00007ffff66c396d in petscinitialize_ (filename=0x603640
>>> <petscfortran1_> "",
>>>     ierr=0x7fffffffe0bc, len=80) at
>>> /home/balay/petsc/src/sys/objects/ftn-custom/zstart.c:398
>>> #2  0x0000000000401a42 in MAIN__ () at ex2f.F:102
>>> (gdb) n
>>> 50      if (PETSC_COMM_WORLD) c1 =  MPI_Comm_c2f(PETSC_COMM_WORLD);
>>> (gdb) p c1
>>> $1 = 0
>>> (gdb) n
>>> 51      c2 =  MPI_Comm_c2f(PETSC_COMM_SELF);
>>> (gdb) p c1
>>> $2 = 1140850688
>>>
>>>
>>> Satish
>>>
>>> On Tue, 31 Mar 2015, Mark Adams wrote:
>>>
>>> > I'm not sure where we are.  My code works on Edison but fails on OSX.
>>> > Should I call PetscInitializeFortran?  I do not have a C main.
>>> >
>>> >
>>> > On Tue, Mar 31, 2015 at 12:14 PM, Barry Smith <bsmith at mcs.anl.gov>
>>> wrote:
>>> >
>>> > >
>>> > > PetscErrorCode PetscInitializeFortran(void)
>>> > > {
>>> > >   MPI_Fint c1=0,c2=0;
>>> > >
>>> > >   if (PETSC_COMM_WORLD) c1 =  MPI_Comm_c2f(PETSC_COMM_WORLD);
>>> > >   c2 =  MPI_Comm_c2f(PETSC_COMM_SELF);
>>> > >   petscsetcommonblock_(&c1,&c2);
>>> > >
>>> > > Note that this routine is called automatically by the Fortran
>>> > > petscinitialize function.
>>> > >
>>> > >   Barry
>>> > >
>>> > > > On Mar 31, 2015, at 10:19 AM, Matthew Knepley <knepley at gmail.com>
>>> wrote:
>>> > > >
>>> > > > On Tue, Mar 31, 2015 at 10:13 AM, Mark Adams <mfadams at lbl.gov>
>>> wrote:
>>> > > > No, I don't have a C main program (like the doc says).
>>> > > >
>>> > > > I can see COMM_WORLD set in the Fortran initialize wrapper, but
>>> where is
>>> > > COMM_SELF set?
>>> > > >
>>> > > >    MAtt
>>> > > >
>>> > > > On Tue, Mar 31, 2015 at 11:05 AM, Matthew Knepley <
>>> knepley at gmail.com>
>>> > > wrote:
>>> > > > On Tue, Mar 31, 2015 at 5:44 AM, Mark Adams <mfadams at lbl.gov>
>>> wrote:
>>> > > > I'm finding that my fortran code on OSX has PETSC_COMM_SELF == 0.
>>> > > >
>>> > > > I can not find where PETSC_COMM_SELF is created.
>>> > > >
>>> > > > Its set in PetscInitializeFortran(). Did you call that?
>>> > > >
>>> > > >   Matt
>>> > > >
>>> > > >
>>> > > > Mark
>>> > > >
>>> > > >
>>> > > >
>>> > > > --
>>> > > > What most experimenters take for granted before they begin their
>>> > > experiments is infinitely more interesting than any results to which
>>> their
>>> > > experiments lead.
>>> > > > -- Norbert Wiener
>>> > > >
>>> > > >
>>> > > >
>>> > > >
>>> > > > --
>>> > > > What most experimenters take for granted before they begin their
>>> > > experiments is infinitely more interesting than any results to which
>>> their
>>> > > experiments lead.
>>> > > > -- Norbert Wiener
>>> > >
>>> > >
>>> >
>>>
>>>
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20150331/778cd83f/attachment.html>


More information about the petsc-dev mailing list