What are you useing for a threading tool?
What operating system?
If OpenMP, you can seta restriction using environment variable
Or at compile tile
Or at run time
Also, on Windows and Linux you can restrict the number of cores available to a process (applicaiton).
(you will have to look that one up)