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;
}
相关推荐
虾稿10 分钟前
[手机Linux] 七,NextCloud优化设置
linux·运维·服务器
首发运维12 分钟前
centos 释放系统预留内存并关闭Kdump服务
linux·运维·centos·linux操作系统问题
Kenneth風车19 分钟前
【机器学习(九)】分类和回归任务-多层感知机(Multilayer Perceptron,MLP)算法-Sentosa_DSML社区版 (1)11
算法·机器学习·分类
新子-存在了21 分钟前
linux中 mysql备份
linux·运维·mysql
最后一个bug23 分钟前
rt-linux中使用mlockall与free的差异
linux·c语言·arm开发·单片机·嵌入式硬件·算法
ZHOUPUYU23 分钟前
VMware虚拟机超详细安装Linux教程(最新版)
linux·运维·服务器·windows·微软·centos·虚拟机
初级代码游戏34 分钟前
关于linux的ld.so.conf.d
linux·运维·服务器
xianwu54340 分钟前
反向代理模块。开发
linux·开发语言·网络·c++·git
m0_748232391 小时前
在Linux centos7环境下部署wblogic使用weblogic部署war包项目
linux·运维·服务器
李先静1 小时前
用 gdbserver 调试 arm-linux 上的 AWTK 应用程序
linux·arm开发·awtk