GPU Acceleration

SpamFoo runs entirely on the CPU by default and works well without a GPU. If your server has an NVIDIA GPU, you can turn on GPU acceleration to speed up processing.

GPU acceleration is optional and is off by default. When you turn it on, SpamFoo downloads and installs everything it needs on its own. The only thing you install yourself is the NVIDIA driver.

Requirements

  • An NVIDIA RTX 20xx series or newer GPU, or an equivalent NVIDIA datacenter GPU (Tesla T4 or newer). Other GPU brands are not supported.
  • A current NVIDIA driver installed on the server.
  • Windows or Linux on x64. GPU acceleration is not available on macOS.
  • Slightly more memory usage than the default requirements, due to the drivers required (about 500 MB extra)
  • Outbound HTTPS (port 443) access to developer.download.nvidia.com so SpamFoo can download the NVIDIA CUDA libraries. See Servers Without Internet Access if this is not possible.
Note: Besides the driver, SpamFoo will automatically download the any other NVIDIA libraries it needs directly from NVIDIA, verify them, and store them in its own runtime directory.

Enabling GPU Acceleration

  1. Install the NVIDIA driver for your GPU from nvidia.com/drivers, then reboot if the installer asks for it.
  2. Open the SpamFoo Admin Dashboard at http://localhost:16253/admin and go to Settings, then General.
  3. In the Performance section, turn on GPU Acceleration and confirm.

SpamFoo handles the rest on its own:

  1. SpamFoo switches to the matching GPU release channel and downloads the GPU-enabled build. The service restarts briefly to finish installing, then picks up where it left off.
  2. After the restart, SpamFoo downloads the NVIDIA CUDA libraries. A progress bar appears under the GPU Acceleration toggle in Settings while this happens. Classification keeps running on the CPU during the download, so mail flow is not interrupted.
  3. Once the download finishes, the embedding model starts using the GPU automatically. No further restart is needed.

The download messages also appear in the system log. See Log Management for where to find log files.

If the toggle cannot be turned on

  • "No compatible NVIDIA GPU was detected on this server." SpamFoo did not find an NVIDIA GPU. Check that the card is installed and the NVIDIA driver is working.
  • "GPU acceleration is controlled by the SPAMFOO_GPU environment variable." The SPAMFOO_GPU environment variable is set, which locks the toggle. Remove the variable and restart the service to control GPU acceleration from the dashboard.

Turning GPU Acceleration Off

Turn the toggle off in Settings, then General. SpamFoo switches back to CPU processing right away. If enabling the toggle moved your install onto a GPU release channel, SpamFoo also returns to the release channel it was on before and installs the standard build at the next update check. Downloaded CUDA libraries stay cached in the runtime directory, so turning GPU acceleration back on later is faster.

Environment Variables

Most servers only need the dashboard toggle. These variables are for hosts where you want the GPU behavior fixed ahead of time, such as automated deployments.

Variable Default Description
SPAMFOO_GPU Unset Forces GPU mode. Use on to force GPU or off to force CPU. When set, the dashboard toggle is locked. Leave unset to control GPU acceleration from the dashboard.
SPAMFOO_GPU_DEVICE 0 Which GPU to use if the server has more than one (CUDA device number).
SPAMFOO_GPU_AUTODOWNLOAD On Set to off to stop SpamFoo from downloading CUDA libraries automatically. GPU acceleration still works if the CUDA libraries are already installed on the server.

Servers Without Internet Access

On servers that cannot reach NVIDIA's download site, set SPAMFOO_GPU_AUTODOWNLOAD=off and install the NVIDIA CUDA 13 runtime and cuDNN 9 libraries yourself. When these are installed system-wide, SpamFoo finds and uses them without downloading anything.

Note that switching to the GPU-enabled build also requires outbound access to SpamFoo's cloud services for the update download. On fully offline servers, install the GPU-enabled build directly instead.

Next Steps