Ubuntu14.04TLS
安装openmpi
参考:https://likymice.wordpress.com/2015/03/13/install-open-mpi-in-ubuntu-14-04-13-10/
1、安装依赖项:
sudo apt-get install libibnetdisc-dev
2、下载openmpi的安装包:http://www.open-mpi.org/
我用的是openmpi-2.1.0
3、解压并配置,参考readme或者是install:
shell$ tar xf openmpi-X.Y.Z.tar.gz
shell$ cd openmpi-X.Y.Z
shell$ mkdir build
shell$ cd build
shell$ ./configure --prefix="/home/$USER/openmpi"
上面的那条命令我改为:
shell$ ./configure --prefix=/path/to/openmpi --with-cuda --enable-mpi-thread-multiple
因为我是用来配合集群gpu版caffe的(参考:https://github.com/yjxiong/caffe/issues/9)
4、安装:
make all
sudo make install
5、设置环境变量:
vim ~/.bashrc
加入:
export PATH="$PATH:/path/to/openmpi/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/path/to/openmpi/lib/"
6、测试:(参考:http://www.mamicode.com/info-detail-260108.html)
进入examples文件夹编译hello_c.c示例程序
运行:mpicc -o hello_c hello_c.c
再执行:mpirun -n 4 ./hello_c
没报错的话,就是成功了。