Skip to content

Instantly share code, notes, and snippets.

@Gateswong
Created April 29, 2014 20:05
Show Gist options
  • Save Gateswong/593c52b2abc8839ac1b2 to your computer and use it in GitHub Desktop.
Save Gateswong/593c52b2abc8839ac1b2 to your computer and use it in GitHub Desktop.
Design Parallel Algorithms (2)

Gauss Elimination

First let's make some assumptions:

one base op (+, *, -, /) takes 1 unit of time
hypercube SF (ts, tw)
    

Code:


if (0 == myid) {
for (row = 0; row < n; row ++) {
proc = row % nprocs;
if (proc != 0) {
MPI_Send(&A[row], N, ..., proc);
MPI_Send(&B[row], N, ..., proc);
}
}
} else {
// Recv
}
for (norm = 0; norm < N - 1) {
MPI_Bcase(&A[norm], ..., norm % nprocs);
for (row = norm + 1, ... ) {
if (myid = row % nprocs) {
for (col = norm; col < N, col ++) {
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment