MPI安装
MPICH下载路径 Downloads | MPICH1. 安装过程tar -zxvf mpich-3.1.4.tar.gzcd mpich-3.1.4./configure -prefix=/usr/local/mpich (默认安装目录)make && make install2. 配置环境变量vim ~/.bashrc文件末尾export PATH=/usr/local/mp
MPICH下载路径 Downloads | MPICH
1. 安装过程
tar -zxvf mpich-3.1.4.tar.gz
cd mpich-3.1.4
./configure -prefix=/usr/local/mpich (默认安装目录)
make && make install
2. 配置环境变量
vim ~/.bashrc
文件末尾export PATH=/usr/local/mpich/bin:$PATH
source .bashrc
3. 错误
3.1 gethostbyname failed
查看主机名称(hostname):uname -a
Linux scdzj 2.6.32-696.6.3.el6.x86_64 #1 SMP Wed Jul 12 14:17:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
则第二个字段scdzj是hostname
打开/etc/hosts文件,在127.0.0.1的后面加上hostname,保存退出。
3.2 clion中使用
Cmakelist.Txt
· include_directories(${MPI_INCLUDE_PATH})
· SET(CMAKE_CXX_COMPILER mpicxx)
· SET(CMAKE_C_COMPILER mpicc)
4. Clion配置
Executable:/usr/local/mpich/bin/mpirun
Program arguments: -np 4 ./hello
Working directory: 工程目录cmake-build-debug
更多推荐
所有评论(0)