Commit Graph

2782 Commits

Author SHA1 Message Date
jgrusewski
2357337bbd fix(infra): move Argo logs to dedicated argo-logs bucket
Argo artifact logs were stored in foxhunt-training-results which is
meant for model checkpoints. Separate bucket makes logs findable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 09:33:11 +01:00
jgrusewski
c84c51434e fix(tests): add missing TradingState import to DQN trainer tests
The test module used `super::*` but TradingState lives in
crate::dqn, not in the trainer module — broke `cargo test --lib`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 09:25:52 +01:00
jgrusewski
216db0301d fix(gpu): eliminate all GPU→CPU roundtrip violations — zero guard findings
Replace .to_vec1()/.to_vec2() bulk downloads with GPU-resident ops:
- PPO/DQN action selection: Gumbel-max trick (categorical on GPU)
- Scalar readbacks: .to_scalar() instead of .to_vec1()[0]
- GPU stats: abs().max(), sqr().sum_all() — single scalar out
- NaN/Inf check: sum_all().to_scalar().is_finite()
- Guard exclusions: inference output boundaries + CPU fallback with GPU path

26 files across ml-ppo, ml-dqn, ml-supervised, ml (ensemble adapters, metrics, data_loading)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:19:09 +01:00
jgrusewski
77715209f6 chore: delete dead demo_dqn.rs, update GPU hot-path guard
- Remove ml-dqn/src/demo_dqn.rs (134 lines, unused)
- Guard: add new hot-path patterns, tighten leak detection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 23:50:54 +01:00
jgrusewski
3ac51679a1 feat(cuda): fused DQN training kernel + trainer split
Replace 7k-line monolithic trainer.rs with modular trainer/ directory:
  action.rs, constructor.rs, metrics.rs, mod.rs, state.rs,
  tests.rs, training_loop.rs, train_step.rs (6048 lines total)

New fused CUDA training pipeline:
  - dqn_training_kernel.cu: single-kernel forward+loss+backward
  - gpu_dqn_trainer.rs: host-side fused training orchestration
  - fused_training.rs: Rust-side fused training integration

Eliminates per-step CPU↔GPU synchronization in DQN training loop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 23:50:29 +01:00
jgrusewski
6b3a00a0ac feat(cuda): pipeline improvements — double buffer, weights, collectors
- common_device_functions.cuh: extended shared header for fused ops
- double_buffer.rs: async double-buffered GPU memory transfers
- gpu_weights.rs: unified weight management for fused training
- gpu_experience_collector.rs: streamlined GPU experience collection
- gpu_ppo_collector.rs: PPO collector GPU path improvements
- gpu_curiosity_trainer.rs + kernel: curiosity training on GPU
- dqn_experience_kernel.cu: experience kernel updates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 23:49:54 +01:00
jgrusewski
0274f63a2f fix(gpu): delete dead CPU fallback code from GPU hot paths
Remove ~850 lines of unreachable CPU fallback code from 3 hot-path files:

- hyperopt/dqn.rs: delete 250-line CPU backtest path (GPU eval mandatory)
- evaluate_baseline.rs: delete CPU PPO eval + non-CUDA fallback (147 lines)
- trainers/ppo.rs: delete 6 dead CPU rollout methods (~370 lines),
  split train() into dispatcher + #[cfg(feature = "cuda")] train_gpu()

All .to_vec1() GPU hot-path guard violations eliminated.
GPU failures are now hard errors, not silent CPU fallbacks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 23:48:12 +01:00
jgrusewski
9d564a829e fix(guard): restore #[cfg(test)] exclusion, keep cfg(not(cuda)) filter
Unit tests need scalar readbacks for assertions — .to_scalar() is not
flagged but .to_vec1() in test modules would generate false positives.
Guard now correctly excludes inline #[cfg(test)] modules while checking
all production code including ensemble adapters.

Full --all scan reveals 31 pre-existing production violations across
ml-dqn, ml-ppo, ml-supervised, and ensemble adapters — separate cleanup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 23:11:06 +01:00
jgrusewski
39e5dafc62 fix(cuda): harden GPU hot-path guard — exclude tests, remove false-positive patterns
- Guard: exclude #[cfg(test)] modules (tests need scalar readbacks for assertions)
- Guard: exclude #[cfg(not(feature = "cuda"))] guarded expressions (dead code with CUDA)
- Guard: remove Tensor::from_vec/from_slice from leak patterns (CPU→GPU is correct direction)
- Guard: remove .to_scalar from leak patterns (single 4-byte readback, not bulk transfer)
- dqn.rs: rewrite log_q_values() to use GPU tensor ops (min/max/mean/var), eliminate to_vec1
- dqn.rs: rewrite clip monitoring to use GPU tensor ops, individual .to_scalar() readbacks
- ppo.rs: replace stacked .to_vec1() metrics readback with individual .to_scalar() calls
- evaluate_baseline.rs: single-bar DQN action from .to_vec1::<u32>() to .to_scalar::<u32>()
- mod.rs: remove gpu_upload_vec/gpu_upload_slice wrappers (guard no longer flags from_vec)
- Delete dead demo_dqn.rs (zero callers, stub returning mock results)

Remaining: 4 .to_vec1() violations across 3 files — porting to existing CUDA implementations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 23:04:46 +01:00
jgrusewski
fee3c858ae fix(cuda): move q_forward_dueling_warp_shmem to common header
The backtest_forward_kernel.cu calls q_forward_dueling_warp_shmem but
it was defined in dqn_experience_kernel.cu — a different compilation unit.
Move the function, TILE_LAYER_WARP_CLEAN macro, SHMEM_MIN and DIST_SIZE
to common_device_functions.cuh so both kernels can use them.

Add #ifndef guards to all macros to prevent redefinition warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 15:56:23 +01:00
jgrusewski
8ea400e599 fix(cuda): fix TMA inline asm syntax for CUDA 12.9 PTX ISA 8.7
The CI toolkit (CUDA 12.9, PTX ISA 8.7) requires:
1. cp.async.bulk needs .mbarrier::complete_tx::bytes completion mechanism
   (mandatory since PTX ISA 8.3 / CUDA 12.3)
2. mbarrier.try_wait.parity.acquire needs .cta scope qualifier between
   .acquire and .shared::cta

Reverts the DISABLE_TMA workaround — TMA now compiles natively to cubin.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 15:10:10 +01:00
jgrusewski
8c4861fb70 fix(cuda): always define DISABLE_TMA — CI toolkit cannot assemble cp.async.bulk
The CI CUDA toolkit's ptxas fails on TMA instructions (cp.async.bulk)
with "completion_mechanism modifier required". Prepend #define DISABLE_TMA 1
in compile_ptx_for_device() so ALL kernel compilations (experience collector,
backtest evaluator, PPO collector, curiosity trainer, action selector) use
the float4 cooperative load fallback instead of TMA.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 15:03:52 +01:00
jgrusewski
8c4657a3a4 fix(infra): resolve commit-sha=HEAD to remote branch tip, not local PVC HEAD
When commit-sha defaults to "HEAD", git checkout HEAD is a no-op — it keeps
the PVC's stale checkout. Now resolves HEAD to origin/{branch} after fetch,
ensuring the latest pushed code is always compiled.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 14:49:55 +01:00
jgrusewski
76fdd155a1 fix(cuda): compile to native cubin instead of PTX — eliminate driver JIT entirely
nvcc now produces cubin (native SASS) with -cubin -arch=sm_XX instead of
PTX with -ptx -arch=compute_XX. cuModuleLoad() loads SASS directly — zero
driver JIT. TMA instructions (cp.async.bulk on sm_90+) work natively because
nvcc handles them during offline compilation. Removed TMA fallback from
experience collector (double-compile + 15s retry overhead eliminated).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 14:32:53 +01:00
jgrusewski
e807558cd8 fix(infra): remove --initial-capital from train-best step
train_baseline_rl doesn't accept --initial-capital (only hyperopt and
evaluate binaries do). Removing it fixes the exit code 2 in DQN
hyperopt v3 train-best step.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 13:50:46 +01:00
jgrusewski
686f180d7b fix(ppo): pure BF16 dtype alignment across all PPO networks and tensor ops
Cast all Tensor::full() / Tensor::from_vec() call sites to training_dtype
instead of defaulting to F32. Fixes dtype mismatch errors (BF16 vs F32)
in PPO training on CUDA:

