Limiting the cores to use for running a program inside a container

49 Views Asked by At

I wrote an application that runs inside a container and does medium to heavy computation. It also uses the GPU

I am running it on a workstation with a good numbers of cores. I managed to limit the GPUs visible to the container by using the --gpus argument when running the container.

Is there a way that I can limit also the number of cores it uses when operating?

EDIT: I just found about python setting the CPU affinity.

So I guess I can limit the python script to set the affinity to some cores. But if this script calls an external process, is the affinity going to be limited too?

Or as this question asks, is there a way to limit it at the container level?

0

There are 0 best solutions below