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

**URL:** <https://root-forum.cern.ch/t/error-gpu-use-requested-but-garfield-has-not-been-built-with-gpu-support/64764>\
**Category:** Garfield++\
**Created:** [March 19, 2026, 1:18pm UTC](https://root-forum.cern.ch/t/error-gpu-use-requested-but-garfield-has-not-been-built-with-gpu-support/64764 "2026-03-19T13:18:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![wgb520](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wgb520/32/37797_2.png) [@wgb520](https://root-forum.cern.ch/u/wgb520)\
**Post date:** [March 19, 2026, 1:18pm UTC](https://root-forum.cern.ch/t/error-gpu-use-requested-but-garfield-has-not-been-built-with-gpu-support/64764/1 "2026-03-19T13:18:22Z")

</div>

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?

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/3/a/3ac047deb2de5f90ebd53dcdcf13f5abb646eab6.png)

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

---

<div class="post-metadata">

**Author:** ![djjansse](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/8baadc/32.png) [@djjansse](https://root-forum.cern.ch/u/djjansse)\
**Post date:** [March 19, 2026, 1:44pm UTC](https://root-forum.cern.ch/t/error-gpu-use-requested-but-garfield-has-not-been-built-with-gpu-support/64764/2 "2026-03-19T13:44:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wgb520](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wgb520/32/37797_2.png) [@wgb520](https://root-forum.cern.ch/u/wgb520)\
**Post date:** [March 24, 2026, 8:04am UTC](https://root-forum.cern.ch/t/error-gpu-use-requested-but-garfield-has-not-been-built-with-gpu-support/64764/3 "2026-03-24T08:04:56Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![gabrielribcesario](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/gabrielribcesario/32/38927_2.png) [@gabrielribcesario](https://root-forum.cern.ch/u/gabrielribcesario)\
**Post date:** [March 24, 2026, 9:15am UTC](https://root-forum.cern.ch/t/error-gpu-use-requested-but-garfield-has-not-been-built-with-gpu-support/64764/4 "2026-03-24T09:15:55Z")

</div>

Hello,

> [@wgb520](#):
>
> fatal error: TMatrixD.h: No such file or directory
> 
> fatal error: TRandom3.h: No such file or directory

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

---

<div class="post-metadata">

**Author:** ![wgb520](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wgb520/32/37797_2.png) [@wgb520](https://root-forum.cern.ch/u/wgb520)\
**Post date:** [March 27, 2026, 8:23am UTC](https://root-forum.cern.ch/t/error-gpu-use-requested-but-garfield-has-not-been-built-with-gpu-support/64764/5 "2026-03-27T08:23:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [April 10, 2026, 8:24am UTC](https://root-forum.cern.ch/t/error-gpu-use-requested-but-garfield-has-not-been-built-with-gpu-support/64764/6 "2026-04-10T08:24:17Z")

</div>

Closed on April 10, 2026, 8:24am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
