cuda cuGLBuffer error

This is a new win10 system,and as you can see ,Quadro P4000.My cuda is 10.1. When I compile all samples about GL and buffer,it will show me that error:

simpleGL (VBO) starting…

GPU Device 0: “Quadro P4000” with compute capability 6.1

CUDA error at C:/ProgramData/NVIDIA Corporation/CUDA Samples/v10.1/2_Graphics/simpleGL/simpleGL.cu:422 code=304(cudaErrorOperatingSystem) “cudaGraphicsGLRegisterBuffer(vbo_res, *vbo, vbo_res_flags)”

this is deviceQuery result.
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 10.1, CUDA Runtime Version = 10.1, NumDevs = 1
Result = PASS

I found that a similar problem was the context of multithreaded gl, but I ran official samples the code has no errors, and all glbuffers samples had the same problem. This error cause I can’t use optix. The other similar problem solutions are the GL drivers problem. How to detect this on p4000 windows? The CUDA installer installed all the drivers I chose to install. I did not fix this bug by reinstalling the CUDA and resetting the windows system.

I plugged the monitor’s graphics card into the integrated card , although it can detect my P4000, but I guess it is set by default integrated card.So…

I have never tried using these GL samples so I don’t know about their requirements.
So, starting from the beginning, are you able to compile other CUDA samples and/or your own programs?
Do they run?

Did you make sure your VS version matches the requirements in the Windows installation guide?
What is the exact VS and driver version you currently have installed?

Changing monitor’s graphics card works for me. Thanks for your suggestion!

Error messages like following will disappear after changing:

CUDA error at C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.1\5_Simulations\nbody\bodysystemcuda_impl.h:186 code=304(cudaErrorOperatingSystem) "cudaGraphicsGLRegisterBuffer(&m_pGRes[i], m_pbo[i], cudaGraphicsMapFlagsNone)"

,

Flex: Cuda error: 63 in cudaGraphicsGLRegisterBuffer(&res, glbuf, cudaGraphicsRegisterFlagsWriteDiscard) - ../../cuda/flex.cu:4792

My card is GTX1080 Ti.