Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support negative values on nthreads #4534

Closed
wants to merge 3 commits into from

Conversation

virtualritz
Copy link

@virtualritz virtualritz commented Nov 12, 2024

Description

This makes nthreads accept negative numbers to mean m_pool->size() + nthreads. I.e. on a 16 core machine specifying nthreads as -2 would make OIIO use 14 cores.
If m_pool->size() < -nthreads the result is clamped at 1. I.e. a single thread would be used.

On that note: the original resolve() does not have a check for the case where m_maxthreads > m_pool->size() and should possibly be clamped to the latter, if so. I kept it that way. Is that intended/a feature or an oversight?

Tests

Checklist:

  • I have read the contribution guidelines.
  • I have updated the documentation, if applicable.
  • I have ensured that the change is tested somewhere in the testsuite
    (adding new test cases if necessary).
  • If I added or modified a C++ API call, I have also amended the
    corresponding Python bindings (and if altering ImageBufAlgo functions, also
    exposed the new functionality as oiiotool options).
  • My code follows the prevailing code style of this project. If I haven't
    already run clang-format before submitting, I definitely will look at the CI
    test that runs clang-format and fix anything that it highlights as being
    nonconforming.

Copy link

linux-foundation-easycla bot commented Nov 12, 2024

CLA Signed


The committers listed above are authorized under a signed CLA.

@virtualritz virtualritz closed this by deleting the head repository Nov 12, 2024
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