You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature: heterogeneous parameter sweeps (vary instance-type per sweep entry) #372
Use case: a price-performance benchmark that runs the same workload across different instance types — e.g. GROMACS on c8i / c8a / c8g / g6 / g6e / g7e, each on its own instance, then compares ns/$. This is a natural 'sweep', but each entry needs a different --instance-type.
Today:spawn launch --param-file / --cartesian sweeps and --count job arrays are homogeneous — one --instance-type for the whole sweep, varying only workload params passed to --command. autoscale launch is likewise single-type. So a heterogeneous matrix can't be expressed as one spawn sweep; the caller must fall back to N independent spawn launch calls and orchestrate concurrency/teardown themselves.
Ask: let the param-file/sweep vary instance_type (and ideally ami, spot) per entry, so a single sweep can fan out across instance families. Concretely, a param-file row like:
where instance_type (if present) overrides the top-level --instance-type for that entry, and the rest are --command template vars as today.
Why it belongs in spawn: spawn already owns the hard parts — concurrent provisioning, per-instance IAM/VPC/SG, budget caps (--budget), Lambda-detached orchestration, lifecycle teardown. A caller reimplementing fan-out in a local thread pool loses all of that and hits contention (I deadlocked a 12-wide ThreadPoolExecutor of spawn connect sessions; the autonomous --command pattern works but I'm hand-rolling the matrix orchestration spawn could own).
Workaround in use: autonomous cells via spawn launch --command <job> per instance type + poll for completion out-of-band (S3). Works, but a native heterogeneous sweep would replace the hand-rolled coordinator entirely.
Looked into this — good news: the per-entry override is already mostly implemented, and it's closer to done than the issue assumes. Here's the assessment.
What already works
buildLaunchConfigFromParams (cmd/sweep.go) already reads instance_type, ami, spot, region, az (and ~20 other fields) per param entry and sets them on that entry's LaunchConfig. So a param-file row like:
already produces per-entry instance types today. The parser is map[string]interface{}, so no schema change is needed.
Two real gaps that make it not actually work heterogeneously
Heterogeneous AMIs are broken (the blocker).launchParameterSweep (cmd/launch_sweep.go:174) detects the AMI once from firstConfig.InstanceType and applies it to every config that lacks one:
GetRecommendedAMIis arch/GPU-aware (DetectArchitecture + DetectGPUInstance), but it's only called for the first entry. So a c8g (arm64) or g7e (GPU) entry in a sweep led by an x86 c8i gets an x86 non-GPU AMI → fails to boot / wrong arch. Fix: call GetRecommendedAMI per-config (keyed by each cfg.InstanceType), only for configs with no explicit ami. Cache by (region, arch, gpu) to avoid redundant SSM lookups.
No top-level --instance-type fallback for entries that omit it. The loop copies baseConfig.Region/Name onto entries that lack them, but not InstanceType (cmd/launch_sweep.go:123-129). So a mixed file where some rows set instance_type and some rely on the CLI default would give the defaulted rows an empty type. Fix:if config.InstanceType == "" { config.InstanceType = baseConfig.InstanceType } alongside the existing Region fallback. Same for TargetOS, which is likewise resolved once from firstConfig.
Also worth checking
launchSweepDetached (the Lambda-orchestrated path) groups by region and may have the same single-AMI assumption — needs the same per-entry AMI fix.
OS resolution (resolveTargetOS from firstConfig) — fine as long as a sweep doesn't mix Windows+Linux; worth a guard/doc note rather than support.
Scope to close this
Small, contained: (a) per-config AMI detection with a memo cache, (b) InstanceType/TargetOS base fallback, (c) same in the detached path, (d) a heterogeneous example in guides/parameter-sweeps.md (the price-performance-benchmark use case), (e) tests with a mixed x86/arm64/GPU param file asserting each config gets an arch-appropriate AMI. No new flags, no param-file format change.
Activity
scttfrdmn commentedon Jul 19, 2026
Looked into this — good news: the per-entry override is already mostly implemented, and it's closer to done than the issue assumes. Here's the assessment.
What already works
buildLaunchConfigFromParams(cmd/sweep.go) already readsinstance_type,ami,spot,region,az(and ~20 other fields) per param entry and sets them on that entry'sLaunchConfig. So a param-file row like:[{"instance_type": "c8g.24xlarge", "IMG": "...:arm-sve"}, {"instance_type": "g7e.2xlarge", "IMG": "...:cuda"}]already produces per-entry instance types today. The parser is
map[string]interface{}, so no schema change is needed.Two real gaps that make it not actually work heterogeneously
Heterogeneous AMIs are broken (the blocker).
launchParameterSweep(cmd/launch_sweep.go:174) detects the AMI once fromfirstConfig.InstanceTypeand applies it to every config that lacks one:GetRecommendedAMIis arch/GPU-aware (DetectArchitecture+DetectGPUInstance), but it's only called for the first entry. So ac8g(arm64) org7e(GPU) entry in a sweep led by an x86c8igets an x86 non-GPU AMI → fails to boot / wrong arch. Fix: callGetRecommendedAMIper-config (keyed by eachcfg.InstanceType), only for configs with no explicitami. Cache by (region, arch, gpu) to avoid redundant SSM lookups.No top-level
--instance-typefallback for entries that omit it. The loop copiesbaseConfig.Region/Nameonto entries that lack them, but notInstanceType(cmd/launch_sweep.go:123-129). So a mixed file where some rows setinstance_typeand some rely on the CLI default would give the defaulted rows an empty type. Fix:if config.InstanceType == "" { config.InstanceType = baseConfig.InstanceType }alongside the existing Region fallback. Same forTargetOS, which is likewise resolved once fromfirstConfig.Also worth checking
launchSweepDetached(the Lambda-orchestrated path) groups by region and may have the same single-AMI assumption — needs the same per-entry AMI fix.resolveTargetOSfromfirstConfig) — fine as long as a sweep doesn't mix Windows+Linux; worth a guard/doc note rather than support.Scope to close this
Small, contained: (a) per-config AMI detection with a memo cache, (b)
InstanceType/TargetOSbase fallback, (c) same in the detached path, (d) a heterogeneous example inguides/parameter-sweeps.md(the price-performance-benchmark use case), (e) tests with a mixed x86/arm64/GPU param file asserting each config gets an arch-appropriate AMI. No new flags, no param-file format change.Happy to implement if you want it prioritized.
Heterogeneous sweeps (#372) + GPU auto-AMI fix (#384) (#383)
fix: --estimate-only on a sweep estimates instead of launching (#524)
fix: --estimate-only on a sweep estimates instead of launching (#524) (…
fix(sweep): a detached sweep launched zero instances and reported suc…
fix(sweep): a detached sweep launched zero instances and reported suc…