Skip to content

Add support for multi-arch CUDA binaries - #2001

Open
Sbozzolo wants to merge 1 commit into
CEED:mainfrom
Sbozzolo:multiple-cuda-arches
Open

Add support for multi-arch CUDA binaries#2001
Sbozzolo wants to merge 1 commit into
CEED:mainfrom
Sbozzolo:multiple-cuda-arches

Conversation

@Sbozzolo

@Sbozzolo Sbozzolo commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

This PR follows MAGMA's example and adds CUDA_TARGETS. CUDA_TARGETS can be used to bake multiple CUDA_ARCHs in a single binary.

In particular, like in MAGMA, I build real targets (SASS) for all the architectures as well as a virtual target (PTX) for the last one. This allows architectures that were not in CUDA_ARCH to run by compiling the PTX directly.

LLM/GenAI Disclosure:

A large language model pointed me to the Magma makefile. The large language model reviewed the implementation, and suggested changing from using NV_COMP_LAST := $(wordlist $(nwords_1),$(nwords),$(NV_COMP)) to $(call cuda_gencode_compute,$(lastword $(CUDA_SMS))), which is simpler.

The LLM and drove testing and implemented the change in the spack recipe.

Related Spack PR: spack/spack-packages#5888

This PR follows MAGMA's example and adds `CUDA_TARGETS`. `CUDA_TARGETS`
can be used to bake multiple `CUDA_ARCHs` in a single binary.

In particular, like in MAGMA, I build real targets (SASS) for all the
architectures as well as a virtual target (PTX) for the last one. This
allows architectures that were not in CUDA_ARCH to run by compiling the
PTX directly.

@jeremylt jeremylt 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

@Sbozzolo

Sbozzolo commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

LGTM

Thanks for the super quick response!

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.

2 participants