Operator¶
CUDAExperiment is the user-facing custom resource. Users describe the workload
container, command, GPU request, runtime class, and whether KRATOS should profile
the workload before normal execution.
Reconciliation Flow¶
When spec.profilingEnabled is false:
- Ensure execution Job
<experiment>-executionexists. - Record
ExecutionJobCreatedcondition inCUDAExperiment.status.
When spec.profilingEnabled is true:
- Check for existing
WorkloadProfilenamed<experiment>-profile. - If missing, ensure profiling Job
<experiment>-profilingexists and set conditionProfilingPending/ProfilingRunning. - When the profiling Job completes, read
<experiment>-profile-summaryConfigMap generated by the runner. - Create/update
<experiment>-profileWorkloadProfile and write parsed metrics intostatus. - Set
ProfilingCompletedcondition. - The controller then creates execution Job
<experiment>-executionand recordsExecutionJobCreatedcondition.
Because the controller watches owned Job objects (.Owns(&batchv1.Job{})), completion of the profiling Job automatically triggers reconciliation to publish the WorkloadProfile and launch the execution Job.
Profiling Job Structure¶
The profiling Job isolates the workload image from Nsight Compute:
stage-workload: An initContainer that usesspec.image, verifiesspec.command[0], copies the CUDA executable into a sharedemptyDirvolume, and exits.profiling-runner: Useskratos-nsight-compute-poc:latestby default (or image defined byKRATOS_NSIGHT_COMPUTE_IMAGE), requestsnvidia.com/gpu, runs the staged executable underncu, parses hardware metrics, and publishes summary ConfigMap<experiment>-profile-summary.
For example:
spec:
image: nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda12.5.0
command:
- /cuda-samples/vectorAdd
runtimeClassName: nvidia
gpuRequired: 1
replicas: 1
profilingEnabled: true
Outputs¶
Profiling generates:
- Job:
<experiment>-profiling - ConfigMap:
<experiment>-profile-summary - WorkloadProfile:
<experiment>-profile - Job:
<experiment>-execution
Example WorkloadProfile.status from an Nsight Compute run:
status:
boundType: unknown
metrics:
achievedOccupancy: "80.62"
l2Throughput: "31.23"
smThroughput: "12.58"
Inspect resources:
kubectl logs job/<experiment>-profiling
kubectl get configmap <experiment>-profile-summary -o yaml
kubectl get workloadprofile <experiment>-profile -o yaml
kubectl get cudaexperiment <experiment> -o yaml
kubectl logs job/<experiment>-execution
Longer-Term Direction¶
The current controller validates profiling and profile creation. Future scheduling iterations will use stored workload profiles, GPU telemetry, node constraints, and Volcano integration to generate placement hints before execution.