惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
博客园_首页
W
WeLiveSecurity
S
Secure Thoughts
S
Security @ Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page
Project Zero
Project Zero
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
U
Unit 42
N
News and Events Feed by Topic
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Forbes - Security
Forbes - Security
T
Tor Project blog
I
Intezer
B
Blog
F
Full Disclosure
Security Archives - TechRepublic
Security Archives - TechRepublic
F
Fortinet All Blogs
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
AI
AI
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题
Cloudbric
Cloudbric
L
Lohrmann on Cybersecurity
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
P
Privacy International News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
PCI Perspectives
PCI Perspectives
Y
Y Combinator Blog
Spread Privacy
Spread Privacy
Simon Willison's Weblog
Simon Willison's Weblog
罗磊的独立博客
Vercel News
Vercel News
A
Arctic Wolf
The Register - Security
The Register - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
H
Heimdal Security Blog
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed

博客园 - longbigfish

部署(https证书) https证书问题(本地) 参数更新 Ubuntu 24安装Neo4j详细教程 protect 紧急 手机 刷脏页的两种模式 python中的多线程陷阱与pytorch分布式执行机制 git之复合指令和submodule rpc编程示例 cifs远程挂载 使用脚本进入一个命令行控制台,并预设执行的命令列表 cifs挂载远程文件出现 No such device or address错误 longtable 跨越多个页面时,如何在跨页时自动断行并加上横线及去掉页眉 matplotlib中文显示-微软雅黑 latex编译过程-关于嵌入所有字体 python做图笔记 linux启动全过程 连接并同步windows下的git仓库 反向ssh
mpi编程
longbigfish · 2021-12-22 · via 博客园 - longbigfish

主要参考 https://mpitutorial.com/tutorials/mpi-hello-world/

 1.

编译:

mpicc my_mpi_application.c -o my_mpi_application

运行 

 mpirun  -host node0:2,node1,node2 mpi_hello_world

-host 参数指定主机,主机可以加冒号指定核数,默认就是使用一个核。

注意每个主机都要在相同路径下有相同的程序。最方便的就是使用一个共享文件系统。

--

也可以将host写到文件里,然后用 -hostfile 参数指定文件路径。

slots=4 max-slots=4 跟在主机名后面,可以指定该主机可以使用几个核,以及最大有几个核  https://www.open-mpi.org/faq/?category=running

--


Command 'mpirun' not found, but can be installed with:

sudo apt install lam-runtime
sudo apt install mpich
sudo apt install openmpi-bin
sudo apt install slurm-wlm-torque

2.

指定端口指定用户名。

如果要在node0上运行mpi,node1使用10022端口和mm用户名链接。

那么再.ssh 下建立 config文件,内容

Host node1

Port 10022

User mm

3. Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages

根据 https://www.ibm.com/docs/en/smpi/10.2?topic=environment-setting-mca-parameters

/etc/ 目录下有配置文件 

比如/etc/openmpi/openmpi-mca-params.conf

最后一行写上就行

-----

4. 装多个版本的mpi会造成一些问题,比如mpirun  基于mpi4py的 python3的程序会卡主,原因是rank都会是0.

解决办法是清除掉所有mpi,只安装一个版本,openmpi适配mpi4py比较,mpich会有一些问题,比如print不打印。

可以看  /usr/lib/x86_64-linux-gnu/*mpi* ,清空彻底后里面应该没有mpi相关库

libmpich.so 包名叫 libmpich-dev

一般是 openmpi-bin  mpich  libmpi-dev

重装openmpi后记得要pip3 重装 mpi4py,且不能用缓存里的,因为mpi4py会根据系统的mpi下载对应的版本。

5. 老版本跑分布式可能会出现 

Open MPI detected an inbound MPI TCP connection request from a peer that appears to be part of this MPI job

问题,并且卡住。

https://github.com/open-mpi/ompi/issues/5818

mpirun \
    --mca btl_tcp_if_include 10.193.184.0/24 \   
或ip替换为网卡名,可解决