This document provides a quick reference for the operational scripts and monitoring configurations in this repository.
Purpose: Install AWS Neuron Device Plugin on EKS
Quick Start:
./scripts/setup-neuron-device-plugin.shCommon Options:
# With specific version
./scripts/setup-neuron-device-plugin.sh --version v2.0.0
# Extended timeout for large clusters
./scripts/setup-neuron-device-plugin.sh --wait 600What it does:
- Downloads device plugin manifest
- Applies to kube-system namespace
- Verifies DaemonSet is running
- Confirms NeuronCore resources are advertised
Purpose: End-to-end validation of Neuron infrastructure
Quick Start:
./scripts/validate-neuron.sh --cleanup --verboseCommon Options:
# Skip inference test (faster)
./scripts/validate-neuron.sh --skip-inference
# Target specific namespace
./scripts/validate-neuron.sh --namespace production --cleanupExit Codes:
0: All tests passed1: One or more tests failed2: Prerequisites not met
Tests Performed:
- Device plugin status check
- NeuronCore availability verification
- Model loading test
- Inference capability test
Purpose: Training performance benchmarks
Quick Start:
./scripts/benchmark-training.sh --model gpt2 --batch-size 16Common Options:
# Full benchmark with output
./scripts/benchmark-training.sh \
--model gpt2-medium \
--batch-size 32 \
--iterations 200 \
--output training-results.json
# Quick test
./scripts/benchmark-training.sh \
--model gpt2 \
--batch-size 8 \
--iterations 50Output Metrics:
- Throughput (tokens/second)
- Average time per iteration
- Total cost (USD)
- Cost per token
- Cost per 1M tokens
Purpose: Inference performance benchmarks
Quick Start:
./scripts/benchmark-inference.sh --model gpt2 --requests 5000Common Options:
# High-load test
./scripts/benchmark-inference.sh \
--model gpt2 \
--requests 10000 \
--concurrency 50 \
--output inference-results.json
# Quick test
./scripts/benchmark-inference.sh \
--model gpt2 \
--requests 1000 \
--concurrency 10Output Metrics:
- Throughput (requests/second)
- Latency (P50, P95, P99)
- Total cost (USD)
- Cost per request
- Cost per 1K requests
Purpose: Remove Neuron resources from cluster
Quick Start:
# Safe cleanup (workloads only)
./scripts/cleanup.sh --force
# Full cleanup (including monitoring)
./scripts/cleanup.sh --all --monitoring --force
# Complete cleanup (including infrastructure)
./scripts/cleanup.sh --all --node-pools --node-classes --forceSafety Levels:
- Default: Removes workload resources only
- --all: Adds device plugin and monitoring
- --node-pools: Includes Karpenter NodePools
- --node-classes: Includes EC2NodeClass (destructive!)
# 1. Deploy Neuron Monitor DaemonSet
kubectl apply -f monitoring/neuron-monitor-daemonset.yaml
# 2. Deploy Prometheus Rules
kubectl apply -f monitoring/prometheus-rules.yaml
# 3. Import Grafana Dashboard
# Upload monitoring/grafana-dashboard.json via Grafana UI# Check DaemonSet
kubectl get daemonset neuron-monitor -n kube-system
# View logs
kubectl logs -n kube-system -l app=neuron-monitor -f
# Test metrics endpoint
kubectl port-forward -n kube-system svc/neuron-monitor 8000:8000
curl http://localhost:8000/metrics | grep neuron_core_utilization# Check DaemonSet
kubectl get daemonset neuron-device-plugin-daemonset -n kube-system
# View logs
kubectl logs -n kube-system -l name=neuron-device-plugin-ds
# Check node resources
kubectl describe nodes | grep -A 5 "aws.amazon.com/neuron"# List nodes with NeuronCores
kubectl get nodes -o json | jq -r '.items[] | select(.status.allocatable["aws.amazon.com/neuron"] != null) | "\(.metadata.name): \(.status.allocatable["aws.amazon.com/neuron"]) cores"'
# Check allocatable resources
kubectl get nodes -o custom-columns=NAME:.metadata.name,NEURON:.status.allocatable.aws\.amazon\.com/neuron# Check pod with Neuron resources
kubectl get pods -o json | jq -r '.items[] | select(.spec.containers[].resources.limits["aws.amazon.com/neuron"] != null) | .metadata.name'
# Exec into pod and check Neuron runtime
kubectl exec -it <pod-name> -- neuron-ls
kubectl exec -it <pod-name> -- neuron-top# Port-forward to Neuron Monitor
kubectl port-forward -n kube-system svc/neuron-monitor 8000:8000
# Get current utilization
curl -s http://localhost:8000/metrics | grep neuron_core_utilization_percent
# Get memory usage
curl -s http://localhost:8000/metrics | grep neuron_device_memorySymptoms: No NeuronCore resources advertised
Check:
kubectl get daemonset neuron-device-plugin-daemonset -n kube-system
kubectl describe daemonset neuron-device-plugin-daemonset -n kube-system
kubectl logs -n kube-system -l name=neuron-device-plugin-dsFix:
# Reinstall device plugin
./scripts/setup-neuron-device-plugin.shSymptoms: Pod waiting for NeuronCore resources
Check:
kubectl describe pod <pod-name>
# Look for: "Insufficient aws.amazon.com/neuron"Fix:
# Check available resources
kubectl get nodes -o custom-columns=NAME:.metadata.name,NEURON:.status.allocatable.aws\.amazon\.com/neuron
# Scale up or wait for Karpenter to provision nodes
kubectl get nodepoolsSymptoms: Pod crashes during model loading
Check:
kubectl logs <pod-name>
kubectl describe pod <pod-name>Common Issues:
- Insufficient memory - increase pod memory limits
- Model incompatible - check Neuron SDK version
- Timeout - increase readiness probe timeout
Fix:
# Increase memory in deployment
resources:
limits:
memory: 32Gi
requests:
memory: 16GiSymptoms: Inference slower than expected
Check:
# Check NeuronCore utilization
kubectl exec <pod-name> -- neuron-top
# Check metrics
kubectl port-forward -n kube-system svc/neuron-monitor 8000:8000
curl http://localhost:8000/metrics | grep neuron_core_utilizationCommon Issues:
- NeuronCore oversubscribed - scale horizontally
- Batch size too small - increase batch size
- Model not compiled - ensure model is compiled for Neuron
Symptoms: No metrics in Grafana
Check:
# Check Neuron Monitor DaemonSet
kubectl get daemonset neuron-monitor -n kube-system
# Check if metrics are exposed
kubectl port-forward -n kube-system svc/neuron-monitor 8000:8000
curl http://localhost:8000/metrics
# Check Prometheus scrape config
kubectl get servicemonitor -AFix:
# Redeploy monitoring
kubectl delete -f monitoring/neuron-monitor-daemonset.yaml
kubectl apply -f monitoring/neuron-monitor-daemonset.yaml| Instance Type | NeuronCores | Memory | Cost/Hour |
|---|---|---|---|
| inf2.xlarge | 2 | 8 GB | $0.76 |
| inf2.8xlarge | 2 | 32 GB | $2.39 |
| inf2.24xlarge | 6 | 96 GB | $7.09 |
| inf2.48xlarge | 12 | 192 GB | $14.18 |
| Instance Type | NeuronCores | Memory | Cost/Hour |
|---|---|---|---|
| trn1.2xlarge | 2 | 32 GB | $1.34 |
| trn1.32xlarge | 32 | 512 GB | $21.50 |
| trn1n.32xlarge | 32 | 512 GB | $24.78 |
neuron_core_utilization_percent: Target 60-90%neuron_inference_latency_seconds: Watch P95/P99neuron_inference_throughput_requests_per_second: Monitor for drops
neuron_execution_errors_total: Should be 0neuron_runtime_errors_total: Should be 0- Device plugin up/down status
- Average utilization < 20% = consider downsizing
- Idle instances (0% for 2+ hours) = terminate
- Memory utilization > 90% = increase pod limits
- Device plugin down
- Execution errors > 0
- P99 latency > 5s
- Memory usage > 95%
- High utilization > 95%
- High latency P95 > 1s
- Memory usage > 90%
- Throughput drop > 30%
- Low utilization < 10%
- Idle instances
- Cost optimization opportunities
#!/bin/bash
# Get average utilization and estimate savings
UTILIZATION=$(kubectl exec -n kube-system daemonset/neuron-monitor -- curl -s localhost:8000/metrics | grep neuron_core_utilization_percent | awk '{sum+=$2; count++} END {print sum/count}')
echo "Average NeuronCore Utilization: ${UTILIZATION}%"
if (( $(echo "$UTILIZATION < 20" | bc -l) )); then
echo "WARNING: Consider downsizing - low utilization detected"
fi#!/bin/bash
# Run validation and fail pipeline if tests don't pass
./scripts/validate-neuron.sh --cleanup
if [ $? -ne 0 ]; then
echo "Validation failed - check logs above"
exit 1
fi
echo "Validation passed - infrastructure ready"#!/bin/bash
# Weekly inference benchmark with result archival
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
./scripts/benchmark-inference.sh \
--model gpt2 \
--requests 5000 \
--concurrency 20 \
--output "benchmarks/results_${TIMESTAMP}.json"
# Upload to S3 for long-term storage
aws s3 cp "benchmarks/results_${TIMESTAMP}.json" s3://my-benchmarks/- Main README: README.md
- Quick Start Guide: QUICKSTART.md
- Full Documentation: docs/
- AWS Neuron SDK: https://awsdocs-neuron.readthedocs-hosted.com/
Last Updated: 2026-04-04