Skip to content

Claude parallelisation optimisation - #3

Merged
janaobsteter merged 10 commits into
Futurefrom
future-reduce-globals
Oct 27, 2026
Merged

janaobsteter merged 10 commits into
Futurefrom
future-reduce-globals

Conversation

@janaobsteter

Copy link
Copy Markdown
Owner

Before, we were passing all the information to worker processes in multisessions. That actually broke on HPC because the amount of stuff that should be given to each worker exceeded the memory allocated. Now, each worker only receives the bit that it needs to work on. Still yet to be tested on Eddie.

janaobsteter and others added 10 commits October 13, 2026 14:37
…rsede

createPrevailingVirginQueens_internal() now also takes a Colony, which is
done in the main session without futures; the per-colony work is in
createPrevailingVirginQueen_internal(). swarm() and supersede() use it for
Colony and MultiColony, so all created virgin queens (including csd
homozygous ones) are recorded as virgin queens for a Colony too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
createPrevailingVirginQueens_internal() now does the work for a Colony and,
for a MultiColony, calls itself on each colony (with only the queen) on the
parallel workers via future_mapply(); given ids, it returns the records
instead of adding them to simParamBee. Seeded results are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
createCastePop(), pullCastePop(), and removeCastePop() on a MultiColony now
send colonies to parallel workers with future_mapply(), which has much less
overhead than future_lapply() with plan(multisession) (buildUp() 14.5 -> 7 s,
removeWorkers() 10.5 -> 2.2 s with 1000 colonies and 4 workers). Seeded
results are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@janaobsteter

Copy link
Copy Markdown
Owner Author

I've checked and it all looks good now (I've resolved any issues in the process)

@janaobsteter

janaobsteter commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner Author

This is merging in the speed-up adjustments from Claude.
Mainly, the speed-up came from different looping through MultiColony objects. Before, we looped through multicolony as multicolony[[colony]] - and this validated the MultiColony object in each step. Now, we loop through colonies = MultiColony@colonies by colonies[col], and then add then back in, which avoids multiple object validation.
Another speed-up came from look-up of the caste, for example in reQueen. Every loop call looked up the caste in the SP, now, the lookup is done only once.
When it comes to multithreading, a major improvement came from sending a slim version of SP to workers (without info for past individuals) and from shipping only the part of the colonies they need to work with - no the full MultiColony object.
In the last step, the improvement came from switching from lapply to mapply, which is significantly faster (I don't know the reason).

@janaobsteter
janaobsteter merged commit 65b4efb into Future Oct 27, 2026
1 of 7 checks passed
@janaobsteter
janaobsteter deleted the future-reduce-globals branch October 27, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant