cuda-memcheck as MEMORYCHECK_COMMAND

I tried setting MEMORYCHECK_COMMAND to /usr/local/bin/cuda-memcheck, but “ctest -T memcheck” yielded this message:

Do not understand memory checker: /usr/local/cuda/bin/cuda-memcheck

Looking at the code, there are indeed a limited number of possible memory checkers. Is there a way to finesse ctest to run cuda-memcheck? (besides renaming cuda-memcheck to valgrind :slight_smile:

If not, it is difficult to add another memory checker?

Thanks,
Allen

I think if you also set MEMORYCHECK_TYPE to Valgrind (case-sensitive), that will force it to be treated as valgrind (I believe the code here is where that decision is made).

Thanks for the tip, Craig. Alas, I see that the argument “–log-file=/path/to/log.file” is unconditionally appended to the “valgrind” command. cuda-memcheck wants “–log-file /path/to/log.file”.
In fact, all of the memory check tools have a mandatory “log-file=/path” style argument! That looks easy enough to patch in my build, though.
Thanks!

You could write a script which replaces --log-file=XXX with --log-file XXX and then forward on the command to the real cuda-memcheck command you want to use. Set MEMORYCHECK_COMMAND to your script and that should work without having to patch CMake.

That’s worked out well. Thank you!

Though maybe we should look at adding cuda-memcheck as another checker type to avoid this. @robert.maynard