>

Title: COMP309/509 - Lecture 24

COMP309/509 - Parallel and Distributed Computing

Lecture 24 - Exam Review and Final MPI Examples

By Mitchell Welch

###University of New England

Reading


Summary


Exam Hints


Exam Hints


Exam Hints


Exam Hints


Exam Hints


Exam Hints


Exam Hints


Exam Hints


Exam Hints


Exam Hints


Exam Hints


Matrix Multiplication - Fox's Algorithm

http://www.netlib.org/pvm3/book/pvm-book.html

http://www.netlib.org/pvm3/book/pvm-book.html


Matrix Multiplication - Fox's Algorithm


Matrix Multiplication - Fox's Algorithm


Matrix Multiplication - Fox's Algorithm


Matrix Multiplication - Fox's Algorithm


Matrix Multiplication - Fox's Algorithm


Matrix Multiplication - Fox's Algorithm


Matrix Multiplication - Fox's Algorithm


Matrix Multiplication - Fox's Algorithm


Matrix Multiplication - Fox's Algorithm

To create our grid communicator we execute:

  MPI_Comm grid;                    //The resulting Communicator
  int dim = 2;                      //The number of Dimensions
  int dims[dim] = { m , m };        //The size of each Dimension
  int wrap[dim] = { 1 , 1};         //Wraparound?
  int optimize = 1;                 //Optimize?

  MPI_Cart_create(MPI_COMM_WORLD, dim, dims, wrap, optimize, &grid);


Matrix Multiplication - Fox's Algorithm


int grid_rank; MPI_Comm_rank(grid, &grid_rank);

// dim == 2 int coords[dim]; MPI_Cart_coords(grid, grid_rank, dim, coords);

Matrix Multiplication - Fox's Algorithm


// dim == 2 MPI_Comm row; int direction[dim] = { 0, 1 }; MPI_Cart_sub(grid, direction, &row);

// dim == 2 MPI_Comm col; int direction[dim] = { 1, 0 }; MPI_Cart_sub(grid, direction, &col);

Matrix Multiplication - Fox's Algorithm



bourbaki Tue May 26 Examples $ test_mpi_run Enter the number of processes (a perfect square): 64 Enter the size of the blocks: 500 You are going to multiply 4000 by 4000 matrices! Do you want me to make the matrices? (y/n) y Finished writing R -rwx------ 1 comp309 comp309 62M May 26 21:38 R Finished writing I -rwx------ 1 comp309 comp309 62M May 26 21:38 I Finished writing IR -rwx------ 1 comp309 comp309 62M May 26 21:38 IR Finished writing RI -rwx------ 1 comp309 comp309 62M May 26 21:38 RI Creating Grid Communicator Creating Column Communicator Creating Row Communicator Allocating Matrices Initializing Matrices Finished Allocating and Initializing Matrices Looping: iteration 1 out of a total of 8 Looping: iteration 2 out of a total of 8 Looping: iteration 3 out of a total of 8 Looping: iteration 4 out of a total of 8 Looping: iteration 5 out of a total of 8 Looping: iteration 6 out of a total of 8 Looping: iteration 7 out of a total of 8 Looping: iteration 8 out of a total of 8 Finished computation Writing C Cleaning up Exiting gracefully after 107 seconds Creating Grid Communicator Creating Column Communicator Creating Row Communicator Allocating Matrices Initializing Matrices Finished Allocating and Initializing Matrices Looping: iteration 1 out of a total of 8 Looping: iteration 2 out of a total of 8 Looping: iteration 3 out of a total of 8 Looping: iteration 4 out of a total of 8 Looping: iteration 5 out of a total of 8 Looping: iteration 6 out of a total of 8 Looping: iteration 7 out of a total of 8 Looping: iteration 8 out of a total of 8 Finished computation Writing C Cleaning up Exiting gracefully after 100 seconds IR and RI agree bourbaki Tue May 26 Examples $

Summary


Questions?


Reading


Good Luck in Your Exams!!