Skip to content

distro: rhel10: add AMI with Nvidia software stack - #2715

Merged
supakeen merged 5 commits into
osbuild:mainfrom
lfauster:ami-nvidia
Oct 6, 2026
Merged

supakeen merged 5 commits into
osbuild:mainfrom
lfauster:ami-nvidia

Conversation

@lfauster

@lfauster lfauster commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

This adds a new ami-nvidia image type for RHEL 10 aimed at NVIDIA GPU instances on EC2.
It's basically a normal AMI, plus the NVIDIA/CUDA stack from the RHEL10 supplementary and extensions repos (driver, open kmod, CUDA toolkit, fabric manager, persistenced).

On top of that there's a small oneshot service (nvidia-gpu-tweaks) that looks at the GPU name and locks GPU/memory clocks to the maxima AWS documents here:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/optimize_gpu.html

That way one gets consistent peak clocks instead of whatever the GPU boost decides to do.
The script is - for now - embedded in the imagetypes.yaml which is not pretty.

@lfauster lfauster changed the title distro: rhel10.2: add AMI with Nvidia software stack distro: rhel10: add AMI with Nvidia software stack Sep 24, 2026
@achilleas-k

achilleas-k commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

We've done similar things to the script embedding before but I agree it's not the best. Ideally it would be packaged in an RPM. Maybe we can do that eventually but for now, perhaps it would be better to do what we do for the pxe iso files here:

var fileDataFS embed.FS = files.Data

Thought I'm not fond of that being defined in the pipeline generator instead of the image definition either.

@supakeen

supakeen commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

We've done similar things to the script embedding before but I agree it's not the best. Ideally it would be packaged in an RPM. Maybe we can do that eventually but for now, perhaps it would be better to do what we do for the pxe iso files here:

var fileDataFS embed.FS = files.Data

Thought I'm not fond of that being defined in the pipeline generator instead of the image definition either.

Maybe we shouldn't do that. The friction here is fine it should be living in a package, if we want to use it in multiple image types a YAML anchor suffices.

We make things very undiscoverable with that embedded filesystem and users can't (easily) override it anymore.

@lfauster

lfauster commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor Author

What I tried as an experiment is a hybrid: have the script in the embedded FS under data/files, but reference it from imagetypes.yaml with a new property source: instead of a large inline data: blob, e.g.

files:
  - path: /usr/bin/example
    mode: 0755
    source: example/example-script

That keeps the injection visible in the image definition (unlike with the pattern used for PXE), while still avoiding inlining the script body in YAML.
I’m unsure whether the extra mechanism is worth it for this rare case though.

The same approach could replace the existing Azure dataloss_script inline blob:

- path: &dataloss_script "/usr/local/sbin/temp-disk-dataloss-warning"
mode: 0755
data: |

Open for suggestions how to proceed.

@lfauster
lfauster force-pushed the ami-nvidia branch 4 times, most recently from 4ad49ac to 9280b89 Compare October 1, 2026 11:43
@lfauster
lfauster marked this pull request as ready for review October 1, 2026 12:04
@lfauster
lfauster requested a review from a team as a code owner October 1, 2026 12:04

@croissanne croissanne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion on the rpm vs embedding thing. Obviously the ideal is an rpm. Or maybe an osbuild nvidia-tweak stage? Not sure.

Rpmrepo will need an update to support the new repos though.

Comment thread test/data/repositories/rhel-10.3.json Outdated
},
{
"name": "supplementary",
"baseurl": "https://cdn.redhat.com/content/dist/rhel10/10.3/x86_64/supplementary/os",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be added to rpmrepo snapshots (github.com/osbuild/rpmrepo). I don't think 10.3 cdn content is available yet.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, the mid to long term idea is to create a rpm package out of it. As that will take some time to roll out, we need a temporary, and acceptable, solution until then.

Thank you for the pointer regarding the rpmrepo; I will add the new repos there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the supplementary and extensions repos for rhel10.2 to rpmrepo, and switched to the latest 20261005 snapshot

@lfauster

lfauster commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

I've changed the PR to only make ami-nvidia available for rhel10.2. Main reasons being that

  1. support for older versions is not required and
  2. necessary nvidia packages (i.e. driver and CUDA stack) are not yet packaged for rhel10.3

@ondrejbudai ondrejbudai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should blacklist nouveau like RHEL AI does. It seems to me that since we ship the nvidia drivers, it's not a stupid thing to do.

A snippet from RHEL AI:

echo "blacklist nouveau" > /etc/modprobe.d/blacklist_nouveau.conf

I don't think this is blocking at this point, just something I found randomly.

Leave saphana repo on last nightly snapshot, as currently no new
snapshots are created.
Introduce an AMI image type that ships the open NVIDIA driver, CUDA toolkit,
and other utilities.
Add the supplementary and extensions repositories - which contain
the necessary packages - for this image type.

The image is intentionally not made available for upcoming RHEL10.3,
as the necessary repos and packages do not exist yet.
Add oneshot service that forces the GPU core clock (and memory clock where
applicable) to the maximum supported clock for consistent peak performance.

Clock values from:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/optimize_gpu.html
…are present

Add systemd drop-ins under /usr/lib so nvidia-fabricmanager starts only when
/proc/driver/nvidia-nvswitch/devices is non-empty, i.e. the system has NVSwitches.
Otherwise the nvidia-fabricmanager service will fail starting.

Also make the start sequence is
nvidia-fabricmanager -> nvidia-persistenced -> nvidia-gpu-tweaks.
Cap idle cores at C1 (processor/intel_idle.max_cstate=1), matching AWS
DLAMI, to reduce wake latency for GPU/NCCL workloads.
@lfauster

lfauster commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

I wonder if we should blacklist nouveau like RHEL AI does. It seems to me that since we ship the nvidia drivers, it's not a stupid thing to do.

nouveau is alread blacklisted here:

- filename: "blacklist-nouveau.conf"
commands:
- command: blacklist
modulename: "nouveau"

@ondrejbudai

Copy link
Copy Markdown
Member

I wonder if we should blacklist nouveau like RHEL AI does. It seems to me that since we ship the nvidia drivers, it's not a stupid thing to do.

nouveau is alread blacklisted here:

- filename: "blacklist-nouveau.conf"
commands:
- command: blacklist
modulename: "nouveau"

stupid me, thanks for pointing that out!

@croissanne
croissanne self-requested a review October 6, 2026 13:37

@croissanne croissanne left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@supakeen supakeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks looks OK. I guess we can't easily do drop in partials with the systemd config?

@supakeen
supakeen added this pull request to the merge queue Oct 6, 2026
@lfauster

lfauster commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

I guess we can't easily do drop in partials with the systemd config?

I checked before creating the drop-in manually, and in its current form unfortunately not. systemd_dropin allows to configure ConditionPathExists, but not ConditionDirectoryNotEmpty. I think it's feasible to actually use ConditionPathExists here, but the ConditionDirectoryNotEmpty condition in the nvidia-fabricmanager service is taken over from RHEL AI. I couldn't test this part, due to lack of a system with actual NVSwitches -> I prefer to not modify it without testing it.

That being said, the modification to After= made to nvidia-persistenced.service is not supported either. This one might be worth adding though.

Merged via the queue into osbuild:main with commit 3d4b826 Oct 6, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants