Skip to content

Default CTranslate2 intra threads to 1 on macOS - #528

Open
jmpnop wants to merge 1 commit into
argosopentech:masterfrom
jmpnop:fix-darwin-intra-threads-default
Open

Default CTranslate2 intra threads to 1 on macOS#528
jmpnop wants to merge 1 commit into
argosopentech:masterfrom
jmpnop:fix-darwin-intra-threads-default

Conversation

@jmpnop

@jmpnop jmpnop commented Jun 7, 2026

Copy link
Copy Markdown

Summary

Default ARGOS_INTRA_THREADS to 1 on Darwin instead of 0.

This keeps the existing behavior on non-macOS platforms and still allows users to override the value explicitly with ARGOS_INTRA_THREADS.

Why

On macOS no-OpenMP CTranslate2 wheels, intra_threads=0 delegates to the backend default. In local testing with Argos Translate + CTranslate2 on macOS arm64, that backend auto-threading path fanned out into CPU worker pools and performed poorly for Argos' typical workload of many small paragraph/sentence translation batches.

It also reproduced a native abort on CTranslate2 4.7.2 / Python 3.14.5:

libc++abi: terminating due to uncaught exception of type std::__1::system_error:
condition_variable wait failed: Invalid argument

The crash report showed:

BS::thread_pool_light::worker()
std::__1::condition_variable::wait(...)
ctranslate2::python::TranslatorWrapper::translate_batch(...)

Validation

Environment:

macOS 26.5.1 arm64
Python 3.14.5
Argos Translate current settings module
CTranslate2 4.8.0
English -> Russian Argos model

Benchmark on the same 30-unit Markdown slice:

intra=0  TIMEOUT >60s
intra=1  elapsed=31.012s user=36.103s  sys=0.120s
intra=2  elapsed=48.529s user=84.297s  sys=19.564s
intra=4  elapsed=38.526s user=139.771s sys=28.153s
intra=8  elapsed=37.895s user=275.805s sys=28.084s

Full sustained regression with intra_threads=1:

units 749
chars 197463
ALL DONE 749 791.3

This makes 1 a safer and faster Darwin default for the tested Argos workload while preserving explicit user control.

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