- tensor_ops: scalar_mul, clamp, normalize match operand dtype
- trajectories: TrajectoryBatch/MiniBatch to_tensors cast to training dtype
- continuous_ppo: ContinuousTrajectoryBatch/MiniBatch to_tensors cast
- adaptive_entropy: cast entropy to F32 for alpha multiplication boundary
- continuous_policy: forward() input cast, Tensor::full scalars match dtype
- flow_policy: sample_base_noise cast to training dtype
- hidden_state_manager: reset tensors use training_dtype
- ensemble/ppo adapter: predict input cast to training dtype
- trainable_adapter: test uses training_dtype instead of hardcoded F32

Verified: 198/198 ml-ppo tests pass, 63/63 ml PPO tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 13:45:22 +01:00
jgrusewski
910f4bdee3 fix(cuda): dim_overrides before common header in backtest kernel, cap n_episodes at 4096
- backtest_forward_kernel: dim_overrides must precede common_device_functions.cuh
  which has #error guards requiring STATE_DIM/MARKET_DIM/PORTFOLIO_DIM to be
  defined before inclusion. Experience collector already had correct ordering.
- Cap MAX_EPISODES from 8192→4096 (diminishing returns above 4096, wastes walltime)
- Cap trainer .min() from 0x8000 (32768) → 4096 to match

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 13:05:43 +01:00
jgrusewski
92f8cba74a fix(infra): add LD_LIBRARY_PATH stubs filter and env vars to compile-and-train template
The ci-builder image has CUDA stub libraries that shadow real NVIDIA
drivers. Without filtering stubs from LD_LIBRARY_PATH, training binaries
report "CUDA GPU required but none available" even on GPU nodes.

Add to hyperopt, train-best, and evaluate steps:
- LD_LIBRARY_PATH stubs filter (grep -v stubs)
- nvidia-smi verification
- RUST_LOG, SQLX_OFFLINE, CUBLAS_WORKSPACE_CONFIG env vars
- PATH includes /workspace/bin (use binary name, not full path)

Matches the existing pattern in training-workflow-template.yaml.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 12:22:55 +01:00
jgrusewski
08e3b97960 fix(ppo): cast state tensors to training dtype in PPO validation adapters
Fix BF16/F32 dtype mismatch in PpoStrategy and PpoLstmStrategy
validation adapters. Tensor::from_vec(Vec<f32>) creates F32 tensors,
but PPO networks use BF16 weights on H100. Cast state_tensor to
training_dtype() at the boundary before passing to network forward.

Fixes 4 ppo-lib failures on H100:
- test_ppo_strategy_train_and_evaluate
- test_ppo_strategy_reset
- test_ppo_lstm_strategy_train_and_evaluate
- test_ppo_lstm_strategy_reset

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 12:19:15 +01:00
jgrusewski
23a122607d feat(infra): Argo log persistence, network policies, lightweight CI images
- Argo workflow archive via PostgreSQL — persistent logs after pod GC
- Allow Argo controller to reach PostgreSQL via network policy
- Allow Argo server to reach MinIO for S3 log archival
- Replace foxhunt-runtime with lightweight images (alpine:3.21, curlimages/curl)
  in orchestration steps: fetch-binary, upload-results, detect-changes, gpu-warmup
- Use ci-builder for training steps (hyperopt, train-best, evaluate) — nvcc required
- Fix --hyperopt-results → --hyperopt-params flag in train-best step
- Remove invalid podGCGracePeriod from Argo Helm values
- Archive RBAC, kustomization updates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 12:00:46 +01:00
jgrusewski
ca4c38d921 fix(tests): CI GPU test stability, walltime reduction, BF16 tolerance
- Reduce CI GPU test datasets 16x for walltime reduction
- Reduce early-stop epochs 50→10, add --test-threads=1
- Serialize all GPU lib tests to prevent cuBLAS init race
- Align state_dim to 16 for BF16 tensor core HMMA dispatch
- BF16 precision tolerance in ml-dqn tests
- Enable branching DQN + tracing subscriber in smoke tests
- Prevent min_replay_size > buffer_size deadlock in early-stop tests
- Prevent AutoReplaySizer from breaking gradient collapse warmup
- Replace racy tokio::spawn checkpoint counter with AtomicUsize
- Set warmup_steps=0 and max_training_steps_per_epoch=300 in early-stop tests
- RealDataLoader respects TEST_DATA_DIR for CI PVC layout
- Add collapse_warmup_capacity to gpu_smoketest DQNConfig
- Drain CUDA context between test binaries
- Detached HEAD checkout prevents local branch corruption
- GPU pipeline tests: fix BF16 dtype and rank-1 squeeze assertions
- OOD input handling tests use use_gpu: true

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 12:00:13 +01:00
jgrusewski
b4178952d4 fix(ml): BF16/F32 boundary alignment, GPU-resident ops across all ML crates
- Cast input to weight dtype in DQN residual, rmsnorm, noisy_layers
- Set use_gpu=true in QNetworkConfig defaults and all config sites
- Resolve BF16 boundary mismatches in attention, curiosity, branching,
  distributional_dueling across ml-dqn
- GPU-resident regime ops with BF16 boundary casts, eliminate .expect() in CUDA paths
- Eliminate all Device::Cpu fallbacks — GPU-only across 10 ML crates
- PPO: cast logits to F32 before softmax, cast batch tensors to training dtype
- Gradient collapse detection for RegimeConditionalDQN
- Wire halt_grad_collapse from CUDA guard kernel to halt training
- Dead neuron detection uses active network VarMap + squeeze factored readback
- Increment gradient_logging_step in GPU PER path
- Gradient collapse warmup guards use original buffer_size
- Cap training steps per epoch + tracing migration
- Replace Tensor::all() with sum_all() for pinned Candle compatibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 11:59:31 +01:00
jgrusewski
1fae917c22 perf(cuda): H100 kernel optimizations — nvcc pipeline, kernel fusion, GPU-only training
- Migrate from NVRTC JIT to cached nvcc -O3 for all CUDA kernels
- Fuse guard kernels, increase prefetch chunk, eliminate per-step GPU alloc
- H100-specific: fused Adam, warp reductions, shmem tiling, PPO occupancy
- Vectorize gather_states with __ldg() and 4x unroll
- sincosf() Box-Muller + paired Gaussian generation in noisy nets
- Shared-memory tiled branching DQN forward pass for sm_<90
- GPU-resident training guard kernel replacing Candle tensor ops
- Eliminate all to_vec1/to_vec2 CPU roundtrips, DtoD weight copy
- GPU PER mandatory everywhere — kill CPU replay path on CUDA
- Full GPU action masking — eliminate CPU fallback path
- Fix cuBLAS handle sharing via OnceLock (root cause of 49 cascade failures)
- Fix ILLEGAL_ADDRESS: scratch1_dist buffer overflow, stack sizing, curand determinism
- Fix CudaStream lifetime: bind before .context() to extend lifetime
- Keep raw cudarc buffers alive across epochs
- Add gpu-hotpath-guard.sh (37 patterns) and ptx-cache-invalidate.sh

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 11:58:40 +01:00
jgrusewski
76e1010568 docs: add Kanidm SSO + NetBird mesh design spec and implementation plan
Design spec covers OIDC architecture (RS256 JWKS, WebAuthn-first),
7 service integrations, NetworkPolicy, and phased migration strategy.
Implementation plan: 17 tasks across 6 chunks, reviewed 3 rounds
(2 internal + 1 external Gemini 2.5 Pro expert review, all fixes applied).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 19:41:40 +01:00
jgrusewski
8ce29df5cd fix(netpol): fix 3 DOWN Prometheus targets — operator port, reloader ingress, argo label
- Prometheus→operator: egress port 8443→10250 (actual container port)
- Alertmanager ingress: add port 8080 from Prometheus for config-reloader sidecar
- Argo controller metrics service: remove part-of:foxhunt label (already scraped
  via additionalScrapeConfigs with HTTPS; foxhunt-services ServiceMonitor was
  creating duplicate HTTP target → 400)

