安装openmpi

1.将openmpi-1.5.tar.gz 文件拷贝到一个临时的目录里面(如tem)
2.解压文件:$tar -zxvf openmpi-1.5.tar.gz
3.进入解压后的目录:$cd openmpi-1.5
4.$ ./configure  --prefix=/home/bjwang/software/openmpi-1.5 CC=icc CXX=icpc F77=ifort FC=ifort

注:要提前建立文件夹/home/bjwang/software/openmpi-1.5
5.$make all install
6. 环境配置:
       首先,vi ~/.bashrc (打开文件.bashrc,按i 进入编辑状态)添加

export PATH=/home/bjwang/software/openmpi-1.5/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/bjwang/software/openmpi-1.5/lib

关闭之后 source ~/.bashrc(使设置起作用,以后再新进入shell 之后直接可以用

安装完成后,进入安装文件包的examples目录,make,编译完测试程序
xxx@linux-xx16:~> cd /home/bjwang/tem/openmpi-1.5/examples
xxx@linux-xx16:~/tem/openmpi-1.5/examples> make
mpicc -g    hello_c.c   -o hello_c
mpicc -g    ring_c.c   -o ring_c
make[1]: Entering directory `/home/bjwang/tem/openmpi-1.2.6/examples'
mpic++ -g    hello_cxx.cc   -o hello_cxx
mpic++ -g    ring_cxx.cc   -o ring_cxx
make[1]: Leaving directory `/home/bjwang/tem/openmpi-1.2.9/examples'
make[1]: Entering directory `/home/bjwang/tem/openmpi-1.2.9/examples'
mpif77 -g hello_f77.f -o hello_f77
mpif77 -g ring_f77.f -o ring_f77
make[1]: Leaving directory `/home/bjwang/tem/openmpi-1.2.9/examples'
make[1]: Entering directory `/home/bjwang/tem/openmpi-1.2.9/examples'
mpif90 -g hello_f90.f90 -o hello_f90
mpif90 -g ring_f90.f90 -o ring_f90
make[1]: Leaving directory `/home/bjwang/tem/openmpi-1.2.9/examples'


最后,测试一下mpirun -np 2  /home/bjwang/tem/openmpi-1.5/examples/hello_f90, 没有出问题应该结果是:

bjwang@linux-xx16:~> mpirun -np 2  /home/bjwang/tem/openmpi-1.2.9/examples/hello_f90
 Hello, world, I am            1  of            2
 Hello, world, I am            0  of            2

注意:openmpi 卸载,可以直接删除安装文件


=======================================

最后只好用云安装了。
http://blog.163.com/shania_song/blog/static/1941912322012275195569/

安装 :$ sudo yum install openmpi openmpi-devel openmpi-libs

安装之后,查看安装位置:

$ whereis oenmpi

openmpi:/usr/lib64/openmpi


配置 :将MPI的bin和lib加入到PATH 和LD_LIBRARY_PATH中去。

打开$HOME/.bash_profile
在最后加上

PATH=$PATH:/usr/lib64/openmpi/bin

LD_LIBRARY_PATH=/usr/lib64/openmpi/lib

保存

注销后登录查看配置结果

$echo $PATH

$echo $LD_LIBRARY_PATH

结果中显示有/usr/lib64/openmpi/lbin和 /usr/lib64/openmpi/lib则为配置成功

你可能感兴趣的:(shell,测试,Path,library)