incubator-hama-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edward J. Yoon (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HAMA-221) A BSP matrix multiplication implementation.
Date Fri, 12 Feb 2010 02:20:27 GMT

    [ https://issues.apache.org/jira/browse/HAMA-221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12832796#action_12832796
] 

Edward J. Yoon commented on HAMA-221:
-------------------------------------

Here's my multi threaded version of mat-mat mult. 

In this example,
 - Thread.join() means a barrier.  
 - The global storage (int[][] out) was used.  (Of course, you can also split the summation
into n-supersteps.)

----
class MatMult extends Thread {
  static int m1[][];
  static int m2[][];
  static int out[][];
  static int n = 2;
  int row;

  MatMult(int i) {
    row = i;
    this.start();
  }

  public void run() {
    int i, j;
    for (i = 0; i < n; i++) {
      out[row][i] = 0;
      
      for (j = 0; j < n; j++) {
        out[row][i] = out[row][i] + m1[row][j] * m2[j][i];
      }
    }
  }

  public static void main(String args[]) throws Exception {
    int i, j;
    int n = 2;
    m1 = new int[][] { { 1, 2 }, { 3, 4 } };
    m2 = new int[][] { { 1, 2 }, { 3, 4 } };
    out = new int[n][n];

    MatMult mat[] = new MatMult[n];
    for (i = 0; i < n; i++) {
      mat[i] = new MatMult(i);
    }

    for (i = 0; i < n; i++) {
      mat[i].join();
    }

    System.out.println("OUTPUT :");
    for (i = 0; i < n; i++) {
      for (j = 0; j < n; j++) {
        System.out.print(out[i][j] + "\t");
      }
      System.out.println();
    }
  }
}


> A BSP matrix multiplication implementation.
> -------------------------------------------
>
>                 Key: HAMA-221
>                 URL: https://issues.apache.org/jira/browse/HAMA-221
>             Project: Hama
>          Issue Type: Improvement
>          Components: bsp, matrix
>    Affects Versions: 0.2.0
>            Reporter: Edward J. Yoon
>             Fix For: 0.2.0
>
>
> Using the BSP model, we could improve the performance of mat-mat multiplication. Let's
evaluation it out on this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message