Mpich2_安装 Ubuntu 20.04LTS

  • Ubuntu 20.04 LTS
  1. sudo aptitude install mpich

  2. mpiexec --version

    image-20201117092421973
    image-20201117092421973

  3. new code

    #include "mpi.h"
    #include <stdio.h>
       
    int main(void) 
    {
     int rankID;
     int sizeNum;
     MPI_Init(0, 0);
     MPI_Comm_size(MPI_COMM_WORLD, &sizeNum);
     MPI_Comm_rank(MPI_COMM_WORLD, &rankID);
     printf("Hello world! %d of total = %d\n", rankID, sizeNum);
     MPI_Finalize();
     return 0;
    }
    
  4. mpicc demo_1.c -o demo_1

  5. mpirun -np 8 ./demo_1

comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy