大多数 MPI 程序都可以使用命令 mpiexec 运行。在实践中,运行 Python 程序如下所示:
$ mpiexec -n 4 python script.py
案例1:测试comm.send 和comm.recv函数,代码如下
from mpi4py import MPI comm = MPI.COMM_WORLD rank = comm.Get_rank() if rank == 0
京公网安备 11010502049817号