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編譯的。