CUDA Memcheck Initialization failed (not profiler error)

I’m facing an ambiguous internal memcheck error while calling cuda-memcheck on an application on the Jetson TX2 P3310. I’m using CUDA 10.0

It is not the common profiler error which requires COMPUTE_PROFILE or CUDA_PROFILE to be unset.

========= Internal Memcheck Error: Initialization failed
=========     Saved host backtrace up to driver entry point at error
=========     Host Frame:/usr/lib/aarch64-linux-gnu/tegra/ (cuDevicePrimaryCtxRetain + 0x154) [0x1fd7d4]

What could be the possible cause? This crops up in every tool (memcheck, racecheck, initcheck)

It turns out I can only run cuda-memcheck with sudo, is it possible to run without sudo?

You should not need to run with SUDO

Maybe this will help (from
On distributions that use the Yama LSM (that includes Ubuntu and Chrome OS), process A can attach to process B only if A is an ancestor of B.

You will probably want to disable this feature by using

echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope

To permanently allow it edit /etc/sysctl.d/10-ptrace.conf and change the line:

kernel.yama.ptrace_scope = 1
To read

kernel.yama.ptrace_scope = 0
For some background on why this change was made, see the Ubuntu wiki