incubator-hama-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edward J. Yoon" <edwardy...@apache.org>
Subject A BSP based matrix multiplication implementation.
Date Fri, 12 Feb 2010 02:41:44 GMT
Hi,

I just made a pseudo code for this issue. I'm sure it will show better
performance than any M/R version of mat-mat mult on Hadoop.

Following is the sample code you could reference when porting to BSP version,
http://svn.apache.org/repos/asf/incubator/hama/trunk/src/test/org/apache/hama/bsp/BSPPeerTest.java

Does anyone have a interesting or want to implement this?

On Fri, Feb 12, 2010 at 11:20 AM, Edward J. Yoon (JIRA) <jira@apache.org> wrote:
>
>    [ 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.
>
>



-- 
Best Regards, Edward J. Yoon @ NHN, corp.
edwardyoon@apache.org
http://blog.udanax.org

Mime
View raw message