I have a runscript.py file that outputs a lot of stdout on the terminal. I run the script from command line using mpirun -n 8 python runscript.py >> analysis.log which redirects the stdout to analysis.log file.
Instead of running the script from command line, I am using MPI.COMM_WORLD.Spawn(sys.executable, args=["runscript.py"], maxprocs=8) from another script. I want to redirect stdout from only the spawned process and not from the main script. Is there a way to redirect stdout to a file from child processes spawned using MPI.COMM_WORLD.Spawn() method?
OpenMPI: 4.0.7
mpi4py: 3.1.3