Nsight Compute Profiling PoC¶
This PoC validates the current profiling pipeline end to end:
- A
CUDAExperimentwithspec.profilingEnabled: truecreates a profiling Job; - The profiling Job stages the workload executable from the workload image;
- The profiling runner launches that executable under Nsight Compute (
ncu); - The runner publishes a profile summary ConfigMap;
- The controller creates a
WorkloadProfileand writes parsed metrics intostatus; - Upon profiling Job completion, reconciliation automatically creates the execution Job.
The parser and classification are intentionally small. The key PoC signal is that metrics come from a real ncu run on hardware, not from synthetic data.
Images¶
Build and deploy the controller:
make docker-build IMG=kratos-controller:v0.1.0
kind load docker-image kratos-controller:v0.1.0 --name kratos-gpu
make deploy IMG=kratos-controller:v0.1.0
kubectl rollout status -n kratos-system deployment/kratos-controller-manager
Build and load the profiling runner:
cd test/nsight-compute-poc
make build
make load CLUSTER=kratos-gpu
cd ../..
make build uses Dockerfile.runtime (based on nvidia/cuda:12.4.1-base-ubuntu22.04) and installs Nsight Compute CLI, Python, kubectl, the metric parser, and /scripts/profile.sh.
Test Experiment¶
Apply the CRDs and RBAC permissions if they are not already deployed:
make install
kubectl apply -f config/rbac/profiling_runner_configmap_role.yaml
kubectl apply -f config/rbac/profiling_runner_configmap_role_binding.yaml
Create or reapply a profiling experiment:
apiVersion: gpu.scheduler.io/v1alpha1
kind: CUDAExperiment
metadata:
name: cuda-vector-add-validation
namespace: default
spec:
image: nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda12.5.0
command:
- /cuda-samples/vectorAdd
runtimeClassName: nvidia
replicas: 1
gpuRequired: 1
profilingEnabled: true
For a clean rerun:
kubectl delete workloadprofile cuda-vector-add-validation-profile --ignore-not-found
kubectl delete configmap cuda-vector-add-validation-profile-summary --ignore-not-found
kubectl delete job cuda-vector-add-validation-profiling --ignore-not-found
kubectl delete job cuda-vector-add-validation-execution --ignore-not-found
kubectl apply -f config/samples/gpu_v1alpha1_cudaexperiment.yaml
Check the pipeline execution:
kubectl get jobs
kubectl get pods
kubectl logs job/cuda-vector-add-validation-profiling
kubectl get configmap cuda-vector-add-validation-profile-summary -o yaml
kubectl get workloadprofile cuda-vector-add-validation-profile -o yaml
kubectl get cudaexperiment cuda-vector-add-validation -o yaml
kubectl logs job/cuda-vector-add-validation-execution
Expected indicators:
- Profiling Job reaches
Complete; - Logs include
ncu --version,Profiling "vectorAdd", andTest PASSED; - Logs include real raw metrics such as
sm__throughputandlts__throughput; - ConfigMap
<experiment>-profile-summarycontainssummary.json; WorkloadProfile.status.boundTypeandWorkloadProfile.status.metricsare populated;- Execution Job
<experiment>-executionis created and reachesComplete.
Example result from the local kratos-gpu cluster:
status:
boundType: unknown
metrics:
achievedOccupancy: "80.62"
l2Throughput: "31.23"
smThroughput: "12.58"
unknown is expected for the NVIDIA vectorAdd sample with the current thresholds. The PoC goal is real metric capture and controller propagation.
Notes & Security Constraints¶
- The runner container requests GPU performance counter access. The PoC grants
SYS_ADMINcapability to the profiling container. - The Nsight package image is around 594 MB. Keep the image loaded in Kind during validation.
ncu --set basicis used because it works with Nsight Compute 2024.1.1 and collects essential hardware metrics.