Return-Path: Delivered-To: apmail-incubator-hama-dev-archive@minotaur.apache.org Received: (qmail 65256 invoked from network); 12 Feb 2010 02:42:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Feb 2010 02:42:23 -0000 Received: (qmail 86936 invoked by uid 500); 12 Feb 2010 02:42:19 -0000 Delivered-To: apmail-incubator-hama-dev-archive@incubator.apache.org Received: (qmail 86793 invoked by uid 500); 12 Feb 2010 02:42:19 -0000 Mailing-List: contact hama-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hama-dev@incubator.apache.org Delivered-To: mailing list hama-dev@incubator.apache.org Received: (qmail 86768 invoked by uid 99); 12 Feb 2010 02:42:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Feb 2010 02:42:19 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.9] (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 12 Feb 2010 02:42:07 +0000 Received: (qmail 64975 invoked by uid 99); 12 Feb 2010 02:41:46 -0000 Received: from localhost.apache.org (HELO mail-ew0-f212.google.com) (127.0.0.1) (smtp-auth username edwardyoon, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Feb 2010 02:41:46 +0000 Received: by ewy4 with SMTP id 4so103722ewy.27 for ; Thu, 11 Feb 2010 18:41:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.155.17 with SMTP id i17mr444624wek.142.1265942504312; Thu, 11 Feb 2010 18:41:44 -0800 (PST) Date: Fri, 12 Feb 2010 11:41:44 +0900 Message-ID: Subject: A BSP based matrix multiplication implementation. From: "Edward J. Yoon" To: hama-dev@incubator.apache.org, hama-user@incubator.apache.org Cc: common-user@hadoop.apache.org, mahout-user@lucene.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org 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 versio= n, http://svn.apache.org/repos/asf/incubator/hama/trunk/src/test/org/apache/ha= ma/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) w= rote: > > =C2=A0 =C2=A0[ https://issues.apache.org/jira/browse/HAMA-221?page=3Dcom.= atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedComment= Id=3D12832796#action_12832796 ] > > Edward J. Yoon commented on HAMA-221: > ------------------------------------- > > Here's my multi threaded version of mat-mat mult. > > In this example, > =C2=A0- Thread.join() means a barrier. > =C2=A0- The global storage (int[][] out) was used. =C2=A0(Of course, you = can also split the summation into n-supersteps.) > > ---- > class MatMult extends Thread { > =C2=A0static int m1[][]; > =C2=A0static int m2[][]; > =C2=A0static int out[][]; > =C2=A0static int n =3D 2; > =C2=A0int row; > > =C2=A0MatMult(int i) { > =C2=A0 =C2=A0row =3D i; > =C2=A0 =C2=A0this.start(); > =C2=A0} > > =C2=A0public void run() { > =C2=A0 =C2=A0int i, j; > =C2=A0 =C2=A0for (i =3D 0; i < n; i++) { > =C2=A0 =C2=A0 =C2=A0out[row][i] =3D 0; > > =C2=A0 =C2=A0 =C2=A0for (j =3D 0; j < n; j++) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0out[row][i] =3D out[row][i] + m1[row][j] * m2[= j][i]; > =C2=A0 =C2=A0 =C2=A0} > =C2=A0 =C2=A0} > =C2=A0} > > =C2=A0public static void main(String args[]) throws Exception { > =C2=A0 =C2=A0int i, j; > =C2=A0 =C2=A0int n =3D 2; > =C2=A0 =C2=A0m1 =3D new int[][] { { 1, 2 }, { 3, 4 } }; > =C2=A0 =C2=A0m2 =3D new int[][] { { 1, 2 }, { 3, 4 } }; > =C2=A0 =C2=A0out =3D new int[n][n]; > > =C2=A0 =C2=A0MatMult mat[] =3D new MatMult[n]; > =C2=A0 =C2=A0for (i =3D 0; i < n; i++) { > =C2=A0 =C2=A0 =C2=A0mat[i] =3D new MatMult(i); > =C2=A0 =C2=A0} > > =C2=A0 =C2=A0for (i =3D 0; i < n; i++) { > =C2=A0 =C2=A0 =C2=A0mat[i].join(); > =C2=A0 =C2=A0} > > =C2=A0 =C2=A0System.out.println("OUTPUT :"); > =C2=A0 =C2=A0for (i =3D 0; i < n; i++) { > =C2=A0 =C2=A0 =C2=A0for (j =3D 0; j < n; j++) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0System.out.print(out[i][j] + "\t"); > =C2=A0 =C2=A0 =C2=A0} > =C2=A0 =C2=A0 =C2=A0System.out.println(); > =C2=A0 =C2=A0} > =C2=A0} > } > > >> A BSP matrix multiplication implementation. >> ------------------------------------------- >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Key: HAMA-221 >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 URL: https://iss= ues.apache.org/jira/browse/HAMA-221 >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Project: Hama >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Issue Type: Improvement >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Components: bsp, matrix >> =C2=A0 =C2=A0Affects Versions: 0.2.0 >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Reporter: Edward J. Yoon >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Fix For: 0.2.0 >> >> >> Using the BSP model, we could improve the performance of mat-mat multipl= ication. 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. > > --=20 Best Regards, Edward J. Yoon @ NHN, corp. edwardyoon@apache.org http://blog.udanax.org