private void runJobGraph(int nthreads) { Preconditions.checkState(rootJob != null, "job graph not built"); ForkJoinPool pool = new ForkJoinPool(nthreads); try { pool.invoke(rootJob); } catch (Throwable err) { logger.error("experiment failed", err); if (!continueAfterError) { Throwables.throwIfUnchecked(err); // will only happen if an undeclared checked exception slips through throw new UncheckedExecutionException(err); } } finally { pool.shutdown(); } }
forkJoinPool.invoke( new RecursiveRebuildTreeTask( treeModelTasks, companyId, parentPrimaryKey,
forkJoinPool.invoke( new RecursiveRebuildTreeTask( treeModelTasks, companyId, parentPrimaryKey,
@Test public void testAcquireSem() { Semaphore sem = new Semaphore(2); ForkJoinPool.commonPool().invoke(new RecursiveAction() { AtomicInteger running = new AtomicInteger();
@Test public void testAcquireMonitor() { Monitor monitor = new Monitor(); ForkJoinPool.commonPool().invoke(new RecursiveAction() { AtomicInteger running = new AtomicInteger();
/** * {@inheritDoc} */ @Override public List<IStorageDescriptor> query(IIndexQuery query, ForkJoinPool forkJoinPool) { return forkJoinPool.invoke(getTaskForForkJoinQuery(query)); }
/** * {@inheritDoc} */ @Override public List<IStorageDescriptor> query(IIndexQuery query, ForkJoinPool forkJoinPool) { return forkJoinPool.invoke(getTaskForForkJoinQuery(query)); }
/** * {@inheritDoc} */ @Override public List<E> query(IIndexQuery query, ForkJoinPool forkJoinPool) { return forkJoinPool.invoke(getTaskForForkJoinQuery(query)); }
/** * {@inheritDoc} */ @Override public List<IStorageDescriptor> query(IIndexQuery query, ForkJoinPool forkJoinPool) { return forkJoinPool.invoke(getTaskForForkJoinQuery(query)); }
/** * {@inheritDoc} */ @Override public List<R> query(IIndexQuery query, ForkJoinPool forkJoinPool) { return forkJoinPool.invoke(getTaskForForkJoinQuery(query)); }
public double[][] parScalarMinus(double [][] m1,double [][] m2) { int ll = 600; double [][] result = new double[m1.length][m1[0].length]; MatrixOperator process = new MatrixOperator(m1,m2,result, minusop, 0, m1.length,ll); pool.invoke(process); return result; }
@Override void updateGradient(int N, int no_dims, double[] Y, double momentum, double eta, double[] dY, double[] uY, double[] gains) { RecursiveGradientUpdater dslr = new RecursiveGradientUpdater(N, no_dims, Y, momentum, eta, dY, uY, gains,0,N * no_dims,N/(Runtime.getRuntime().availableProcessors()*10)); gradientPool.invoke(dslr); }
@Override void runCompute() { ForkJoinTask<Long> countTask = graph instanceof HugeGraph ? new HugeTask((HugeGraph) graph, 0, nodeCount) : new TriangleTask(0, nodeCount); triangleCount = pool.invoke(countTask); CoefficientTask coefficientTask = new CoefficientTask( Direction.OUTGOING, 0, nodeCount); averageClusteringCoefficient = pool.invoke(coefficientTask); }
public DisjointSetStruct compute(double threshold) { return ForkJoinPool .commonPool() .invoke(new ThresholdUFTask(0, threshold)); }
public PagedDisjointSetStruct compute(double threshold) { return ForkJoinPool .commonPool() .invoke(new ThresholdUFTask(0, threshold)); }
public DisjointSetStruct compute(double threshold) { return ForkJoinPool .commonPool() .invoke(new ThresholdUFTask(0, threshold)); }
public void merge(ArrayList<? extends UFProcess> ufProcesses) { ParallelUtil.run(ufProcesses, executor); if (!running()) { return; } final Stack<DisjointSetStruct> temp = new Stack<>(); ufProcesses.forEach(uf -> temp.add(uf.struct)); struct = ForkJoinPool.commonPool().invoke(new Merge(temp)); }
private void merge(Collection<? extends UFTask> ufProcesses) { ParallelUtil.run(ufProcesses, executor); if (!running()) { return; } final Stack<PagedDisjointSetStruct> temp = new Stack<>(); ufProcesses.forEach(uf -> temp.add(uf.struct())); struct = ForkJoinPool.commonPool().invoke(new Merge(temp)); }
private void merge(Collection<? extends UFTask> ufProcesses) { ParallelUtil.run(ufProcesses, executor); if (!running()) { return; } final Stack<PagedDisjointSetStruct> temp = new Stack<>(); ufProcesses.forEach(uf -> temp.add(uf.struct())); struct = ForkJoinPool.commonPool().invoke(new Merge(temp)); }
@Override public int count(Predicate<ArrayValue<T>> predicate) { if (isParallel() && length() > 0) { final int processors = Runtime.getRuntime().availableProcessors(); final int splitThreshold = Math.max(length() / processors, 10000); return ForkJoinPool.commonPool().invoke(new CountTask<>(this, 0, length()-1, splitThreshold, predicate)); } else { final CountTask task = new CountTask<>(this, 0, length()-1, Integer.MAX_VALUE, predicate); return task.compute(); } }