Parallel Java Library
ã¡ã¢
æ¥æãããç 究室ã«Quad Coreã®ãã·ã³ãæ¥ãã®ã§ï¼OpenMPã£ã½ãç°¡åã«ã«ã¼ãçã並ååãã¦ãããJavaã®ã©ã¤ãã©ãªãæ¢ãã¦ãã¨ããParallel Java Libraryã¨ããããã®ãè¦ã¤ããï¼
ãã£ã¦ããããã¨ã¯ä¸ã®ãããªé次ã®ã³ã¼ãã
//seq for (int i = 1; i <= 4; ++i) { int j = 0; while (j < 1000000000) j = j + 1; System.out.println("Hello, world, i = " + i); }
次ã®ããã«æ¸ããã¨ã«ãã並ååãã¦ãããï¼
//parallel new ParallelTeam().execute(new ParallelRegion() { public void run() throws Exception { execute(1, 4, new IntegerForLoop() { public void run(int first, int last) throws Exception { for (int i = first; i <= last; ++i) { int j = 0; while (j < 1000000000) j = j + 1; System.out.println("Hello, world, i = " + i); } } }); } });
èªå® ã®ãã¹ã¯ããã(CPUã¯Core2Duo E6600)ã§å®è¡æéã測å®ããã¨ããä¸ã2266msï¼ä¸ã1156msãªã®ã§ã¾ã¨ãã«ä¸¦ååã§ãã¦ãï¼ãã OpenMPとの比較ãè¦ãéãã«ããã¦ã¯è² ãã¦ãã¿ããã§ãï¼ãã åã¯C/C++ã¯ã§ããªãã®ã§ã²ã¾ãããã°ããã¥ã¡ã³ããèªãã§ãããã¨ã«ããï¼