Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CPU utilization for long running fitness functions #197

Closed
jenetics opened this issue Apr 21, 2017 · 2 comments
Closed

Improve CPU utilization for long running fitness functions #197

jenetics opened this issue Apr 21, 2017 · 2 comments
Assignees
Milestone

Comments

@jenetics
Copy link
Owner

jenetics commented Apr 21, 2017

Jenetics is calculating the fitness values for each generation concurrently. The main assumption is, that the calculation of the fitness function is relatively cheap and the calculation costs are constant for all genotypes. With this assumption in mind, the population is split into sub-populations, which group the fitness function into bigger evaluation units. This should reduce the evaluation overhead. If we have to deal with long-running fitness functions, or with fitness function with unpredictable computation costs, the existing computation strategy no longer works as expected. We get idle CPU cores.

This ticket is about to improve the CPU utilization for long-running fitness functions and for fitness functions with non-constant evaluation costs.

See
#196

Hint
Consider usage of getSurplusQueuedTaskCount() method.

@Override
protected void compute() {
	if ((_high - _low) <= 1 || ForkJoinTask.getSurplusQueuedTaskCount() > 3) {
	//if (_high - _low < threshold) {
		for (int i = _low; i < _high; ++i) {
			_runnables.get(i).run();
		}
	} else {
		final int mid = (_low + _high) >>> 1;
		invokeAll(
			new RunnablesAction(_runnables, _low, mid, threshold),
			new RunnablesAction(_runnables, mid, _high, threshold)
		);
	}
}
@dyorgio
Copy link

dyorgio commented Apr 21, 2017

Hi, where can I get a preview? Do you will create a new branch?
I can test for you :)

jenetics added a commit that referenced this issue Apr 23, 2017
The value can be changed with the 'io.jenetics.concurrency.splitThreshold' system property.
jenetics added a commit that referenced this issue Apr 23, 2017
The value can be changed with the 'io.jenetics.concurrency.maxBatchSize' system property.
jenetics added a commit that referenced this issue Apr 23, 2017
jenetics added a commit that referenced this issue Apr 23, 2017
jenetics added a commit that referenced this issue Apr 24, 2017
@jenetics
Copy link
Owner Author

Merged into r3.8.0 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants