python mpi学习

可参考:https://docs.it4i.cz/software/mpi/mpi4py-mpi-for-python/
可使用rank获得进程的id号

from mpi4py import MPI
comm = MPI.COMM_WORLD 
print "Hello! I'm rank %d from %d running in total..." % (comm.rank, comm.size)
comm.Barrier() # wait for everybody to synchronize

note: python需要有mpi4py模块。使用以下命令安装:

python -m pip install mpi4py

猜你喜欢

转载自blog.csdn.net/u010454261/article/details/81456667
mpi