How to limit CPU threads and memory usage in client/server mode

Hey everyone, as some of you are already aware, when using Paraview with OSPRay enabled in client/server mode if will EAT up memory and CPU usage. We have found that on server side it will eat up 4-5 times the memory it needs and use all CPU’s threads it can. After talks with some Kitware developers there is an easy fix that I figured I would make a bit more well known.

You can pass 2 environmental variables to the server that limit the number of threads that PV/OPSRay can take up. This does two great things in one. First it caps the CPU threads you can grab, but also seems to have a speed increase as well (we believe this is to not having an i/o hit because of constantly changing number of threads). Additionally, it greatly reduces the amount of memory the simulation will take up, although I’m not 100% sure why this is the case.

Thus, if you are using C/S mode (especially with OSPRay enabled), I highly suggest setting these variables to something reasonable. Here is a super simple bash script that does it.


Hope this helps someone, it has been a big help for my company.

1 Like