集群上mpi的使用

mpi跑程序,需要每个节点都安装吗?

不需要的,是通过设置节点共享目录:

/home,/opt,/share等。

The classic NFS approach to a shared directory is to export a directory from the master node to the compute nodes.

http://www.admin-magazine.com/HPC/Articles/Building-an-HPC-Cluster

实现方式有OpenMPI, mpich,以及intel MPI,后者还支持gcc

mpicc -v (instead of --version)可以显示当前的mpi版本和icc版本。

mpicc -show可以看出mpicc只是对gcc或icc的一个包装。

“有的计算机厂商,也会针对旗下机型特点,自主开发基于MPICH的MPI软件,从而使机器的并行计算效率得以提高。”说的就是各种超算机器和intel吧。

yhrun(srun)其实跟mpirun一样的效果。

openmpi可以直接运行程序:

http://mpitutorial.com/tutorials/mpi-hello-world/

例子hello_world.c,发现mpirun可以识别真正的物理核心。

mpirun -np 13 -f host_file ./mpi_hello_world

其中host_file:

compute-0-1

compute-0-2

会发现除了调用compute-0-1,还会调用compute-0-2,<=12的时候不调用compute-0-2。

mpirun -np x 中的x可以大于线程数目,系统会在一个逻辑核心上再虚拟出多个线程:

https://stackoverflow.com/questions/5797615/mpi-cores-or-processors

mpirun的程序./mpi_hello_world是用同一个版本的mpicc编译的。

猜你喜欢

转载自www.cnblogs.com/ysh-song/p/10153084.html
mpi
今日推荐