Run a task on all available CPUs.

@param ids IDs to process
@param procs Processors to run
18434
public static void run(DBIDs ids, Processor... procs) {
    ParallelCore core = ParallelCore.getCore();
    core.connect();
    try {
      // TODO: try different strategies anyway!
      ArrayDBIDs aids = DBIDUtil.ensureArray(ids);
      final int size = aids.size();
      int numparts = core.getParallelism();
      // TODO: are there better heuristics for choosing this?
      numparts = (size > numparts * numparts * 16) ? numparts * Math.max(1, numparts - 1) : numparts;

      final int blocksize = (size + (numparts - 1)) / numparts;
      List<Future<ArrayDBIDs>> parts = new ArrayList<>(numparts);
      for(int i = 0; i < numparts; i++) {
        final int start = i * blocksize;
        final int end = Math.min(start + blocksize, size);
        Callable<ArrayDBIDs> run = new BlockArrayRunner(aids, start, end, procs);
        parts.add(core.submit(run));
      }

      for(Future<ArrayDBIDs> fut : parts) {
        fut.get();
      }
    }
    catch(ExecutionException e) {
      throw new RuntimeException("Processor execution failed.", e);
    }
    catch(InterruptedException e) {
      throw new RuntimeException("Parallel execution interrupted.");
    }
    finally {
      core.disconnect();
    }
  }
316678
private void processProjectID()
   {
      if (m_projectID == null)
      {
         List<Row> rows = getRows("project", null, null);
         if (!rows.isEmpty())
         {
            Row row = rows.get(0);
            m_projectID = row.getInteger("proj_id");
         }
      }
   }
47731
private static void addProcessors(final Processor processor, final String... keys) throws IllegalStateException {
        for (final String key : keys) {
            addProcessor(key, processor);
        }
    }
1107445
private void getExecutionIdsHelper(final List<Integer> allIds,
      final Collection<Pair<ExecutionReference, ExecutableFlow>> collection) {
    collection.stream().forEach(ref -> allIds.add(ref.getSecond().getExecutionId()));
    Collections.sort(allIds);
  }
1224541
public void deleteHistoricExternalTaskLogsByProcessInstanceIds(List<String> processInstanceIds) {
    deleteExceptionByteArrayByParameterMap("processInstanceIdIn", processInstanceIds.toArray());
    getDbEntityManager().deletePreserveOrder(HistoricExternalTaskLogEntity.class, "deleteHistoricExternalTaskLogByProcessInstanceIds", processInstanceIds);
  }
645538
public BldResPath jsPostProcessors( JSPostProcessor ... procs) {
        prodModePostProcessors.clear();
        for (int i = 0; i < procs.length; i++) {
            prodModePostProcessors.add(procs[i]);
        }
        return this;
    }
1261738
protected CompletableFuture<Map<Integer,ClientResponse>> callNTProcedureOnAllHosts(String procName, Object... params) {
        return m_runner.callAllNodeNTProcedure(procName, params);
    }
1201754
private void processPredecessors() throws SQLException
   {
      List<Row> rows = getRows("select * from " + m_schema + "taskpred where proj_id=? and delete_date is null", m_projectID);
      m_reader.processPredecessors(rows);
   }
188336
def set_mpi_procs(self, mpi_procs):
        """"""
        QueueAdapter.set_mpi_procs(self, mpi_procs)

        num_nodes, rest_cores = self.hw.divmod_node(mpi_procs, omp_threads=1)
        if num_nodes == 0:
            self.qparams["nodes"] = 1
            self.qparams["ppn"] = mpi_procs
        else:
            if rest_cores != 0:
                # Pack cores as much as possible.
                num_nodes += 1
            self.qparams["nodes"] = num_nodes
            self.qparams["ppn"] = self.hw.cores_per_node
735674
public void execute(org.parallelj.mirror.Process process) {

		if (!(process instanceof KProcess)) {
			return;
		}
		this.execute((KProcess) process);
	}
267855
public function process($processors = null)
    {
        if ($processors === null) { // Use the default and registered processors.
            $processors = self::processors();
        }
        if (is_array($processors) === false && is_callable($processors)) {
            $processors = [$processors];
        }
        foreach ($processors as $processor) {
            $processor($this);
        }
    }
931292
public void addProcessorExecution(ProcessorExecution status) {
        lock.lock();
        try {
            processorExecutions.add(status);
        } finally {
            lock.unlock();
        }
    }
1216093
public void setProcessorMaxThreads(int maxThreads) {
        if (processor.getCorePoolSize() > maxThreads) {
            processor.setCorePoolSize(maxThreads);
        }
        processor.setMaximumPoolSize(maxThreads);
    }
89655
public static void runAsyncTask(Object context, int asyncTaskId, Object... args) {
		
		if(!ProfileService.getInstance(context).isActive(context, Profile.THREADING)) {

			StringBuilder builder = new StringBuilder()
			.append("Async task with ID ")
			.append(asyncTaskId)
			.append("cannot be run since the threading profile is inactive.");
			
			Log.w("Async task cannot ", builder.toString());

			return;
		}
		
		TaskManagers.ASYNC.execute(context, asyncTaskId, args);
	}
99489
public void processTasks(List<Row> bars, List<Row> expandedTasks, List<Row> tasks, List<Row> milestones)
   {
      List<Row> parentBars = buildRowHierarchy(bars, expandedTasks, tasks, milestones);
      createTasks(m_project, "", parentBars);
      deriveProjectCalendar();
      updateStructure();
   }
1287963
public void setIds(java.util.Collection<String> ids) {
        if (ids == null) {
            this.ids = null;
            return;
        }

        this.ids = new com.amazonaws.internal.SdkInternalList<String>(ids);
    }
759131
@Override
    public final void start(final Collection<? extends Location> locations) {
        if (DynamicTasks.getTaskQueuingContext() != null) {
            doStart(locations);
        } else {
            Task<?> task = Tasks.builder().name("start (sequential)").body(new Runnable() {
                public void run() {
                    doStart(locations);
                }
            }).build();
            Entities.submit(this, task).getUnchecked();
        }
    }