#include "mpi.h"
#include <stdio.h>

using namespace std;

int  main(int argc,char* argv[])
{
    int myid,numprocs;   //变量是分布存储的
    int namelen;
    char processor_name[MPI_MAX_PROCESSOR_NAME];
    MPI_Init(&argc,&argv);
    MPI_Comm_rank(MPI_COMM_WORLD,&myid);
    MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
    MPI_Get_processor_name(processor_name,&namelen);
    printf("Hello World! Process %d of %d on %s\n",myid,numprocs,processor_name);
    MPI_Finalize();

    return 0;
}

 

相关文章:

  • 2021-11-21
  • 2021-07-19
  • 2021-07-16
  • 2021-10-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-30
  • 2022-02-14
  • 2021-12-05
  • 2022-01-25
  • 2021-05-10
  • 2021-08-02
相关资源
相似解决方案