mpich环境设置

来源:互联网 发布:md5加密 java 编辑:程序博客网 时间:2024/06/16 15:20

mpich环境设置

下载与安装

wget -c http://www.mpich.org/static/downloads/3.2/mpich-3.2.tar.gztar zxvf mpich-3.2.tar.gz./configure --prefix=/opt/mpichmakesudo make install

设置环境变量

$ export PATH=/opt/mpich/bin:$PATH$ export LD_LIBRARY_PATH=/opt/mpich/lib/:$LD_LIBRARY_PATH

并且修改 ~/.bashrc 文件

PATH=/opt/mpich/bin:$PATHLD_LIBRARY_PATH=/opt/mpich/lib/:$LD_LIBRARY_PATHexport PATH LD_LIBRARY_PATH

运行MPI作业

在mpich源代码目录下的examples目录下,运行

$ mpiexec -f hosts -n 4 cpiProcess 0 of 4 is on test1Process 1 of 4 is on test1Process 2 of 4 is on test2Process 3 of 4 is on test2pi is approximately 3.1415926544231239, Error is 0.0000000008333307wall clock time = 0.014642

或者运行

$ mpicc -o hello hellow.c$ mpirun -np 3 ./hello$ mpiexec -hosts test1,test2 -np 4 ./hello$ mpiexec -hosts test1:2,test2:2 -np 4 ./hello$ mpiexec -f <hosts file> -n 4 ./hello

其中 hosts file 格式如下:

test1:2test2:2

转载请以链接形式标明本文链接
本文链接:http://blog.csdn.net/kongxx/article/details/52247431

0 0
原创粉丝点击