Skip to content

Conversation

juj
Copy link
Collaborator

@juj juj commented Sep 5, 2025

Do not halve the number of used cores if the user has explicitly specified the number of cores to use in testing.

It is a bit silly to have to say export EMTEST_CORES=128 to get 64 cores in actuality.

…ified the number of cores to use in testing.

def cap_max_workers_in_pool(max_workers, is_browser):
if is_browser:
if is_browser and os.getenv('EMTEST_CORES') is None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should maybe just no call cap_max_workers_in_pool in the case of EMTEST_CORES being set.

Also IIUC EMCC_CORES will also be used if EMTEST_CORES is not specified, so I think we would need to test both.

How about

# If a user explicitly asks for number of cores, don't artificially cap it.
if 'EMTEST_CORES' in os.environ or `EMCC_CORES` in os.environ:
  return max_workers

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should maybe just no call cap_max_workers_in_pool in the case of EMTEST_CORES being set.

In case of the capping to max 61 cores, I think that is a good idea, because it shields the user from Python crap, which a developer might not be aware of.

I.e. say a user is using EMCC_CORES=64 and it is hanging on Windows due to the Python bug, then they have no real way of discovering that having specified > 61 cores is the cause, and our workaround will go lost on them. So it is better to force the 61 cores here, even if user sets a higher number.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing both EMCC_CORES and EMTEST_CORES sounds fine, updated.

@juj juj enabled auto-merge (squash) September 5, 2025 22:19
@juj juj disabled auto-merge September 6, 2025 08:40
@juj juj merged commit 80ca182 into emscripten-core:main Sep 6, 2025
28 of 30 checks passed
@brendandahl
Copy link
Collaborator

I think we need to adjust circleci now. We specify EMCC_CORES=4 (though there are only 2 cores on a medium instance). Before this change we had two runners going, but now there are 4.

@sbc100
Copy link
Collaborator

sbc100 commented Sep 8, 2025

I think we need to adjust circleci now. We specify EMCC_CORES=4 (though there are only 2 cores on a medium instance). Before this change we had two runners going, but now there are 4.

Sounds like the right fix yes.

@juj
Copy link
Collaborator Author

juj commented Sep 8, 2025

Oh I see, the CircleCI runners explicitly used EMCC_CORES to oversubscribe over the hardware threads? Let me post a PR.

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.

3 participants