uni-assignments

My university programming assignments
git clone git://git.christosmarg.xyz/uni-assignments.git
Log | Files | Refs | README

ex3.c (464B)


      1 #include <stdio.h>
      2 #include <stdlib.h>
      3 #include <mpi.h>
      4 
      5 int
      6 main(int argc, char *argv[])
      7 {
      8         int nproc, rank, root = 0;
      9         int rc;
     10 
     11         if ((rc = MPI_Init(&argc, &argv)) != 0) {
     12                 fprintf(stderr, "%s: cannot initiliaze MPI.\n", argv[0]);
     13                 MPI_Abort(MPI_COMM_WORLD, rc);
     14         }
     15         MPI_Comm_size(MPI_COMM_WORLD, &nproc);
     16         MPI_Comm_rank(MPI_COMM_WORLD, &rank);
     17 
     18         MPI_Finalize();
     19 
     20         return 0;
     21 }