Result: 25/25 targets UP, 0 DOWN.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 12:52:07 +01:00
jgrusewski
e4870b17b9 fix: tune log levels across workspace — demote noisy warn to debug/trace
Reduce log noise for non-critical operational paths: connection retries,
expected fallbacks, graceful degradation, and optional feature absence.
Keeps warn/error for genuine failures requiring attention.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 11:35:15 +01:00
jgrusewski
dba50fa3be fix(dashboards): update datasource UIDs and folder annotations for Helm Prometheus
Update all dashboard JSON files to use Helm chart's Prometheus datasource
UID and add Grafana sidecar folder annotations for auto-provisioning.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 11:34:14 +01:00
jgrusewski
f3012611f0 feat(monitoring): migrate to kube-prometheus-stack Helm chart
Replace standalone Prometheus/node-exporter/kube-state-metrics with
kube-prometheus-stack Helm chart. Add ServiceMonitor CRDs, PrometheusRule
CRDs (HFT + broker alerts), comprehensive network policies, and wire
AlertManager to Mattermost via incoming webhook.

- Delete old standalone prometheus.yaml, node-exporter.yaml, kube-state-metrics.yaml
- Add prometheus-stack-values.yaml (Helm values with Scaleway Kapsule tuning)
- Add service-monitors.yaml (foxhunt-services + dcgm-exporter ServiceMonitors)
- Add prometheus-rules-hft.yaml and prometheus-rules-broker.yaml (PrometheusRule CRDs)
- Rewrite prometheus network policy for operator-managed pods (DNS, kube-state-metrics,
  operator, alertmanager sidecar, monitoring namespace for DCGM)
- Add alertmanager network policy (Mattermost egress)
- Upgrade Grafana: AlertManager datasource, unified alerting, fix nodeSelector
- Fix Tempo: tolerations for GPU nodes, resource tuning

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 11:33:46 +01:00
jgrusewski
aabc1d95e5 fix(infra): pin workflow-trigger eventsource to platform pool
The eventsource had no nodeSelector and landed on ci-compile-cpu
(POP2-HC-32C-64G, €0.56/hr), blocking autoscaler from scaling it
to 0. Now pinned to platform pool — ci-compile-cpu will autoscale
down, saving ~€410/mo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 09:26:31 +01:00
jgrusewski
dd43316a66 feat(monitoring): add Scaleway infrastructure cockpit dashboard
- Pure-Python scraper replaces shell+Python hybrid (fixes pushgateway
  RemoteDisconnected crash caused by duplicate volume name labels)
- Scraper dynamically discovers all Scaleway resources via API:
  billing, instances, K8s pools, block volumes, IPs
- 40-panel cockpit dashboard with fully dynamic tables (auto-adapts
  when infra changes — no hardcoded instance/volume names)
- Volume table keyed by UUID (not truncated name) to prevent collisions
- Label sanitization for Prometheus text format safety
- Pushgateway push via PUT + Content-Type: text/plain; version=0.0.4

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 03:09:40 +01:00
jgrusewski
1092c931f3 feat(monitoring): add actual Scaleway billing costs, fix Argo counters
- Add scaleway-billing CronJob: hourly scrape of Scaleway Billing API,
  pushes scaleway_billing_total_eur, scaleway_billing_consumption_eur,
  and scaleway_billing_product_eur metrics to pushgateway
- Update Cluster & Costs dashboard with "Actual Costs (Scaleway Billing API)"
  row: Total MTD, Compute, Storage, Network, Registry stats + product
  breakdown bar chart + category pie chart
- Rename existing cost section to "Projected Costs (by node count)"
- Fix Argo Workflows dashboard: use argo_workflows_gauge for
  Succeeded/Failed counts instead of cumulative counters

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 02:38:42 +01:00
jgrusewski
ddf697641a feat(monitoring): add per-service and platform dashboards, reorganize folder structure
- 7 application service dashboards (Services folder): API Gateway, Trading
  Service, Backtesting, Data Acquisition, ML Training, Trading Agent, Web Gateway
- 9 platform dashboards (Platform folder): Prometheus, Grafana, Loki & Promtail,
  Tempo, Redis, PostgreSQL, Argo Workflows, QuestDB, Cluster & Costs
- Cluster & Costs dashboard includes Scaleway node cost estimates (€/hr, €/month)
  for platform, GPU (H100), and CI compile nodes
- Reorganized existing dashboards into 7 folders: CI, Infrastructure, Operations,
  Platform, Services, Trading, Training (dropped "Foxhunt" prefix from titles)
