public void test () { Log.info("CholTest::test enter"); for (int sz = 6000; sz < 10000; sz+=2000) { Log.info("CholTest::test sz is " + sz); DataSetup data = new DataSetup(sz, 12345); long start = System.currentTimeMillis(); CholeskyDecomposition jamaChol = new Matrix(data.xx).chol(); Log.info("JAMA CHOLESKY [N = " + sz + "] TAKES " + (System.currentTimeMillis() - start) + " MILLISECONDS."); if (!jamaChol.isSPD()) continue; ForkJoinPool fjp = new ForkJoinPool(32); for (int t = 2; t <= 32; t += 2) { for (int step : STEPS) fjp.invoke(new TestSetup(new DataSetup(data.xx),jamaChol.getL().getArray(),step,t)); } } Log.info("CholTest::test exit"); }
/** * Creates a fork/join pool of given size. Each thread will have the uncaught exception handler set * to print the unhandled exception to standard error output. * * @param poolSize The required pool size @return The created thread pool * @return The newly created thread pool */ private static ForkJoinPool createPool(final int poolSize) { assert poolSize > 0; final Thread.UncaughtExceptionHandler uncaughtExceptionHandler = new Thread.UncaughtExceptionHandler() { @Override @SuppressWarnings({"UseOfSystemOutOrSystemErr"}) public void uncaughtException(final Thread t, final Throwable e) { System.err.println(Pool.UNCAUGHT_EXCEPTION_OCCURRED_IN_GPARS_POOL + t.getName()); e.printStackTrace(System.err); } }; return new ForkJoinPool(poolSize, ForkJoinPool.defaultForkJoinWorkerThreadFactory, uncaughtExceptionHandler, false); }
static ForkJoinPool defaultExecutor() { ForkJoinPool p = defaultExecutor; // double-check if (p == null) { synchronized (poolLock) { p = defaultExecutor; if (p == null) { // use ceil(7/8 * ncpus) int nprocs = Runtime.getRuntime().availableProcessors(); int nthreads = nprocs - (nprocs >>> 3); defaultExecutor = p = new ForkJoinPool(nthreads); } } } return p; }
static ForkJoinPool defaultExecutor() { ForkJoinPool p = defaultExecutor; // double-check if (p == null) { synchronized (poolLock) { p = defaultExecutor; if (p == null) { // use ceil(7/8 * ncpus) int nprocs = Runtime.getRuntime().availableProcessors(); int nthreads = nprocs - (nprocs >>> 3); defaultExecutor = p = new ForkJoinPool(nthreads); } } } return p; }
Solver solver = new Solver(array, 0, array.length, 0); pool = new ForkJoinPool(threadCount); StopWatch stopwatch = new StopWatch(); try {