fprintf from kernel under emulation mode Is it possible on 2.3 beta?

I’m trying to track down the cause of an incorrect result in my execution. The method I’m attempting is probably not the best way to go about doing so but it’s how I would like to do it…

I want to run my code in emulation and output intermediate kernel results to a file. I figured this would be possible as emulation does not touch the device and all of the memory used is host memory.

I attempted to do the following inside of a kernel:

FILE *fp;

	fp = fopen(outFile, "w");

	fprintf(fp, "Testing...\n");

	fclose(fp);

Upon compilation I receive an error:

I know that the __cuda_emu namespace was introduced in 2.3 and that 2.2 is not an option due to the “exception handling is disabled” errors. I’ve been told by a classmate that FILE pointers worked from within a kernel in 2.1 or 2.0 but I would rather not revert back to those.

I have tried various casts and namespace tags on the FILE declarations and have not been able to get anything working.

I would appreciate any advice you guys could offer.

Thank you in advance!

Have you tried ocelot yet? Gregory Diamos posted their PTX emulation and error-checking program up in the General forum…perhaps you could use that to figure out your problem.

Thanks for the reply profquail, I’ve thought about the emulator (it sounds awesome BTW) but I’m more interested in finding exactly where things vary between my application and a CPU based one. There’s a lot of values that the output depends on so I would prefer to just dump everything to a file and compare them that way.

From the error message, it looks like this is just a namespace issue but I haven’t been able to figure out any way to fix it.

Anyone else have an idea?

Thanks again.

I just ran into this same issue… I’m trying to dump out a bunch of data in emulation mode only… file operations (fopen, fprintf, fclose) no longer work like they used to.
This is using the 2.3 final toolkit.

Worst case, I can dump to stdout, capture it, and parse it in Perl or something but that’s unpleasant.