- Rewrote import.sh: removed ConfigMap deployment, switched to API-only imports
  with automatic folder creation and per-dashboard folder mapping
- All 24 dashboards deployed via Grafana API (Postgres-backed)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 02:30:52 +01:00
jgrusewski
6349e384d2 feat(monitoring): add Training Deep-Dive dashboard with unified Prometheus + Loki
74-panel dashboard for in-depth pipeline monitoring. Select a running pod
to see training curves, GPU health (DCGM), eval metrics, CI/Argo workflows,
container resources, and live logs in one place. Stored in Postgres via API
(no ConfigMap restarts needed).

Sections: Job Overview, CI Pipeline & Argo Workflows, CI Logs, Training
Curves, Trading Performance, Evaluation Metrics, GPU & Hardware, Throughput,
Hyperopt Trials, Container Resources, Live Logs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 02:04:24 +01:00
jgrusewski
e5daea44e0 feat(monitoring): add Loki log dashboards for CI and training pipelines
Two new Grafana dashboards powered by Loki:
- CI Pipeline Logs: test gate, clippy, Redis sidecar, build/deploy, errors
- Training Pipeline Logs: epoch/loss, hyperopt trials, GPU/CUDA, walk-forward, data loading

Both use Promtail-extracted labels (level, container, pod) for efficient
stream selection. Collapsible sections keep overview clean while providing
deep drill-down. Variables for pipeline/job type, log level, and text search.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:37:54 +01:00
jgrusewski
ddf1082cb5 Revert "fix(ci): retain completed pods 10 min for log access (CPU only)"
This reverts commit 8e6effb7f6.
2026-03-14 01:10:34 +01:00
jgrusewski
8e6effb7f6 fix(ci): retain completed pods 10 min for log access (CPU only)
Add deleteDelayDuration: 600s to podGC on CPU workflow templates and
sensors (ci-pipeline, compile-deploy, build-image). GPU training
workflows keep immediate cleanup to avoid wasting expensive GPU time.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:10:06 +01:00
jgrusewski
696087b652 perf(ci): reduce smoke test epochs 20→10 for CI deadline compliance
20 epochs × 64 episodes × 200 timesteps = ~62 min per test on H100
with GPU experience collector enabled. Reduce to 10 epochs (~31 min)
to leave headroom for the remaining test suites within the 120-min
workflow deadline. Assertions remain equivalent (5% loss reduction,
Q-value divergence, checkpoint round-trip, walk-forward validation).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 21:16:52 +01:00
jgrusewski
3112e07a5a perf(ci): serialize dqn-pipeline tests to avoid GPU contention
4 concurrent DQN trainers on a shared H100 causes severe GPU contention
(28-39% utilization, 42 GB VRAM). Serializing with --test-threads=1
gives each test full GPU access, reducing total wallclock time despite
sequential execution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 19:52:04 +01:00
jgrusewski
b87b7b4bea fix(ci): correct epsilon assertion for noisy nets + reduce pipeline epochs
The epsilon assertion expected <0.01 (epsilon=0.0 with noisy nets), but
the codebase evolved: noisy_epsilon_floor (0.05) now provides a minimum
exploration rate to prevent action collapse while NoisyNets handle the
primary learned exploration. Updated assertions to match: epsilon < 0.10.

Also reduced pipeline test epochs (10→5, 20→10) to prevent GPU timeout
when 5 concurrent DQN trainers share one H100.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 18:12:43 +01:00
jgrusewski
45eec3f1f2 perf(ci): cap GPU experience collector episodes in integration tests
Reduce per-epoch GPU work from 4M to 12.8K experiences (64 episodes ×
200 timesteps) in CI integration tests. Still exercises the full fused
CUDA kernel (branching+C51+NoisyNets+DSR+fill-sim+N-step) but
completes within CI deadline. Production conservative() defaults
(8192×500) remain untouched.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 16:41:47 +01:00
jgrusewski
0c571c351b fix(cuda): deterministic SHA-256 PTX cache key + extend deadline to 120min
DefaultHasher (SipHash) uses random per-process keys — the PTX cache
would never hit across separate cargo test runs. Switch to SHA-256
(deterministic) so cached PTX persists on the PVC across CI runs.

