Choose a Profile for Your Hardware
In this tutorial, you select a NIM microservice profile that fits your GPUs using only the NIM Metadata API. The procedure is deterministic, so you can follow it literally, either by hand or in a program.
In this tutorial, you will:
- Fetch metadata and classify GPU targeting.
- Apply hardware constraints.
- Filter capabilities and rank candidates.
- Record the selected profile identifier.
Time: Approximately 20 minutes.
Prerequisites
Before you start, complete the following prerequisites:
- Review the Prerequisites and confirm you can reach the base URL.
- Complete the Quickstart so that you can fetch a metadata document.
- Collect the four hardware inputs described in the following section.
Related Concepts
Understanding the following concepts will help you complete this tutorial:
Collect Your Hardware Inputs
You need four values that describe the hardware you intend to deploy on. The following table describes each value and how to obtain it:
Tutorial Steps
Follow the steps in order. Each step narrows the candidate set, so the order matters.
-
Request the metadata document for the NIM microservice and tag you are evaluating, as described in the Quickstart.
If the request returns a 404 status code, first verify the container tag and repository path form (for team-owned repositories, use
nim/{team}/{repo}). If the path form and tag are correct and the response is still 404, this NIM microservice has no published metadata for that tag. Then fall back to the microservice documentation.Success Check: A successful request contains the metadata document for your NIM microservice and tag.
-
For each entry in
profiles, apply the following tests in order:- If
gpu_deviceis present and equals yourgpu_device, record a direct match. - If
tested_gpu_devicesis present, is not empty, and contains yourgpu_device, record a tested match. - If both
gpu_deviceandgpuare absent, record a GPU-agnostic candidate. - Otherwise, discard the profile because it is not a match.
Keep all three candidate tiers through the hardware and capability checks in steps 3 through 6. Apply targeting preferences only when ranking the survivors in step 7, so a usable fallback is not discarded before you verify that a preferred profile fits.
Success Check: Each candidate has a direct, tested, or GPU-agnostic targeting classification.
- If
-
Discard any profile where
min_vram_per_device_gbis present and greater than yourvram_per_device_gb.If the field is absent, you cannot verify fit from the API. Keep the profile as a candidate, but do not treat it as confirmed.
Success Check: No candidate with a recorded vRAM floor exceeds your per-device vRAM.
-
Compute the GPU requirement for the profile, treating an absent parallelism value as 1:
Discard the profile if
required_gpusexceeds yourgpu_count, or ifmax_gpu_countis present and less thanrequired_gpus.Success Check: Every remaining candidate meets the recorded GPU-count constraints.
-
Evaluate
min_cpu_count,system_memory_per_device_gb,disk_space_per_device_gb, andmin_driver_version.For each field, discard the profile only when the field is present and your hardware falls short.
Success Check: No candidate has a recorded host requirement that your hardware fails.
-
Filter on the capabilities your workload needs:
- If you need LoRA adapters, keep only profiles where
feat_loraistrue. - If you need a specific backend, filter on
inference_backend.
An absent flag is unknown rather than false, so decide explicitly whether to keep or discard unknowns.
Success Check: Every remaining candidate meets your capability requirements or has an explicit unknown outcome.
- If you need LoRA adapters, keep only profiles where
-
Among the remaining profiles, prefer direct matches over tested matches, and tested matches over GPU-agnostic candidates. If no direct match survives the hardware and capability checks, use a surviving tested match or GPU-agnostic candidate.
Within the preferred surviving tier, prefer lower precision for throughput, such as fp8 over bf16 over fp16, or higher precision for accuracy, according to your needs.
Where
throughputis present on all candidates, it can break ties. Review Current Limitations before you rely on it, because its units are not standardized.Success Check: You have ranked the surviving candidates according to your workload needs.
-
Take
profile_idfrom your chosen profile.That is the value you supply at deployment time.
Success Check: You have recorded the chosen
profile_idfor deployment.
Worked Example
Suppose you have two L40S GPUs with 48 GB each and the PCI identifier
26b9:10de, and you query a NIM microservice that returns four profiles:
Working the steps produces the following outcome:
- Step 1: The metadata request succeeds and returns the four profiles in the preceding table.
- Step 2:
bbbbandccccare direct matches, andddddis a GPU-agnostic candidate. The profileaaaatargets a different device, so it is discarded. Keepbbbb,cccc, andddddfor the remaining checks. - Step 3:
bbbbandccccrequire 48 GB per device, andddddrequires 24 GB. You have 48 GB per device, so all three pass. - Step 4: The profile
bbbbrequires two GPUs and you have two, so it passes. The profileccccrequires four, so it is discarded. The profileddddrequires one GPU, so it also passes. - Steps 5 and 6: Assume that
bbbbandddddmeet the remaining host and capability requirements. Both remain candidates. - Step 7: Prefer the surviving direct match
bbbbover the GPU-agnostic candidatedddd.
The result is bbbb. Note that cccc was the higher-performance option on
paper, because it uses fp8 rather than bf16, and GPU count alone eliminated it.
This is exactly the kind of determination that previously required downloading
the container to discover.
If you instead have only one L40S GPU with 48 GB, step 4 discards both bbbb
and cccc because they require two and four GPUs, respectively. The
GPU-agnostic candidate dddd survives and is selected, assuming it meets
the remaining host and capability requirements. Keeping the fallback until
after the fit checks avoids incorrectly reporting that no profile is available.
A Minimal Robust Client
Install the requests library before you run the following example:
The following example fetches a metadata document with retries and evaluates
hardware fit. Substitute the resourceId and tag for the NIM microservice you
want to inspect:
The fits function returns three values rather than two. A profile whose vRAM
requirement is unrecorded is genuinely undeterminable, and collapsing that
result into False would silently discard workable profiles.
Troubleshooting
If a profile matches on gpu but not on gpu_device, match on
gpu_device, because gpu formats vary and are not reliable join keys. If
only gpu is present, you cannot confirm a match programmatically. For other
issues, refer to Troubleshooting.
What You Learned
In this tutorial, you completed the following tasks:
- Collected the four hardware inputs that drive profile selection.
- Classified profiles into direct, tested, and GPU-agnostic tiers.
- Applied vRAM, GPU-count, host, and functional constraints in order.
- Identified the
profile_idto supply at deployment time.
Next Steps
Continue your learning with these related resources: