# limit number of threads used by Paraview

**URL:** https://discourse.paraview.org/t/limit-number-of-threads-used-by-paraview/1241
**Category:** ParaView Support
**Created:** [February 6, 2019, 11:30am UTC](https://discourse.paraview.org/t/limit-number-of-threads-used-by-paraview/1241 "2019-02-06T11:30:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![eric](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@eric](https://discourse.paraview.org/u/eric)
#### Post date: [February 6, 2019, 11:30am UTC](https://discourse.paraview.org/t/limit-number-of-threads-used-by-paraview/1241/1 "2019-02-06T11:30:04Z")

</div>

Hi,

I am currently trying out Paraview 5.6.0 (with OpenGL and OSPRay 1.7.3 support) on a machine sharing ressources with multiple users - client/server on the same machine.  
I could limit the number of thread used by OSPRay rendering using OSPRAY\_THREADS environment variable however I do not know if it is possible to do the same with Paraview itself (or VTK) - to get more control over resource usage.

Thanks.  
Eric

---

<div class="post-metadata">

### Author: ![mconti](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mconti/32/2168_2.png) [@mconti](https://discourse.paraview.org/u/mconti)
#### Post date: [March 13, 2020, 2:55pm UTC](https://discourse.paraview.org/t/limit-number-of-threads-used-by-paraview/1241/2 "2020-03-13T14:55:08Z")

</div>

Hey Eric, my company had this same problem. Use both KNOB\_MAX\_WORKER\_THREADS and OSPRAY\_THREADS as environmental variables to cap CPU threads and memory usage. We have noticed that it will actually speed up your simulations as well since there won’t be an i/o hit from constantly changing number of threads.

#!/bin/bash  
NP=$1  
export KNOB\_MAX\_WORKER\_THREADS=$NP  
export OSPRAY\_THREADS=$NP  
echo $KNOB\_MAX\_WORKER\_THREADS
