NVIDIA GPU support for PixInsight and TensorFlow

TensorFlow library is used in PixInsight by several tools: StarNet, StarXTerminator, NoiseXTerminator and BlurXTerminator. The TensorFlow library can use the NVIDIA GPU to significantly speed up processing. NVIDIA GPU support requires CUDA capable graphics card and as far as I know currently works only in Windows and Linux.

There are good instructions on how to set up TensorFlow GPU support for example in darkarchon site [Updated for PixInsight 1.8.8-6] PixInsight, StarNet++ and CUDA - Gotta Go Fast - _darkSkies Astrophotography (uses old versions) and in BlurXTerminator tool documentation in PixInsight.

I had some problems with installation using just the latest/random versions. Also the TensorFlow Windows library to support GPU is not built by default any more. Below are links to versions and libraries that worked for me in Windows 10.

CUDA 11.8

https://developer.nvidia.com/downloads/c118-cudnn-windows-8664-87084cuda11-archivezip

Download and install CUDA 11.8 support. Install a local version and use Express installation.

Note that you may need to register on the site before you can download the file.

cuDNN 8.7

https://developer.nvidia.com/downloads/c118-cudnn-windows-8664-87084cuda11-archivezip

Unzip the contents and copy the bin directory to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin, or whatever your CUDA 11.8 directory is. Copying needs administrator rights.

If you are not using the link above but NVIDIA download links then choose Local Installer for Windows (Zip).

Note that you may need to register on the site before you can download the file.

ZLIB

http://www.winimage.com/zLibDll/zlib123dllx64.zip

Download and unzip the file. Copy the file zlibwapi.dll from the dll_x64 folder to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin. Copying needs administrator rights.

Tensorflow 2.9.0

https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-windows-x86_64-2.9.0.zip

Download the TensorFlow package with Windows GPU support using the above link and unzip it. Note that starting from version 2.11.0 that library is not built by default and needs a different setup.

Copy tensorflow.dll to the PixInsight bin directory at C:\Program Files\PixInsight\bin and overwrite the existing file. Copying needs administrator rights. It is a good idea to keep the old tensorflow.dll in case something goes wrong.

Environment variable TF_FORCE_GPU_ALLOW_GROWTH

Finally you need to add a new environment variable TF_FORCE_GPU_ALLOW_GROWTH and set it to TRUE. Environment variables can be set at Control Panel → System and Security → System → Advanced system settings → Environment variables… (there must be an easier way but this is the one I know).