How can I limit a section of code to a single thread?

1 view (last 30 days)
We have multiple MATLAB users on a single server with 80 cores. This is normally not an issue as the majority of our code runs in parfor loops, however there is a section of code that is not within a parfor loop, and it defaults to using all 80 threads, slowing down everyone else's code.
Is there a way to temporarily force a section of code to be single threaded/just a few cores? The current workaround is placing the block of code into a single parfor on its own, but this isn't ideal as not all functionality is available within a parfor.

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!