Getting error "RuntimeError: cuda runtime error (8) : invalid device function at /pytorch/torch/lib/THC/THCTensorCopy.cu:204"

I am getting this error:

“RuntimeError: cuda runtime error (8) : invalid device function at /pytorch/torch/lib/THC/THCTensorCopy.cu:204”

and also the message:

" THCudaCheck FAIL file=/pytorch/torch/lib/THC/THCTensorCopy.cu line=204 error=8 : invalid device function"

In a different thread, I was told that Pytorch will take care of properly installing everything needed fro CUDA if it is available on a computer. So my code simply checks if cuda is available, then either uses CUDA or not.
This seems to work on some computers but not on the one where I get the error message above.

This seems to indicate the Pytorch first tells me that CUDA is available but then gets a problem actually using it?

1 Like

i have met the same problems, it might be my using the Nvidia GetForce 840M with 8GB, whose computer capability is 5.0. It is strange because i am using pytorch-cpu, which doesn’t need CUDA.