Text prompt AI image creation using Stable Diffusion and an NVIDIA A10 GPU on a RimuHosting VM


First, order a RimuHosting VM with a GPU. When prompted you would register or login to complete the order.

For most GPU applications you will need a good amount of memory (10GB+) and disk (30GB+). We recommend the Debian 12 (bookworm) distro. At the time of writing only the Dallas data center has GPU-enabled hosts.

You can then install the server via the RimuHosting control panel:

SSH to your server. Install the nvidia kernel drivers.

# update the default repositories to enable non-free packages
! grep -qai non-free /etc/apt/sources.list && sed -i 's/ main contrib$/ main contrib non-free non-free-firmware/' /etc/apt/sources.list
apt-get update
# install the nvidia modules
apt-get -y install nvidia-driver
# reboot 
reboot
# wait a few minutes for that


Next install Easy-Diffusion – a web based panel to let you use the Stable Diffusion code and model.

# install easy diffusion
wget https://github.com/cmdr2/stable-diffusion-ui/releases/download/v2.5.24/Easy-Diffusion-Linux.zip
unzip Easy-Diffusion-Linux.zip 
easy-diffusion/start.sh

By default the Easy Diffusion control panel will be running on the RimuHosting VM’s localhost IP address. To access the control panel from your desktop, you can use ssh port forwarding. For example on your desktop forward port 9000 on your local computer to the web control panel port running on the localhost IP on your RimuHosting VM on port 9000.

ssh   -L 9000:127.0.0.1:9000 root@yourserver

On your desktop you can now browse to http://localhost:9000 and that will be forwarded to your server.

Congratulations! You can now enter a text prompt and have your RimuHosting VM generate an image. Welcome to the age of AI.

Confirming your setup

You can check if the NVIDIA driver is installed OK.

root@gpu:~# cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module  525.105.17  Tue Mar 28 18:02:59 UTC 2023
GCC version:  gcc version 12.2.0 (Debian 12.2.0-14) 

You can check the nvidia modules are loaded OK. It will look like this:

root@gpu:~# dmesg | egrep -i nvidia
[    2.941476] audit: type=1400 audit(1687470966.684:2): apparmor="STATUS" operation="profile_load" profile="unconfined" name="nvidia_modprobe" pid=239 comm="apparmor_parser"
[    2.941481] audit: type=1400 audit(1687470966.684:3): apparmor="STATUS" operation="profile_load" profile="unconfined" name="nvidia_modprobe//kmod" pid=239 comm="apparmor_parser"
[    2.986818] nvidia_drm: loading out-of-tree module taints kernel.
[    2.986822] nvidia_drm: module license 'MIT' taints kernel.
[    2.986850] nvidia_drm: module verification failed: signature and/or required key missing - tainting kernel
[    3.238439] nvidia-nvlink: Nvlink Core is being initialized, major device number 246
[    3.243398] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  535.54.03  Tue Jun  6 22:20:39 UTC 2023

You can use the nvidia-smi command to get information about the GPU attached to your RimuHosting VM:

root@gpu:~# nvidia-smi 
Thu Jun 22 21:59:05 2023       
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.54.03              Driver Version: 535.54.03    CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA A10                     Off | 00000000:00:05.0 Off |                    0 |
|  0%   39C    P0              56W / 150W |      4MiB / 23028MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|  No running processes found                                                           |
+---------------------------------------------------------------------------------------+

When Easy Diffusion starts up you will get a message confirming you have a GPU:

21:59:34.609 INFO cuda:0 Device usage during initialization:                                                                                                                         
21:59:34.611 INFO cuda:0 CPU utilization: 20.7%, System RAM used: 1.3 of 19.1 GiB, GPU RAM used (cuda:0): 0.3 of 22.0 GiB (peak: 0.0 GiB)                                       

You can also view the GPU in your VM’s lspci output:

# will show the PCI card attached to the VM
lspci  | grep NVIDIA || echo "No GPU found."
# 00:05.0 3D controller: NVIDIA Corporation GA102GL [A10] (rev a1)

Troubleshooting

nvidia-smi is a good command to run to quickly check if your GPU is accessible.

If nvidia-smi reports “No devices were found” then the VM is unable to access a GPU.

If Easy Diffusion cannot find a GPU you will get a message like:

21:16:58.139 WARNING MainThread WARNING: Could not find a compatible GPU. Using the CPU, but this will be very slow!                                                     

You can also see if your VM is having a problem

# when gpu is not detected
#dmesg

[    3.134114] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  535.54.03  Tue Jun  6 22:20:39 UTC 2023
[  114.480548] nvidia_uvm: module uses symbols nvUvmInterfaceDisableAccessCntr from proprietary module nvidia, inheriting taint.
[  114.517752] nvidia-uvm: Loaded the UVM driver, major device number 244.
[  114.594383] nvidia 0000:00:05.0: firmware: direct-loading firmware nvidia/535.54.03/gsp_ga10x.bin
[  115.007087] NVRM: GPU 0000:00:05.0: RmInitAdapter failed! (0x62:0xffff:2393)
[  115.009420] NVRM: GPU 0000:00:05.0: rm_init_adapter failed, device minor number 0

When you ssh to your server using port forwarding you may see errors like the following. You may see this error if you reinstall a server (it will get a new host key).

If you see “Port forwarding is disabled” then you will not be able to browse to the Easy Diffusion control panel running on your server from your desktop.

# ssh   -L 9001:127.0.0.1:9000 $serverip
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ED25519 key sent by the remote host is
SHA256:jtzL7OZJ/1OMjcf0GoNKFTUczEGljEeea1cvJ98aw68.
Please contact your system administrator.
Add correct host key in /Users/peter/.ssh/known_hosts to get rid of this message.
Offending ED25519 key in /Users/peter/.ssh/known_hosts:1553
Password authentication is disabled to avoid man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.
Port forwarding is disabled to avoid man-in-the-middle attacks.
UpdateHostkeys is disabled because the host key is not trusted.

You would fix up your known_hosts file. e.g. on a Mac run ssh-keygen -R $serverip