1 / 8

By Sumit Malhotra Computer Science, Florida Tech 767050340 Dr. Charles Fulton

Optimization of Loop Unrolling on dense Vector-matrix multiplication -Parallel Processing. By Sumit Malhotra Computer Science, Florida Tech 767050340 Dr. Charles Fulton. Aim of project.

Download Presentation

By Sumit Malhotra Computer Science, Florida Tech 767050340 Dr. Charles Fulton

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Optimization of Loop Unrolling on dense Vector-matrix multiplication -Parallel Processing By Sumit Malhotra Computer Science, Florida Tech 767050340 Dr. Charles Fulton

  2. Aim of project • To find the best loop unrolling parameters for different number of processors on a 5120 X 5120 matrix.

  3. Algorithm for Matrix Multiplication m = n = 5120; for (i=0; i < local_m; i+=UNROLL2) { for (j=0; j < n; j+=UNROLL) { matrix multiplication; } } Where UNROLL2 and UNROLL are loop unrolling parameters and local_m = m/p and p = number of processors. Therefore the size of matrix on each processor will be local_m x n.

  4. Size of matrix on each processor Size of Matrix when p=1 : 5120 X 5120 Size of Matrix when p=2 : 2560 X 5120 Size of Matrix when p=4 : 1280 X 5120 Size of Matrix when p=8 : 640 X 5120 Where p = number of processors.

  5. Sample Code UNROLL2 = UNROLL = 2; for (i=0; i < local_m; i+=UNROLL2) { for (j=0; j < n; j+=UNROLL) { y[i] += local_A[i][j] * x[j] +local_A[i][j+1] * x[j+1]; y[i+1] += local_A[i+1][j] * x[j] +local_A[i+1][j+1] * x[j+1]; } }

  6. Sample Code UNROLL2 = 2, UNROLL = 4. for (i=0; i < local_m; i+=UNROLL2) { for (j=0; j < n; j+=UNROLL) { y[i] += local_A[i][j] * x[j] + local_A[i][j+1] * x[j+1] + local_A[i][j+2] * x[j+2] + local_A[i][j+3] * x[j+3]; y[i+1] += local_A[i+1][j] * x[j] + local_A[i+1][j+1] * x[j+1] + local_A[i+1][j+2] * x[j+2] + local_A[i+1][j+3] * x[j+3]; } }

  7. Time Calculation Start = clock(); Multiplication code; //Computation. MPI_Gather(); //Communication. End = clock(); Total Computation + Communication Time = Start – End; Start = clock(); MPI_Gather(); //Communication. End = clock(); Communication Time = Start – End; Start = clock(); MPI_Scatter(); //Communication. End = clock(); Scatter Time = Start – End;

  8. Conclusion - Result Table

More Related