Device memory allocation fails on WSL2

I am trying to run a simple c++ program, with Cuda Thrust functions, on WSL2. It seems that program fails in runtime to allocate device memory. I use Thrust with Microsoft visual studio all the time, and I don’t get any errors.


cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(proj LANGUAGES CXX CUDA)


int main()
	//thrust::host_vector<int> h_vec(10);
	//thrust::fill(h_vec.begin(), h_vec.end(), 1);
	thrust::device_vector<int> d_vec(10);
	//thrust::fill(d_vec.begin(), d_vec.end(), 1);
	return 1;


terminate called after throwing an instance of 'thrust::system::system_error'
  what():  get_max_shared_memory_per_block :failed to cudaGetDevice: unknown error
Aborted (core dumped)

If I comment the device_vector line, and use the host vector instead, it runs with no errors.

Additional info:
-GeForce GTX 950M
-Windows 11 Home. build 22000.51.
-WSL2: Ubuntu-18.04
-Cuda compilation tools, release 9.1, V9.1.85

Hi, this would be the correct forum for this question: CUDA on Windows Subsystem for Linux - NVIDIA Developer Forums