dev-java/colt: Remove dev-java/concurrent-util dependency. Fixes bug 546496.
authorPatrice Clement <monsieurp@gentoo.org>
Wed, 7 Oct 2015 23:08:48 +0000 (23:08 +0000)
committerPatrice Clement <monsieurp@gentoo.org>
Wed, 7 Oct 2015 23:09:43 +0000 (23:09 +0000)
Monkey patch sources and make use of java.concurrent.util packages from the SDK instead. Raise jdk/jre to 1.7. Drop ppc+ppc64.

Package-Manager: portage-2.2.20.1
Signed-off-by: Patrice Clement <monsieurp@gentoo.org>
dev-java/colt/colt-1.2.0-r3.ebuild [new file with mode: 0644]
dev-java/colt/files/colt-1.2.0-remove-concurrent-util-imports.patch [new file with mode: 0644]

diff --git a/dev-java/colt/colt-1.2.0-r3.ebuild b/dev-java/colt/colt-1.2.0-r3.ebuild
new file mode 100644 (file)
index 0000000..68ae524
--- /dev/null
@@ -0,0 +1,48 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+JAVA_PKG_IUSE="source doc"
+
+inherit java-pkg-2 java-ant-2 eutils
+
+DESCRIPTION="A set of Open Source Libraries for High Performance Scientific and Technical Computing in Java"
+SRC_URI="http://dsd.lbl.gov/~hoschek/colt-download/releases/${P}.tar.gz"
+HOMEPAGE="http://www-itg.lbl.gov/~hoschek/colt/"
+
+LICENSE="colt"
+IUSE=""
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+DEPEND=">=virtual/jdk-1.7"
+RDEPEND=">=virtual/jre-1.7"
+
+S="${WORKDIR}/${PN}"
+
+EANT_BUILD_TARGET="javac jar"
+JAVA_ANT_REWRITE_CLASSPATH="true"
+JAVA_ANT_ENCODING="ISO-8859-1"
+
+# [0]: I don't know but it must be useful.
+# [1]: Monkey patch manually some classes to get rid of the
+# oswego.edu.concurrent.util imports.
+PATCHES=(
+       "${FILESDIR}/${P}-benchmark-no-deprecation.patch"
+       "${FILESDIR}/${P}-remove-concurrent-util-imports.patch"
+)
+
+java_prepare() {
+       epatch "${PATCHES[@]}"
+
+       find "${S}" -name \*.jar -exec rm -v {} \; || die
+}
+
+src_install() {
+       java-pkg_dojar "lib/${PN}.jar"
+
+       dohtml README.html || die
+       use doc && java-pkg_dojavadoc doc/api
+       use source && java-pkg_dosrc src/*
+}
diff --git a/dev-java/colt/files/colt-1.2.0-remove-concurrent-util-imports.patch b/dev-java/colt/files/colt-1.2.0-remove-concurrent-util-imports.patch
new file mode 100644 (file)
index 0000000..2cfbef7
--- /dev/null
@@ -0,0 +1,210 @@
+--- src/cern/colt/matrix/linalg/SmpBlas.java.orig      2015-10-07 22:23:44.969486000 +0000
++++ src/cern/colt/matrix/linalg/SmpBlas.java   2015-10-07 22:29:15.475486000 +0000
+@@ -10,7 +10,8 @@
\r
+ import cern.colt.matrix.DoubleMatrix1D;\r
+ import cern.colt.matrix.DoubleMatrix2D;\r
+-import EDU.oswego.cs.dl.util.concurrent.FJTask;\r
++\r
++import java.util.concurrent.ForkJoinTask;\r
+ /**\r
+ Parallel implementation of the Basic Linear Algebra System for symmetric multi processing boxes.\r
+ Currently only a few algorithms are parallelised; the others are fully functional, but run in sequential mode.\r
+@@ -198,7 +199,7 @@
+       \r
+       // set up concurrent tasks\r
+       int span = width/noOfTasks;\r
+-      final FJTask[] subTasks = new FJTask[noOfTasks];\r
++      final ForkJoinTask[] subTasks = new ForkJoinTask[noOfTasks];\r
+       for (int i=0; i<noOfTasks; i++) {\r
+               final int offset = i*span;\r
+               if (i==noOfTasks-1) span = width - span*i; // last span may be a bit larger\r
+@@ -217,24 +218,30 @@
+                       CC = C.viewPart(offset,0,span,p);\r
+               }\r
+                               \r
+-              subTasks[i] = new FJTask() { \r
++              subTasks[i] = new ForkJoinTask() { \r
+                       public void run() { \r
+                               seqBlas.dgemm(transposeA,transposeB,alpha,AA,BB,beta,CC); \r
+                               //System.out.println("Hello "+offset); \r
+                       }\r
++\r
++      public boolean exec() { return true; }\r
++      public void setRawResult(Object o) {}\r
++      public Object getRawResult() {return null;}\r
+               };\r
+       }\r
+       \r
+       // run tasks and wait for completion\r
+-      try { \r
+-              this.smp.taskGroup.invoke(\r
+-                      new FJTask() {\r
+-                              public void run() {     \r
+-                                      coInvoke(subTasks);     \r
+-                              }\r
+-                      }\r
+-              );\r
+-      } catch (InterruptedException exc) {}\r
++  this.smp.taskGroup.invoke(\r
++          new ForkJoinTask() {\r
++              public void run() {     \r
++                  invokeAll(subTasks);        \r
++              }\r
++\r
++              public boolean exec() { return true; }\r
++              public void setRawResult(Object o) {}\r
++              public Object getRawResult() {return null;}\r
++          }\r
++          );\r
+ }\r
+ public void dgemv(final boolean transposeA, final double alpha, DoubleMatrix2D A, final DoubleMatrix1D x, final double beta, DoubleMatrix1D y) {\r
+       /*\r
+@@ -271,7 +278,7 @@
+       \r
+       // set up concurrent tasks\r
+       int span = width/noOfTasks;\r
+-      final FJTask[] subTasks = new FJTask[noOfTasks];\r
++      final ForkJoinTask[] subTasks = new ForkJoinTask[noOfTasks];\r
+       for (int i=0; i<noOfTasks; i++) {\r
+               final int offset = i*span;\r
+               if (i==noOfTasks-1) span = width - span*i; // last span may be a bit larger\r
+@@ -280,24 +287,30 @@
+               final DoubleMatrix2D AA = A.viewPart(offset,0,span,n);\r
+               final DoubleMatrix1D yy = y.viewPart(offset,span);\r
+                               \r
+-              subTasks[i] = new FJTask() { \r
++              subTasks[i] = new ForkJoinTask() { \r
+                       public void run() { \r
+                               seqBlas.dgemv(transposeA,alpha,AA,x,beta,yy); \r
+                               //System.out.println("Hello "+offset); \r
+                       }\r
++\r
++      public boolean exec() { return true; }\r
++      public void setRawResult(Object o) {}\r
++      public Object getRawResult() {return null;}\r
+               };\r
+       }\r
+       \r
+       // run tasks and wait for completion\r
+-      try { \r
+-              this.smp.taskGroup.invoke(\r
+-                      new FJTask() {\r
+-                              public void run() {     \r
+-                                      coInvoke(subTasks);     \r
+-                              }\r
+-                      }\r
+-              );\r
+-      } catch (InterruptedException exc) {}\r
++  this.smp.taskGroup.invoke(\r
++          new ForkJoinTask() {\r
++              public void run() {     \r
++                  invokeAll(subTasks);        \r
++              }\r
++\r
++              public boolean exec() { return true; }\r
++              public void setRawResult(Object o) {}\r
++              public Object getRawResult() {return null;}\r
++          }\r
++          );\r
+ }\r
+ public void dger(double alpha, DoubleMatrix1D x, DoubleMatrix1D y, DoubleMatrix2D A) {\r
+       seqBlas.dger(alpha,x,y,A);\r
+@@ -369,9 +382,6 @@
+ /**\r
+  * Prints various snapshot statistics to System.out; Simply delegates to {@link EDU.oswego.cs.dl.util.concurrent.FJTaskRunnerGroup#stats}.\r
+  */\r
+-public void stats() {\r
+-      if (this.smp!=null) this.smp.stats();\r
+-}\r
+ private double xsum(DoubleMatrix2D A) {\r
+       double[] sums = run(A,true,\r
+               new Matrix2DMatrix2DFunction() {\r
+--- src/cern/colt/matrix/linalg/Smp.java.orig  2015-10-07 21:08:19.443486000 +0000
++++ src/cern/colt/matrix/linalg/Smp.java       2015-10-07 22:28:24.722486000 +0000
+@@ -9,12 +9,13 @@
+ package cern.colt.matrix.linalg;\r
\r
+ import cern.colt.matrix.DoubleMatrix2D;\r
+-import EDU.oswego.cs.dl.util.concurrent.FJTask;\r
+-import EDU.oswego.cs.dl.util.concurrent.FJTaskRunnerGroup;\r
++import java.util.concurrent.ForkJoinTask;\r
++import java.util.concurrent.ForkJoinPool;\r
++\r
+ /*\r
+ */\r
+ class Smp {\r
+-      protected FJTaskRunnerGroup taskGroup; // a very efficient and light weight thread pool\r
++      protected ForkJoinPool taskGroup; // a very efficient and light weight thread pool\r
\r
+       protected int maxThreads;       \r
+ /**\r
+@@ -24,41 +25,39 @@
+       maxThreads = Math.max(1,maxThreads);\r
+       this.maxThreads = maxThreads;\r
+       if (maxThreads>1) {\r
+-              this.taskGroup = new FJTaskRunnerGroup(maxThreads);\r
++              this.taskGroup = new ForkJoinPool(maxThreads);\r
+       }\r
+       else { // avoid parallel overhead\r
+               this.taskGroup = null;\r
+       }\r
+ }\r
+-/**\r
+- * Clean up deamon threads, if necessary.\r
+- */\r
+-public void finalize() {\r
+-      if (this.taskGroup!=null) this.taskGroup.interruptAll();\r
+-}\r
+ protected void run(final DoubleMatrix2D[] blocksA, final DoubleMatrix2D[] blocksB, final double[] results, final Matrix2DMatrix2DFunction function) {\r
+-      final FJTask[] subTasks = new FJTask[blocksA.length];\r
++      final ForkJoinTask[] subTasks = new ForkJoinTask[blocksA.length];\r
+       for (int i=0; i<blocksA.length; i++) {\r
+               final int k = i;\r
+-              subTasks[i] = new FJTask() { \r
++              subTasks[i] = new ForkJoinTask() { \r
+                       public void run() {\r
+                               double result = function.apply(blocksA[k],blocksB != null ? blocksB[k] : null);\r
+                               if (results!=null) results[k] = result; \r
+                               //System.out.print("."); \r
+                       }\r
++      public boolean exec() { return true; }\r
++      public void setRawResult(Object o) {}\r
++      public Object getRawResult() {return null;}\r
+               };\r
+       }\r
\r
+       // run tasks and wait for completion\r
+-      try { \r
+-              this.taskGroup.invoke(\r
+-                      new FJTask() {\r
+-                              public void run() {     \r
+-                                      coInvoke(subTasks);     \r
+-                              }\r
+-                      }\r
+-              );\r
+-      } catch (InterruptedException exc) {}\r
++  this.taskGroup.invoke(\r
++          new ForkJoinTask() {\r
++              public void run() {     \r
++                  invokeAll(subTasks);        \r
++              }\r
++              public boolean exec() { return true; }\r
++              public void setRawResult(Object o) {}\r
++              public Object getRawResult() {return null;}\r
++          }\r
++          );\r
+ }\r
+ protected DoubleMatrix2D[] splitBlockedNN(DoubleMatrix2D A, int threshold, long flops) {\r
+       /*\r
+@@ -186,10 +185,4 @@
+       }\r
+       return blocks;\r
+ }\r
+-/**\r
+- * Prints various snapshot statistics to System.out; Simply delegates to {@link EDU.oswego.cs.dl.util.concurrent.FJTaskRunnerGroup#stats}.\r
+- */\r
+-public void stats() {\r
+-      if (this.taskGroup!=null) this.taskGroup.stats();\r
+-}\r
+ }\r