[?1049h[?12;25h[?1h=[52;1H[?25l----:---F1  [1m*scratch*   [0m   All L1     (Fundamental)----------------------------------
[A[H[?12l[?25h[?12;25h[H[2J[53d[?25lLoading encoded-kb...[K[H[?12l[?25h[?12;25h[53;22H[?25ldone[H[?12l[?25h[?12;25h[53d[K[?1l>[?12l[?25h[?1049l[39;49m
[?1049h[?12;25h[?1h=[H[2J[53d[K[?1l>[?12l[?25h[?1049l[39;49m
[?1049h[?12;25h[?1h=[53;1H[?25lFor information about the GNU Project and its goals, type C-h C-p.[K[H
[?12l[?25h[?12;25h[53d[?25lLoading image...[K[H
[?12l[?25h[?12;25h[53;17H[?25ldone[H
[?12l[?25h[?12;25h[53;9H[?25lcc-mode...[K[H
[?12l[?25h[?12;25h[53;19H[?25ldone[H
[?12l[?25h[?12;25h[53d[?25lLoading cc-mode...done[K[H[38;5;124m/*  matmat_mw_mpi.c : Parallel matrix multiplication program                         [39;49m
[A
[38;5;124m *  implemented with manager-worker pattern using MPI.                               [39;49m
[A
[38;5;124m */[39;49m[K
[38;5;170m#include[39;49m [38;5;138m<stdlib.h>[39;49m[K
[38;5;170m#include[39;49m [38;5;138m<stdio.h>[39;49m[K
[38;5;170m#include[39;49m [38;5;138m<string.h>[39;49m[K
[38;5;170m#include[39;49m [38;5;138m<mpi.h>[39;49m[K
[K
[38;5;170m#define[39;49m [38;5;136mcomm[39;49m MPI_COMM_WORLD[K
[K
[38;5;170m#ifdef[39;49m _CIVL[K
[K
[38;5;170m#include[39;49m [38;5;138m<civlc.cvh>[39;49m[K
[38;5;124m/* Dimensions of 2 matrices: a[N][L] * b[L][M] */[39;49m[K
$input [38;5;28mint[39;49m _mpi_nprocs=5;[K
$input [38;5;28mint[39;49m NB = 20;              [38;5;124m// upper bound of N                                 [39;49m
[A
$input [38;5;28mint[39;49m N = 8;[K
$assume(0 < N && N <= NB);[K
$input [38;5;28mint[39;49m LB = 20;              [38;5;124m// upper bound of L                                 [39;49m
[A
$input [38;5;28mint[39;49m L = 8;[K
$assume(0 < L && L <= LB);[K
$input [38;5;28mint[39;49m MB = 20;              [38;5;124m// upper bound of M                                 [39;49m
[A
$input [38;5;28mint[39;49m M = 8;[K
$assume(0 < M && M <= MB);[K
$input [38;5;28mdouble[39;49m a[N][L];          [38;5;124m// input data for matrix a                           [39;49m
[A
$input [38;5;28mdouble[39;49m b[L][M];          [38;5;124m// input data for matrix b                           [39;49m
[A
$output [38;5;28mdouble[39;49m output[N][M];    [38;5;124m// matrix stores results of a sequential run         [39;49m
[A
[K
[38;5;170m#else[39;49m[K
[K
[38;5;28mint[39;49m [38;5;136mN[39;49m = 8, [38;5;136mL[39;49m = 8, [38;5;136mM[39;49m = 8;[K
[K
[38;5;170m#endif[39;49m[K
[K
[38;5;124m/* prints a matrix.*/[39;49m[K
[38;5;28mvoid[39;49m [38;5;21mprintMatrix[39;49m([38;5;28mint[39;49m [38;5;136mnumRows[39;49m, [38;5;28mint[39;49m [38;5;136mnumCols[39;49m, [38;5;28mdouble[39;49m *[38;5;136mm[39;49m) {[K
  [38;5;129mfor[39;49m ([38;5;28mint[39;49m [38;5;136mi[39;49m = 0; i < numRows; i++) {[K
    [38;5;129mfor[39;49m ([38;5;28mint[39;49m [38;5;136mj[39;49m = 0; j < numCols; j++)[K
      printf([38;5;138m"%f "[39;49m, m[i*numCols + j]);[K
    printf([38;5;138m"\n"[39;49m);[K
  }[K
  printf([38;5;138m"\n"[39;49m);[K
}[K
[K
[38;5;124m/* Computes a vetor with length L times a matrix with dimensions [L][M] */[39;49m[K
[38;5;28mvoid[39;49m [38;5;21mvecmat[39;49m([38;5;28mdouble[39;49m [38;5;136mvector[39;49m[L], [38;5;28mdouble[39;49m [38;5;136mmatrix[39;49m[L][M], [38;5;28mdouble[39;49m [38;5;136mresult[39;49m[M]) {[K
  [38;5;129mfor[39;49m ([38;5;28mint[39;49m [38;5;136mj[39;49m = 0; j < M; j++) {[K
    result[j] = 0.0;[K
    [38;5;129mfor[39;49m ([38;5;28mint[39;49m [38;5;136mk[39;49m = 0; k < L; k++)[K
      result[j] += vector[k]*matrix[k][j];[K
  }[K
[30m[48;5;250m-uu-:---F1  [39;49m[1m[30m[48;5;250mmatmat_mw_mpi.c[0m[39;49m[30m[48;5;250m   Top L1     (C/l Abbrev)--------------------------------[39;49m
[A[H[?12l[?25h[?12;25h[53d[K[H[53d[?25lLoading newcomment...[H[?12l[?25h[?12;25h[53;22H[?25ldone[H[?12l[?25h[?12;25h[53d[?25lThe mark is not set now, so there is no region[H[?12l[?25h[?12;25h[53d[K[H[53d[?25lC-c[H[?12l[?25h[?12;25h[53;4H[?25l-[H[?12l[?25h[?12;25h[53;4H[?25l C-c[H[?12l[?25h[?12;25h[53d[?25lThe mark is not set now, so there is no region[H[?12l[?25h[?12;25h[53d[K[H[53d[?25lC-c[H[?12l[?25h[?12;25h[53;4H[?25l-[H[?12l[?25h[?12;25h[53;4H[?25l C-c[H[?12l[?25h[?12;25h[53d[?25lThe mark is not set now, so there is no region[H[?12l[?25h[?12;25h[53d[K[H[53d[?25lC-c[H[?12l[?25h[?12;25h[53;4H[?25l-[H[?12l[?25h[?12;25h[53;4H[?25l C-c[H[?12l[?25h[?12;25h[53d[?25lThe mark is not set now, so there is no region[H[?12l[?25h[?12;25h[53d[K[H[53d[?25lC-c[H[?12l[?25h[?12;25h[53;4H[?25l-[H[?12l[?25h[?12;25h