CUDA WSL (Ubuntu) - Seg fault when calling cudaMalloc / CudaMallocHost

Have below for my WSL setup
Linux version 5.15.90.1-microsoft-standard-WSL2
Cuda compilation tools, release 12.1, V12.1.105

Executables crashes at run-time when calling CudaMalloc it works on my Windows Visual Studio 2019 setup.
My guess is to do with WSL run-time environment settings.

include “/usr/local/cuda-12/include/cuda.h”
include “/usr/local/cuda-12/include/curand.h”
include “/usr/local/cuda-12/include/device_launch_parameters.h”
include “/usr/local/cuda-12/include/cuda_runtime.h”
include “/home/XXXX/cuda-samples/Common/helper_cuda.h”
include “/home/XXXX/cuda-samples/Common/helper_string.h”

nvcc -O2 -std=c++17 -I/usr/local/cuda-12.1/include -I/home/XXX/cuda-samples/Common CedCuda.cu -c
nvcc -L/usr/local/cuda-12.1/lib -L/usr/lib/gcc/x86_64-linux-gnu -ljsoncpp CedCuda.o -o ExtractGpus

Hi @cedricyangks
Thank you for reporting the issue!

Please note, that this sub-forum is dedicated to cuda-gdb (CUDA debugger) tool support (incl. CUDA debugging on WSL). Could you please clarify whether you experience this issue when debugging your application using cuda-gdb or it’s also happening when just running the application without the debugger?

Take it as when running the apps without the debugger.

Thank you for the clarification! I have moved the topic to a general CUDA programming section.