ERROR: GPU use requested but Garfield has not been built with GPU support

Hello,

When I attempted to run the GEMGPU program in Ubuntu 24.04 using WSL2, and used the parameter “–gpu”, it displayed the error message “ERROR: Requested GPU usage but Garfield has not been built with GPU support” Avalanche size = 0, 0
Endpoints = 0”

When I was compiling and installing Garfield++, I had set GARFIELD_WITH_CUDA to ON, and successfully completed the compilation and installation. What should I do to make the GPU work?

nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2026 NVIDIA Corporation
Built on Mon_Mar_02_09:52:23_PM_PST_2026
Cuda compilation tools, release 13.2, V13.2.51

root --version
ROOT Version: 6.36.08
Built for linuxx8664gcc on Mar 10 2026, 09:46:52
From tags/6-36-08@6-36-08

System version: wsl-Ubuntu 24.04

Dear @wgb520,

When you build Garfield++ do you get any message along the lines of:

– Looking for a CUDA compiler
– Looking for a CUDA compiler - NOTFOUND
CMake Warning at CMakeLists.txt:39 (message):
No CUDA support !

Kind regards,

Djunes

Hello, during the CMake process, CUDA support was successfully found.

– Looking for a CUDA compiler
– Looking for a CUDA compiler - /usr/local/cuda-13.2/bin/nvcc
– The CUDA compiler identification is NVIDIA 13.2.51
– Detecting CUDA compiler ABI info
– Detecting CUDA compiler ABI info - done
– Check for working CUDA compiler: /usr/local/cuda-13.2/bin/nvcc - skipped
– Detecting CUDA compile features
– Detecting CUDA compile features - done

I thought it was a problem with root6. So I recompiled root6. But when I tried to recompile Garfield++, it gave an error:

fatal error: TMatrixD.h: No such file or directory

fatal error: TRandom3.h: No such file or directory

compilation terminated.
make[2]: *** [GPU/CMakeFiles/GarfieldGPU.dir/build.make:77: GPU/CMakeFiles/GarfieldGPU.dir/AvalancheMicroscopicGPU.cu.o] Error 1

make: *** [Makefile:146: all] Error 2

What should I do to successfully compile?

Hello,

Recompiling ROOT might have changed its include directories, and it looks to me like CMake is using the wrong directory to find these headers.

Try removing the CMakeCache.txt file from your Garfield build directory before you recompile the project. If that fails, try removing the entire build directory and recreating it from scratch.

Cheers,

Gabriel

Hello, I have tried to delete the entire build folder and then recompile Garfield++, but the same error still persists.

fatal error: TMatrixD.h: No such file or directory
fatal error: TRandom3.h: No such file or directory
make[2]: *** [GPU/CMakeFiles/GarfieldGPU.dir/build.make:77: GPU/CMakeFiles/GarfieldGPU.dir/AvalancheMicroscopicGPU.cu.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1866: GPU/CMakeFiles/GarfieldGPU.dir/all] Error 2

When I set GARFIELD_WITH_CUDA to OFF, it was able to compile successfully.