Repository navigation
spreadFitNP: a single number of cores is the population size - #137
Merged
Merged
Conversation
clusterSetup() builds `cores` workers for a numeric cores above 1 and sets NP to them, but spreadFitNP() gave nCoresNeeded or the default, so with 3 parameters and cores = 40L the emulator and the start population had 30 rows and the fit stopped at its start. fitSpread() now takes its start-population rows from spreadFitNP() (at least NP, still at least 10 per parameter). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
eliotmcintire
added a commit
that referenced
this pull request
Nov 18, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A spread fit with few parameters, run with a fixed number of workers, stopped at its start. Its starting population had fewer members than there were workers.
Affects: fits with
coresset to a number above 1 (e.g.cores = 40L) or to a host name repeated (e.g.rep("mega", 40)) now start; distinct host names,cores = 1Land fits whose start population already had enough rows are unchanged.Depends-on: PredictiveEcology/clusters#72
Technical details
Defect:
R/fitSpread.RspreadFitNP()(was lines 172-176) gavenCoresNeeded, elsedeoptimPopulationSize(length(lower)).clusters::clusterSetup()buildscoresworkers for a number above 1 or a repeated host, and.clusterNP()sets NP to them. With 3 parameters andcores = 40Lthe emulator and the start population had 30 rows, and.fitInitialpopToNP()stopped: "initialpop has 30 rows but the population (the number of workers) is 40" (GPSC 2026-11-17, null arm, ELFs 14.3, 11.3). The first version of this PR restated the numeric rule and missed repeated hosts (rep("mega", 40): 40 workers,spreadFitNP()gave 30).Fix:
spreadFitNP()returnsclusters::requestedWorkers(P(sim)$cores, nCoresNeeded), withnCoresNeededthe parameter ordeoptimPopulationSize(length(lower)). That function is the ruleclusterSetup()uses (clusters PR #72), including themaxWorkersPerHostcap. NULL or NAcores(no cluster) givesnCoresNeededas before.fitSpread()'s start-population size ismax(10 * length(lower), spreadFitNP(sim)): clusters uses the first NP rows, so only "at least NP" matters, and the max keeps a fit'sinitialpop, and so its cache key, unchanged for current ELFs (10-12 parameters, 120 rows).reqdPkgsnow hasclusters@development (>= 0.0.95), the version after #72 is merged and bumped.fitSpread.R:122still passesP(sim)$nCoresNeeded(not NP) torunDEoptim(); left as is because it is part of the fit's cache key, and clusters ignores it whencoresfixes the count.Reuses:
clusters::requestedWorkers(),fireSenseUtils::deoptimPopulationSize(),startPopulation(),spreadFitNP()(the one source of NP for the fit, the emulator andprofileLedgerFit()); new: none.Tests:
tests/testthat/test-nCoresNeeded.Rhas the existing cases pluscores = rep("hostA", 40)with 3 parameters (emulator NP 40, 40 rows, start population of at least 40 rows),spreadFitNP()for repeated hosts, NULL and NAcores.convertToPackage()+test_local()on a copy (BLAS/OMP threads 1, scratch library with clusters #72 built as 0.0.95 first, fireSenseUtils 0.2.3.9177 from a read-only run library): previous code with the new tests 4 failed, the new tests (the old code's other tests pass); branch 0 failed, 0 skipped, 1310 passed.🤖 Generated with Claude Code
https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6