R and cuda-memcheck

I’m building a simple R extension around a CUDA-enabled dynamic library, and I want to run the whole package with cuda-memcheck. I can run it with Valgrind:

$ R --no-save -d valgrind < test.R

However, if I try the same thing with cuda-memcheck,

$ R --no-save -d cuda-memcheck < test.R

I get:

*** Further command line arguments ('–no-save ') disregarded
*** (maybe use 'run --no-save ’ from inside cuda-memcheck)

========= CUDA-MEMCHECK
Fatal error: you must specify ‘–save’, ‘–no-save’ or ‘–vanilla’
========= No CUDA-MEMCHECK results found

So cuda-memcheck is eating up an argument that’s supposed to go to R. What can I do about this?

How about:

cuda-memcheck R --no-save < test.R