Starless North America Neula

PixInsight GPU acceleration for AMD

I am thrilled to share that GPU accelerated tensorflow plugins on PixInsight now work with AMD GPUs. It took a little bit to figure out the build process and successfully get a library. I hope this simple guide can help get you up and running and enjoying GPU acceleration with StarNet++ and other apps.

Requirements

  • Ubuntu 22.0.4
  • PixInsight (Latest version)
  • AMD GPU (tested on 7900xtx)
  • GPU enabled scripts to verify (Starnet++)

Install rocm

sudo apt install "linux-headers-$(uname -r)" "linux-modules-extra-$(uname -r)"
sudo usermod -a -G render,video $LOGNAME # Adding current user to Video, Render groups. See prerequisites.
wget https://repo.radeon.com/amdgpu-install/6.1.1/ubuntu/jammy/amdgpu-install_6.1.60101-1_all.deb
sudo apt install ./amdgpu-install_6.1.60101-1_all.deb
sudo apt update
sudo apt install amdgpu-dkms
sudo apt install rocm
echo "Please reboot system for all settings to take effect."

Be sure to reboot as the above script says. This process will build kernel drivers and also set up permissions for render/video so the GPU can access the kernel drivers. GPU Acceleration in PixInsight with tensorflow based apps will NOT work until you restart.

Download libtensorflow for amd

I compiled this on Ubuntu 22.0.4 against ROCm 6.1.1

Download libtensorflow216.tar.gz

Install into pixinsight

Backup your original libtensorflow in PixInsight:

cd /opt/PixInsight/bin/lib
mkdir bak
mv libtensorflow* bak

Extract the download file to /usr/local from the path where you downloaded it too.

sudo tar -C /usr/local -xzf /path/to/Downloads/libtensorflow216.tar.gz

Run linker to build OS library

sudo ldconfig /usr/local/lib

Exit/Restart PixInsight and try StarNet or run StarNet CLI. PixInsight won’t load this library if you don’t restart after running ldconfig.

GPU accelerated Starnet++

Now let’s verify that StarNet will use the AMD GPU. StarNet includes a libtensorflow.so in its directory that you will need to replace with my AMD ones if you run the CLI version, but if you run this tool in PixInsight it should use the one we installed in your ld path.

bymiller@byron-X570:~/Downloads/StarNetv2CLI_linux$ sh run_starnet.sh 
2024-05-12 21:01:54.012227: E external/local_xla/xla/stream_executor/plugin_registry.cc:90] Invalid plugin kind specified: DNN
2024-05-12 21:01:54.033232: E external/local_xla/xla/stream_executor/plugin_registry.cc:90] Invalid plugin kind specified: BLAS
Reading input image... Done!
Bits per sample: 16
Samples per pixel: 3
Height: 712
Width: 1048
Restoring neural network checkpoint... Done!
2024-05-12 21:01:54.384899: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: SSE3 SSE4.1 SSE4.2 AVX AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-05-12 21:01:54.436196: I external/local_xla/xla/stream_executor/rocm/rocm_gpu_executor.cc:812] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2024-05-12 21:01:54.458272: I external/local_xla/xla/stream_executor/rocm/rocm_gpu_executor.cc:812] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2024-05-12 21:01:54.458309: I external/local_xla/xla/stream_executor/rocm/rocm_gpu_executor.cc:812] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2024-05-12 21:01:54.458427: I external/local_xla/xla/stream_executor/rocm/rocm_gpu_executor.cc:812] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2024-05-12 21:01:54.458460: I external/local_xla/xla/stream_executor/rocm/rocm_gpu_executor.cc:812] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2024-05-12 21:01:54.458493: I external/local_xla/xla/stream_executor/rocm/rocm_gpu_executor.cc:812] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2024-05-12 21:01:54.458511: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1929] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 23512 MB memory:  -> device: 0, name: Radeon RX 7900 XTX, pci bus id: 0000:0a:00.0
Total number of tiles: 15
2024-05-12 21:01:54.798149: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:388] MLIR V1 optimization pass is not enabled
100% finished

Done!

Hooray! AMD Users Rejoice at beautiful GPU accelerated StartNet++ (and other PixInsight tools that are GPU enabled)

You can install radeontop and run it in a shell while you run starnet or other Tensorflow jobs and see the GPU load spike.

sudo apt install radeontop

AMD GPU Accelerated RC-Astro

I’m happy to report that the amazing rc-astro tools all work with this set up as well.

StarXTerminator – Remove stars or create star mask.

NoiseXTerminator – AI Noise Removal.

BlurXTerminator – Deconvolution.

You can download the trial version of these from: https://www.rc-astro.com/pixinsight-installation-instructions/

Comments

Please leave a comment below if this works or doesn’t work for you. I have another tensorflow library built on 2.13 that may work with older AMD GPUs if this one doesn’t work for you.

May your skies be clear.

3 thoughts on “PixInsight GPU acceleration for AMD”

  1. Hi Byron – thanks for sharing – this is a breakthrough! Managed to get it working on Arch with ubuntu 22.04 going in distrobox using your guide (starnet++ cli). Fingers are crossed for PixInsight.
    All the best and thanks once again.
    Cheers

    1. Awesome news! It should work on Debian based systems. I’ll be trying to get it to work on Fedora as well next. Which video card do you have? I’d like to track ones it works on.

      1. yep very awesome. good luck with Fedora – maybe Arch after that 😉 – the way pixinsight installs appears to not play ball w/ the distrobox sandboxing. i have a 7900xtx in the main rig – I do also have a 6900xt but that is in the home server for a windoze vm (isn’t getting much use – if i get some time i could spin up a ubuntu or fedora vm and see if it works on the older libraries).

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top