#include <stdio.h>
#include <mpi.h>
#include <string.h>
void main(){
int rank,size,tag[50];
char m1[20],m2[20]="hello world";
MPI_Status Status;
MPI_Init(NULL,NULL);
MPI_Comm_size(MPI_COMM_WORLD,&size);
MPI_Comm_rank(MPI_COMM_WORLD,&rank);a
if(rank==0)
{
for(int i=1;i<size;i++)
{
MPI_Send(&m1 ,13 ,MPI_CHAR , i ,tag ,MPI_COMM_WORLD);
}
}
else
{
MPI_Recv(&m1,13,MPI_CHAR, i , tag,MPI_COMM_WORLD , &status);
printf("nod %d : %s\n",rank
,m1
); }
MPI_Finalize()
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxtcGkuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgp2b2lkIG1haW4oKXsKaW50IHJhbmssc2l6ZSx0YWdbNTBdOwpjaGFyIG0xWzIwXSxtMlsyMF09ImhlbGxvIHdvcmxkIjsKTVBJX1N0YXR1cyBTdGF0dXM7Ck1QSV9Jbml0KE5VTEwsTlVMTCk7Ck1QSV9Db21tX3NpemUoTVBJX0NPTU1fV09STEQsJnNpemUpOwpNUElfQ29tbV9yYW5rKE1QSV9DT01NX1dPUkxELCZyYW5rKTthCmlmKHJhbms9PTApCnsKc3RyY3B5KG0xLG0yKTsKZm9yKGludCBpPTE7aTxzaXplO2krKykKewpNUElfU2VuZCgmbTEgLDEzICxNUElfQ0hBUiAsIGkgLHRhZyAsTVBJX0NPTU1fV09STEQpOwp9Cn0KZWxzZQp7Ck1QSV9SZWN2KCZtMSwxMyxNUElfQ0hBUiwgaSAsIHRhZyxNUElfQ09NTV9XT1JMRCAsICZzdGF0dXMpOwpwcmludGYoIm5vZCAlZCA6ICVzXG4iLHJhbmssbTEpOwp9IApNUElfRmluYWxpemUoKQp9Cg==