6.2. Configuring the GPU that you want to use with the command-line assistant
For better performance, you can change the configuration settings of the graphics processing unit (GPU) attached to the host system by editing the ~/.config/rhel-lightspeed/.env file. This file contains information to help you select the correct container image and device settings for your hardware.
Prerequisites
- You have installed the RHEL command-line assistant in a disconnected environment. See Installing the RHEL command-line assistant in disconnected environments.
Procedure
Open the
~/.config/rhel-lightspeed/.envfile in a text editor. For example:$ vi ~/.config/rhel-lightspeed/.envSet the
container imagevariable:Locate the
LLAMACPP_IMAGEvariable and set it up to the corresponding ramalama container for your GPU hardware. For example:LLAMACPP_IMAGE="registry.redhat.io/rhel-cla/ramalama-rhel10-nvidia:latest"
Set the
host devicevariable:Locate the
HOST_DEVICEvariable for the device of your GPU. For example:# For AMD GPUs HOST_DEVICE="/dev/dri" # For NVIDIA GPUs HOST_DEVICE="/dev/nvidia0"
Optional: Configure NVIDIA-specific variables:
- Locate and set up the NVIDIA-specific variables.
Restart the assistant to apply the changes:
$ rhel-lightspeed stop $ rhel-lightspeed start
Troubleshooting
Resolve GPU errors after restarting an EC2 instance.
When you use the offline RHEL command-line assistant on a GPU-enabled AWS EC2 instance, the rhel-lightspeed start command might fail after the instance is stopped and restarted. This error happens because the GPU ID changes after a restart. To work around this problem, regenerate the NVIDIA Container Device Interface (CDI) configuration file by running the following command:
$ nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yamlThis updates the reference of the system to the GPU, enabling the
rhel-lightspeedservice to start correctly.