CUDA allows printf() function inside kernel in emulation mode. But it doesn't seem to be the case for Brook. I think debugging is very hard without this.
I am wondering how you debug Brook other than printing before and after streamRead() and streamWrite().
I create a debug version of my kernel which takes additional output streams ("debug streams") to which I can write state information. It ain't printf(), but it has worked for me so far.
You can simply use printf (or cout) in the generated cpp file. It will be overwritten the next time you run brcc, but that's not a big problem if you want the output only for debugging purposes. It would be nice though if one could somehow pass c++ commands directly into the cpp file, bypassing brcc.
Originally posted by: josopait You can simply use printf (or cout) in the generated cpp file. Ingo
Could You tell me how to do that? I compile brook file then add
std::cout << si.swizzle1(maskX) << " " << si.swizzle1(maskY) << " " << si.swizzle1(maskZ) <<'\n' ;
in void __SAD3D_cpu_inner function.
I put break point on cout line and it seems that this function isn't run because program doesn't stop on it.
1) Compilation br file.
2) Adding line in generated cpp
3) Compilation cpp
4) Linking project
I use Brook 1.01 Driver 8.8 WinXp 32bit.
I realize that other sample programs doesn't debug either so it may be not problem of my code insertion at all.
I found that there is an enviroment variable need to be set BRT_RUNTIME = cpu , but I don't know where to do it so?
I use VS 2005 - Where can I set the variable?
I also found it
It has to be set in Windows enviroment variables