Cancel scheduled kernel launches and other queued operations

This has been asked several times, but I did not find any answers from NVIDIA.

We are writing an image processing application and use CUDA to accelerate computations. The algorithm involves copying data to GPU, calling a sequence of kernels (about 50 of them), and copying data back to host memory. Sometimes users change their mind and decide to adjust algorithm parameters before the result calculation is finished. In such situations the calculation in progress needs to be terminated and a new one (with new parameters) needs to be started.

As far as I understand, it is currently not possible to ask CUDA to terminate all queued launches, and the only way to achieve the goal is to use some sort of a flag in global/constant memory that each kernel will be checking at the beginning. Such check is 1) difficult to implement (all kernels need to be modified) and 2) may cause performance degradation. I also heard that destroying the context solves the problem as well, but this has quite a high overhead (and may cause other issues).

Is there anything on CUDA road map that will allow cancelling scheduled jobs (kernel launches, copy operations and others)?

I would suggest filing a feature request. Feature requests can be filed via the bug reporting form linked from the registered devveloper websit. Please prefix the synopsis with “RFE:” to mark this as a “request for enhancement” rather than a bug report. It will be helpful to provide as many specifics as to desired API call(s) and semantics as possible.