Also extend activeDeadlineSeconds from 90min to 120min to accommodate
the one-time cold-start NVRTC compilation (30+ min for the fused
experience collector kernel).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 16:16:04 +01:00
jgrusewski
2a44c2813b feat(cuda): PTX disk cache for NVRTC — eliminates 30+ min kernel recompilation
The fused DQN experience collector kernel (4490 lines: branching +
C51 + NoisyNets + fill sim + DSR + N-step) takes 30+ minutes to
compile via NVRTC on H100. This adds a PTX disk cache keyed by
SHA-256(arch, source) in $CARGO_TARGET_DIR/.ptx_cache/ (CI PVC).

Cold start pays the NVRTC cost once; all subsequent runs with
identical source + dimensions load cached PTX in <100ms.

Cache invalidates automatically when kernel source or network
dimensions change (different hash → cache miss → recompile).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 15:23:42 +01:00
jgrusewski
65d441e551 Revert "fix(ci): disable GPU experience collector in integration tests"
This reverts commit 12df39ad51.
2026-03-13 15:20:44 +01:00
jgrusewski
12df39ad51 fix(ci): disable GPU experience collector in integration tests
The fused NVRTC kernel (branching+C51+NoisyNets+DSR+fill-sim) takes
30+ min to compile at runtime on H100, causing CI tests to hit the
90-minute workflow deadline. Disable enable_gpu_experience_collector
in all integration tests that call DQNTrainer::train(). The GPU
experience collector is validated by lib tests (gpu_residency).
Training forward/backward/optimizer still runs on CUDA.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 14:59:40 +01:00
jgrusewski
fefb9e3185 perf(ci): enable opt-level=1 for GPU test builds
Integration tests (e2e DQN training on 148k bars) take 30+ minutes
in debug mode (opt-level=0). CARGO_PROFILE_TEST_OPT_LEVEL=1 enables
basic optimizations for test binaries — requires recompile but tests
run 5-10x faster. Local dev unaffected (env override only in CI).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:34:26 +01:00
jgrusewski
2c9d929777 chore(ci): restore podGC OnPodCompletion after successful validation
Pipeline validated end-to-end on H100: 3/3 steps green, 539 tests pass.
Switch podGC back to OnPodCompletion to auto-clean all pods after runs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 12:55:53 +01:00
jgrusewski
faea94948d fix(tests): skip CPU-replay DQN tests on CUDA builds
7 tests call train_step() via CPU experience replay, but with the cuda
feature GPU PER is mandatory (no CPU path). Mark them
#[cfg_attr(feature = "cuda", ignore)] — the GPU training pipeline
integration tests cover this path properly on H100.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 12:50:23 +01:00
jgrusewski
5b0b5ef917 fix(ci): add LD_LIBRARY_PATH for CUDA runtime, fix git checkout
1. CUDA_ERROR_STUB_LIBRARY: ci-builder image has CUDA stubs ahead of
   real NVIDIA driver libs in LD_LIBRARY_PATH. Prepend
   /usr/local/nvidia/lib64 (device-plugin mount) so real driver is
   found first.
2. Git checkout: `git checkout --force main` stays on local main
   without pulling. Add `git reset --hard origin/$REF` to fast-forward
   branch to latest remote commit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 12:42:30 +01:00
jgrusewski
13e36a14d3 fix(ci): use bash for compile-and-test, fix --nocapture placement
Two bugs in gpu-test-pipeline-template.yaml:
1. /bin/sh doesn't support bash-isms (<<<, read -ra, arrays) used in
   the test runner script. Switch to /bin/bash.
2. --nocapture was appended as a cargo argument instead of a test binary
   argument. Now detects whether -- separator exists in args and places
   --nocapture correctly after it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 12:36:30 +01:00
jgrusewski
5cb9be71e4 fix(infra): add gpu-test egress NetworkPolicy, revert archiveLogs hack
Root cause: default-deny-all blocks egress from gpu-test pods to MinIO,
causing the Argo wait sidecar to hang on log upload. Fix: add egress
policy for gpu-test component (DNS, git, MinIO, Mattermost, registry).
Revert archiveLogs: false — logs should be stored.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 12:20:26 +01:00