First, check the driver. It may be that the driver version is too old. Install the latest version of the driver on the Windows system. The address is here , and then run your cuda case. Normally, no error will be reported.
If it is not a program error, but a CUDA calculation error (I have not searched for this problem), I later found out that the CUDA Runtime was installed incorrectly. Please refer to the official address of wsl2-cuda here .In fact, you can’t find the cuda-xxx.run file to install, choose the deb (local) installation method. Here is an example: