Using Ngsolve on GPU


I’ve been trying to work on my GPU for solving the Helmholtz equation. I followed the guide from 5.5.1 in the documentation, where to use cuda/gpu you’re using

from ngsolve.ngscuda import *
print (“no CUDA library or device available, using replacement types on host”)

This check throws the exception. I have CUDA 11.8 installed in my machine, and the nvcc --version command has the following output

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:41:10_Pacific_Daylight_Time_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0

I’ve installed Ngsolve in Windows 11, using pip install --pre ngsolve.

Do I need to build the code from scratch in order to have GPU support? I can’t find something in the documentation regarding this issue.


CUDA support in the pip package is only enabled on Linux builds. We can look into building it also on Windows for the next release, but for now, you need to compile NGSolve yourself configuring with -DUSE_CUDA=ON. (This is not mentioned yet in the documentation).



could you let me know where I can enable this option? Is it a command line option during cmake or make? Or is it inside a file whose value I need to change?