Cuda 11.8 sample "nbody" fail to run with `cudaGraphicsGLRegisterBuffer`, how to fix?

sample url: cuda-samples/Samples/5_Domain_Specific/nbody at master · NVIDIA/cuda-samples (github.com)

env : cuda11.8 , ubuntu20.4 , rtx3090 , run with ssh and x11 forward.

the programe report : CUDA error at bodysystemcuda_impl.h:191 code=999(cudaErrorUnknown) “cudaGraphicsGLRegisterBuffer(&m_pGRes[i], m_pbo[i], cudaGraphicsMapFlagsNone)”

Actually when I try to use cudaGraphicsGLRegisterBuffer to code , it report same error.

And, run nbody with -hostmem can run well .
image

x11 forwarding by itself won’t work
you need a remotable OpenGL implementation

this covers some of the setup steps that are necessary.

That article is a bit dated, but covers the generally necessary pieces. I won’t be able to give you a current recipe, and if you’re unfamiliar with these concepts, then I would encourage you to use a remoting solution that takes care of this for you, or else switch from remote to local work, rather than trying to roll-your-own.

(post deleted by author)

Recently I have try to install virutalgl .But it seems that nothing change. nbody report same error.

Do other GL programs work?