MPI 训练之一

root@dcs-977baf93-0:/workspace/pthread# mpic++ t07.cpp -o 2.out

root@dcs-977baf93-0:/workspace/pthread# mpirun -n 4 ./2.out

Hello World from process 1 of 4

Hello World from process 0 of 4

Hello World from process 2 of 4

root@dcs-977baf93-0:/workspace/pthread# mpirun -n 6 ./2.out

Hello World from process 3 of 6

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

= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES

= PID 235 RUNNING AT dcs-977baf93-0

= EXIT CODE: 9

= CLEANING UP REMAINING PROCESSES

= YOU CAN IGNORE THE BELOW CLEANUP MESSAGES

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

YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Killed (signal 9)

This typically refers to a problem with your application.

Please see the FAQ page for debugging suggestions

root@dcs-977baf93-0:/workspace/pthread# mpirun -n 2 ./2.out

Hello World from process 1 of 2

root@dcs-977baf93-0:/workspace/pthread# mpirun -n 1 ./2.out

Hello World from process 0 of 1

root@dcs-977baf93-0:/workspace/pthread# mpic++ t07.cpp -o 2.out

root@dcs-977baf93-0:/workspace/pthread# mpirun -n 1 ./2.out

Hello World from process 0 of 1

root@dcs-977baf93-0:/workspace/pthread# mpirun -n 3 ./2.out

Hello World from process 0 of 3

Hello World from process 1 of 3

Hello World from process 2 of 3

root@dcs-977baf93-0:/workspace/pthread# mpirun -n 4 ./2.out

Hello World from process 2 of 4

Hello World from process 3 of 4

Hello World from process 1 of 4

Hello World from process 0 of 4

root@dcs-977baf93-0:/workspace/pthread# mpirun -n 2 ./2.out

Hello World from process 1 of 2

Hello World from process 0 of 2

root@dcs-977baf93-0:/workspace/pthread#

cpp 复制代码
#include <mpi.h>
#include <stdio.h>


int main(int argc, char** argv) {
    int process_Rank, size_Of_Cluster;

    MPI_Init(&argc, &argv);
    MPI_Comm_size(MPI_COMM_WORLD, &size_Of_Cluster);
    MPI_Comm_rank(MPI_COMM_WORLD, &process_Rank);

    printf("Hello World from process %d of %d\n", process_Rank,
           size_Of_Cluster);
    MPI_Finalize();
    return 0;
}
相关推荐
Darkwanderor7 分钟前
Linux 的权限详解
linux
AI 嗯啦29 分钟前
数据结构深度解析:二叉树的基本原理
数据结构·算法
SabreWulf202035 分钟前
Ubuntu 20.04手动安装.NET 8 SDK
linux·ubuntu·avalonia·.net8
hai_qin37 分钟前
十三,数据结构-树
数据结构·c++
不是吧这都有重名38 分钟前
为什么ubuntu大文件拷贝会先快后慢?
linux·运维·ubuntu
sunshine-sm1 小时前
CentOS Steam 9安装 Redis
linux·运维·服务器·redis·centos
小熊h1 小时前
MySQL集群高可用架构——组复制 (MGR)
linux·数据库·mysql
和光同尘@1 小时前
66. 加一 (编程基础0到1)(Leetcode)
数据结构·人工智能·算法·leetcode·职场和发展
CHEN5_021 小时前
leetcode-hot100 11.盛水最多容器
java·算法·leetcode
songx_991 小时前
leetcode18(无重复字符的最长子串)
java·算法·leetcode