Thank you for posting in Q&A.
If you want to use the GPU in a virtual machine, you need to pass through the GPU to the VM using Discrete Device Assignment (DDA). Please follow this guide.
Best Regards,
Ian Xue
If the Answer is helpful, please click "Accept Answer" and upvote it.