[petsc-dev] print statements in fortran interface functions

Satish Balay balay at mcs.anl.gov
Tue Mar 17 09:24:27 CDT 2020


This happens when the binary is not updated to use the new sources
[i.e not rebuilt - or rebuilt with old obj files].

gdb should print a warning of type:

warning: Source file is more recent than executable.

Satish

On Tue, 17 Mar 2020, Mark Adams wrote:

> The app is running wrong but ex73f90t is running fine.
> I fixed it by deleting both directories (arch and install). I saw the file
> getting recompiled with make all, and installed, but it seemed to not take
> somehow.
> And I could step through the code and see the print statements but its like
> it had the wrong object file but the right source info. Strange.
> Thanks,
> Mark
> 
> 
> 
> On Tue, Mar 17, 2020 at 9:53 AM Matthew Knepley <knepley at gmail.com> wrote:
> 
> > On different OSes, the buffering for printf is different. Do you mean that
> > the program ends correctly and prints nothing, or
> > do you mean that you execute a print but nothing immediately outputs to
> > the screen. We do not explicitly flush, so it could
> > be that this weird OS is buffering in a way you do not expect.
> >
> >   Matt
> >
> > On Mon, Mar 16, 2020 at 11:02 PM Mark Adams <mfadams at lbl.gov> wrote:
> >
> >> Thanks, I have verified that PetscPrint with an installed libs works as
> >> expected on my Mac (on ex73f90t).
> >> I'll keep looking on Cori.
> >> ThanksMark
> >>
> >> On Mon, Mar 16, 2020 at 10:37 PM Jacob Faibussowitsch <
> >> jacob.fai at gmail.com> wrote:
> >>
> >>> May be an issue printing to STDOUT, HPC sometimes redirect STDOUT to
> >>> some other log files. Maybe try redirecting your PetscInfo() or
> >>> PetscPrintf() output to a file. For PetscInfo its just a filename after the
> >>> info flag: ./yourCode -info somefile . As for the PetscPrintf you will have
> >>> to change those calls in your src to PetscFPrintf().
> >>>
> >>> Best regards,
> >>>
> >>> Jacob Faibussowitsch
> >>> (Jacob Fai - booss - oh - vitch)
> >>> Cell: (312) 694-3391
> >>>
> >>> On Mar 16, 2020, at 9:26 PM, Mark Adams <mfadams at lbl.gov> wrote:
> >>>
> >>>
> >>>
> >>> On Mon, Mar 16, 2020 at 9:50 PM Jacob Faibussowitsch <
> >>> jacob.fai at gmail.com> wrote:
> >>>
> >>>> Hello Mark,
> >>>>
> >>>> If you are using PetscInfo to print, PetscInfo requires that you pass
> >>>> “-info” as a command line flag in order to print anything. Sounds simple
> >>>> enough to miss, did you run your code with it? i.e. ./yourCode -info?
> >>>>
> >>>
> >>> Yea, I added -info.
> >>>
> >>>
> >>>>
> >>>> For what its worth, PetscPrintf on PETSC_COMM_WORLD will always print
> >>>> but only from proc 0. PetscSynchronizedPrintf prints from all in order.
> >>>> Might be more useful for debugging than PetscInfo!
> >>>>
> >>>
> >>> Yea, I started with PetscPrintf. Started with WORLD then tried SELF.
> >>> Still no output but I can step through the code and see the print
> >>> statements, but nothing.
> >>>
> >>> This is on Cori/Haswell. I have now used printf on my Mac and it works.
> >>> I did not do an install on my Mac, but I would not think that would
> >>> matter... I should test that I suppose.
> >>>
> >>>
> >>>>
> >>>> Best regards,
> >>>>
> >>>> Jacob Faibussowitsch
> >>>> (Jacob Fai - booss - oh - vitch)
> >>>> Cell: (312) 694-3391
> >>>>
> >>>> On Mar 16, 2020, at 7:54 PM, Mark Adams <mfadams at lbl.gov> wrote:
> >>>>
> >>>> I am trying to debug an application code that works with v3.7 but fails
> >>>> with master. The code works for "normal" solvers but for a solver that uses
> >>>> FieldSplit it fails. It looks like vectors are not getting created from
> >>>> MatCreateVecs with a matrix that is a MatNest (I can't run the code).
> >>>>
> >>>> I have put print statements in the interface files to try to see what
> >>>> is going on but the print statements seem to disappear somehow. (I added
> >>>> the same print statements in my installation of v3.7 to see what is
> >>>> different) I was using PetscPrint and then found and example of a Fortran
> >>>> PetscInfo and switched to that. I stepped through the code with DDT and see
> >>>> the print statements but nothing goes to the output. I did this DDT stuff
> >>>> with ex73f90t, which has a MatCreateNest.
> >>>>
> >>>> I am completely baffled. Does anyone have any ideas?
> >>>>
> >>>> Thanks,
> >>>> 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
> >
> > https://www.cse.buffalo.edu/~knepley/
> > <http://www.cse.buffalo.edu/~knepley/>
> >
> 


More information about the petsc-dev mailing list