Running and Verification
Procedure
- Use PuTTY to log in to the server as the root user.
- Verify mpi4py.
cd /path/to/mpi4py
- Create an example.
- Create a test.py file.
vim test.py
- Press i to enter the insert mode and add the following content to the file:
from mpi4py import MPI comm = MPI.COMM_WORLD rank = comm.Get_rank() print ('My rank is ', rank) - Press Esc, type :wq!, and press Enter to save the file and exit.
- Create a test.py file.
- Perform the verification.
mpirun --allow-run-as-root -np 4 python3 test.py
Information similar to the following is displayed:

Parent topic: mpi4py 3.1.3 Porting Guide (Kylin V10)