第一步 安装SSH服务器和客户端
$ sudo apt-get install openssh-client openssh-server 第二步 安装MPICH
$ sudo apt-get install mpi-bin mpi-doc libmpich1.0-dev 第三步 程序测试 $ touch hello.cpp code:
#include \"mpi.h\" #include int main(){ int rank; int size; MPI_Init(0,0); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size); std::cout<<\"Hello world from process \"< return 0; } 第四步 编译链接 mpicxx -o hello.out hello.cpp 第五步 启动并行环境 mpdboot 如果提示错误,按如下方法解决: cd $HOME touch .mpd.conf chmod 600 .mpd.conf then run the command 'mpdboot' again 第六步 使用两个 node 运行程序 mpirun -n 2 ./hello.out 下列命令也可: mpiexec -n 2 ./hello.out mpiexec -np 2 ./hello.out mpirun -np 2 ./hello.out 我运行该程序的结果如下: Hello world from process 0 of 2 Hello world from process 1 of 2 最后 停止并行运行环境 mpdcleanup 因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- yrrf.cn 版权所有 赣ICP备2024042794号-2
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务