MPI enables running parallel tasks across the vCPUs available in your computational resource. When executing a simulation or computation with MPI, you typically specify the number of processes (-np) corresponding to the number of parallel processes you want.
Example MPI command structure:
mpirun -np <number_of_processes> <program>
By default, MPI detects only physical cores, not hyper-threaded vCPUs. This can cause issues when requesting more workers than physical cores, because MPI does not automatically account for hyper-threaded threads.
For example, a computational resource with 4 vCPUs but only 2 physical cores will cause MPI to report There are not enough slots available unless explicitly told to use hardware threads.
To enable MPI to use hyper-threaded vCPUs, add the flag --use-hwthread-cpus:
mpirun -np <number_of_processes> --use-hwthread-cpus <program>
This tells MPI to include hyper-threaded CPUs as valid execution slots, enabling full use of all vCPUs.
Note: With Inductiva this is the default behaviour. If you don't specify otherwise, we will run your simulation using all available vCPUs with hyper-threading turned on.
--use-hwthread-cpus: MPI schedules one task per physical core only.--use-hwthread-cpus: MPI schedules tasks on all vCPUs, starting with physical cores and then using hyper-threaded cores if needed.Example: On a computational resources with 2 physical cores (4 vCPUs):
mpirun -np 2 --use-hwthread-cpus ... → uses only physical cores.mpirun -np 4 --use-hwthread-cpus ... → uses all vCPUs.If your computational resources is configured with threads_per_core=1, hyper-threading will be disabled and so only one vCPU per physical cores will be available.
--use-hwthread-cpus has no effect.threads_per_core.--use-hwthread-cpus allows MPI to use hyper-threaded vCPUs.