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
signature.asc
Description: OpenPGP digital signature
