MPI的全称是Message Passing Interface即标准消息传递界面,可以用于并行计算。MPI有多种实现版本,如MPICH, CHIMP以及OPENMPI。这里我们采用MPICH版本。

一、MPICH安装

下载:http://www.mpich.org/static/downloads/3.0.4/mpich-3.0.4.tar.gz

tar -xzvf soft/mpich-3.0.4.tar.gz
cd mpich-3.0.4/
./configure --prefix=/usr/local/mpich
make && make install

这里提示权限不够,用

chmod 777 /usr/local

安装后加入环境变量/etc/profile,并执行 source
/etc/profile

PATH=$PATH:/usr/local/mpich/bin
MANPATH=$MANPATH:/usr/local/mpich/man
export PATH MANPATH

二、单节点测试

复制源代码包下的examples目录到安装目录下

cp -r examples/ /usr/local/mpich

执行

mpirun -np 10 ./examples/cpi

输出结果如下:

Process 0 of 10 is on server150
Process 9 of 10 is on server150
Process 1 of 10 is on server150
Process 4 of 10 is on server150
Process 5 of 10 is on server150
Process 7 of 10 is on server150
Process 2 of 10 is on server150
Process 3 of 10 is on server150
Process 6 of 10 is on server150
Process 8 of 10 is on server150

pi is approximately 3.1415926544231256, Error is 0.0000000008333325
wall clock time = 0.020644

如果我们现在想编译文件: 在/home/houqingdong下执行:  mpicc -o hello  hello.c  这时候会提醒:-bash:mpicc  command not found 这是因为我们还没有配置路径

在命令行下输入: export PATH=/home/houqingdong/mpiexe/bin:$PATH   注意:这里仅仅是暂时的设置路径,在重启后效果会消失,如果想一劳永逸的配置,请google查询

看一下我们配置是否成功可以执行一下  echo $PATH 看一下输出结果中是否有我们的路径

这里不知道为什么运行计算PI 的程序会只有执行了一个进程,

手动编译范例下面的hellow范例,这次是正确的

问了博士助教,最后检查出来是因为下载的文件中自带的编译后的可执行程序是错的

用mpicc -0 cpi cpi.c

再编译一次就好了

【转&改进】Linux MPI 单机配置的更多相关文章

  1. Linux MPI环境配置

    参考:https://blog.csdn.net/lusongno1/article/details/61709460 注意点: 1. /etc/profile.d/user.sh和/etc/ld.s ...

  2. Hadoop - 操作练习之单机配置 - Hadoop2.8.0/Ubuntu16.04

    系统版本 anliven@Ubuntu1604:~$ uname -a Linux Ubuntu1604 4.8.0-36-generic #36~16.04.1-Ubuntu SMP Sun Feb ...

  3. Data - Hadoop单机配置 - 使用Hadoop2.8.0和Ubuntu16.04

    系统版本 anliven@Ubuntu1604:~$ uname -a Linux Ubuntu1604 4.8.0-36-generic #36~16.04.1-Ubuntu SMP Sun Feb ...

  4. hadoop单机配置

    条件: 先下载VMware1.2,然后安装. 下载ubuntu-1.4.05-desktop-amd64.iso.下载地址:http://mirrors.aliyun.com/ubuntu-relea ...

  5. 深入linux kernel内核配置选项

    ============================================================================== 深入linux kernel内核配置选项 ...

  6. DHCP原理与LINUX下的配置

    DHCP原理与LINUX下的配置 目录 DHCP原理与LINUX下的配置 一.DHCP工作原理 1.DHCP概述 2.DHCP的优势 3.DHCP的分配方式 (1)自动分配 (2)手动分配 (3)动态 ...

  7. 在Linux虚拟机下配置tomcat

    1.到Apache官网下载tomcat http://tomcat.apache.org/download-80.cgi 博主我下载的是tomcat8 博主的jdk是1.8 如果你们的jdk是1.7或 ...

  8. 在Linux虚拟机下配置jdk的环境变量

    1.到Oracle公司的官网里下载好jdk,网址 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133 ...

  9. Linux网络属性配置

    目录 IP地址分类 如何将Linux主机接入到网络中 网络接口的命名方式 ifcfg系列命令 如何配置主机名 如何配置DNS服务器指向 iproute2系列命令 Linux管理网络服务 永久生效配置路 ...

随机推荐

  1. Linux stress CPU的测试方法

    一.stress工具安装:1.获取stress源码安装包(stress-1.0.4.tar.gz)3.解压并安装 [root@localhost /]#cd /tmp/ [root@localhost ...

  2. SecureCRT sftp上传文件报错:put: failed to upload xxx 拒绝访问

    1.问题 使用sftp上传文件时报错:put: failed to upload xxx 拒绝访问.类似下图所示: 2.原因 造成这个问题的原因可能有两个,一是要上到的那个目录剩余磁盘空间不足,二是打 ...

  3. httpd.conf文件格式解析

    apache http server,俗称apache,程序名httpd,默认配置文件/etc/httpd/conf/httpd.conf:该文件通过其中的Include conf.d/*.conf指 ...

  4. qml 设置tooltip,Customizing ToolTip

    Button {            id: btn            text: "Tip"            anchors.horizontalCenter: pa ...

  5. centos6.5 安装php-5.6.31

    1 从PHP官网下载所需要的PHP版本 下载地址:  http://php.net/get/php-5.6.31.tar.gz/from/a/mirror  把下载好的文件上传到服务器 2 安装PHP ...

  6. UVa LA 3213 - Ancient Cipher 水题 难度: 0

    题目 https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_pr ...

  7. bzoj1717

    题解: 二分答案 然后hash 代码: #include<bits/stdc++.h> using namespace std; ,P2=,P=; int a1[P],num[P],a2[ ...

  8. 愛拼才會贏--IPA--闽南语

    闽南语经典曲目.

  9. (C/C++学习笔记) 二十二. 标准模板库

    二十二. 标准模板库 ● STL基本介绍 标准模板库(STL, standard template library): C++提供的大量的函数模板(通用算法)和类模板. ※ 为什么我们一般不需要自己写 ...

  10. Cracking The Coding Interview 4.1

    //Implement a function to check if a tree is balanced. For the purposes of this question, a balanced ...