Hi Freddie, Thank you for you answer, it does work.
I also had a look at the link you shared, which was an interesting reading. Don't worry, I don't plan on printing everything all the time. Thank you once more for your time. Best, Kevin Le 1 juil. 2014 à 17:29, Freddie Witherden <[email protected]> a écrit : > Hi Kevin, > > On 01/07/14 16:49, Castel, Kevin wrote: >> I'm currently working with Peter and Antony on implementing enthalpy >> damping into PyFR to reduce the start up period. >> >> Could anyone tell me how to print the content of a PyFR variable in >> the console or in an output file for debugging? > > It depends what you mean by a "PyFR variable". If this is simply a > Python variable then you can use a regular Python print statement to > output it to the console. Alternatively, if you are only running with a > single MPI rank you can drop into IPython: > > import IPython; IPython.embed() > > which is often easier and more convenient as you can "look around" and > see exactly what is going on. > > Otherwise, if it is a variable in a kernel things are a little bit more > difficult. When it comes to debugging "kernels" (and I use the term > loosely!) I am inclined to agree with Linus Torvalds on the issue [1]. > All of the kernels in PyFR were written without the use of either a > debugger or print statements. If you're being careful you shouldn't > need either. > > However, although officially not supported, you can on occasion utilise > printf(...) inside of the CUDA and C/OpenMP backends. I must warn you > that this is not officially supported and is known to break under a wide > range of circumstances. Caveat emptor... > > If outside of the kernel/macro definition you put: > > #include <stdio.h> > > you should be able to---inside of your kernel/macro---do > > printf("%f\n", myvar); > > of course the order in which these printf statements come out to the > console is effectively random. > > Regards, Freddie. > > [1] http://linuxmafia.com/faq/Kernel/linus-im-a-bastard-speech.html > > -- You received this message because you are subscribed to the Google Groups "PyFR Mailing List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send an email to [email protected]. Visit this group at http://groups.google.com/group/pyfrmailinglist. For more options, visit https://groups.google.com/d/optout.
