I'm currently facing a problem and I need your help! So I have a code that will call a Linux Terminal command from a python code. But, I also have some part of the code that needs to be run in parallel to accelerate the computation.
Roughly, the code (say, the name is code.py) will looks like this:
import parallel_func, cli_func
parallel_func() #this part is supposed to run in parallel when using mpirun
cli_func() #this part is supposed to run without mpi
The problem is, if I run mpirun -np 4 python code.py, the parallel_func will do well, but the cli_func will run multiple cli_program that will overburden the cpu.
So, are there any way I can do to isolate that cli_func part from the MPI?
Thank you for your help!
edit: I've did the solution that tobias replied below (using mpi rank selection) but it results in running one rank with the cli_func with the rest of the cpu still running, limitting the usable processor for the cli program.
edit: I found the makeshift solution using this mpi4py: substantial slowdown by idle cores That fixed it all!