enable/disable cuda memcheck and/or racecheck at run time?

Is it possible to run a kernel with CUDA memcheck enabled by my program and then disable it
and run the kernel again inside the same program? The CUDA memcheck manual says it is
possible to do this via the debugger but I would like to do this non-interactively.

The idea is to run a new version of the kernel with error detection turned on.
Then, if all is well, run it again without memcheck. The second time it should run
much faster and I can gather realistic performance stats. I guess if this works,
I could also use CUDA racecheck but memcheck is the immediate concern.

Give the kernel only takes a few milliseconds the overhead of starting the whole
program a second time is considerable. If this works, I would like to run (sequentially)
many kernels from within the same (host) program.

Any comments, ideas, suggestions are welcome.
Thank you
Bill

Hi Bill, As of CUDA 5.5, it is not possible to enable or disable memcheck at runtime. Even in the case of running in integrated mode with cuda-gdb, cuda-memcheck must be enabled before the application is run, and cannot be disabled in the middle of the run. Could you elaborate on the use case you are trying to cover ? Is the application a daemon process that has a long lived thread ? In some applications it is possible to have a minimal unit harness wrapping a single kernel that can be used for functional verification. Is this a possibility in your application ? You could try moving the kernel into a small CUDA application and run cuda-memcheck if the startup overhead is the primary concern.

Dear vyas,
Thanks for the confirmation.
I am trying to optimise my kernel, unfortunately some of things tried actually make things
worse, so I am using memcheck to find these (and prevent them crasshing the host/GPU). Only
if memcheck reports no errors do I run the kernel again and get real timing information.
BTW timing information with memcheck is not well correlated with normal kernel operation.
Ie although everything is slower with memcheck, as expected, sometimes version A is faster
than version B when both are run with memcheck but version B is faster than A when both
are run without memcheck. I was hoping, in one program, to run several tests with memcheck
and then run only those with out errors again without memcheck. (I dont think of this as
a demon). I guess I will try and use scripts to do this and try and remove/reduce startup
activities.
Thanks again
Bill
http://www.cs.ucl.ac.uk/staff/W.Langdon/