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

GPU-friendly + vectorized pareto ranking #32

Merged
merged 4 commits into from
Nov 25, 2022
Merged

Conversation

NaturalGradient
Copy link
Collaborator

A variety of QOL + performance changes for pareto-ranking related functionality. Together, I've observed performance speedups when running SteadStateGA (NSGA-II) with very large populations (e.g. 3,200), in the order of 20x faster training. In theory, the speedup should be even better on the GPU, which wasn't possible before, but that hasn't been tried out yet.

An overview of the changes:

  • Add _compute_pareto_ranks to evotorch.core that computes the rank tensor previously returned by the _pareto_sort_np function, but in a vectorized and GPU-friendly manner
  • Update _pareto_sort function of evotorch.core so that it uses the new _compute_pareto_ranks function
  • Update SolutionBatch.arg_pareto_sort() so that it complies with the update _pareto_sort function (crowdsort_upto argument no longer in use)
  • Add SolutionBatch.compute_pareto_ranks() function which skips the sparse computation of the fronts (useful when not needed)
  • Update SolutionBatch.take_best() function to use SolutionBatch.compute_pareto_ranks() rather than SolutionBatch.arg_pareto_sort()
  • Update evotorch.operators.base.CrossOver._do_tournament so that it uses SolutionBatch.compute_pareto_ranks() rather than SolutionBatch.arg_pareto_sort()

@codecov-commenter
Copy link

codecov-commenter commented Nov 1, 2022

Codecov Report

Merging #32 (23572d9) into master (a232d04) will decrease coverage by 0.30%.
The diff coverage is 89.70%.

❗ Current head 23572d9 differs from pull request most recent head 975e104. Consider uploading reports for the commit 975e104 to get more accurate results

@@            Coverage Diff             @@
##           master      #32      +/-   ##
==========================================
- Coverage   53.28%   52.97%   -0.31%     
==========================================
  Files          43       43              
  Lines        6223     6227       +4     
==========================================
- Hits         3316     3299      -17     
- Misses       2907     2928      +21     
Impacted Files Coverage Δ
src/evotorch/operators/base.py 32.71% <0.00%> (-0.31%) ⬇️
src/evotorch/core.py 65.54% <93.84%> (-1.00%) ⬇️
src/evotorch/logging.py 28.87% <0.00%> (+0.04%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Higgcz
Higgcz previously approved these changes Nov 23, 2022
timothyatkinson and others added 4 commits November 25, 2022 19:06
…hat it is now vectorized along the pareto front and uses torch tensors only

- Add _compute_pareto_ranks to evotorch.core that computes the rank tensor previously returned by the _pareto_sort_np function, but in a vectorized and GPU-friendly manner
- Update _pareto_sort function of evotorch.core so that it uses the new _compute_pareto_ranks function
- Update SolutionBatch.arg_pareto_sort() so that it complies with the update _pareto_sort function (crowdsort_upto argument no longer in use)
- Add SolutionBatch.compute_pareto_ranks() function which skips the sparse computation of the fronts (useful when not needed)
- Update SolutionBatch.take_best() function to use SolutionBatch.compute_pareto_ranks() rather than SolutionBatch.arg_pareto_sort()
- Update evotorch.operators.base.CrossOver._do_tournament so that it uses SolutionBatch.compute_pareto_ranks() rather than SolutionBatch.arg_pareto_sort()
@Higgcz Higgcz merged commit d3e3f0a into master Nov 25, 2022
@Higgcz Higgcz deleted the feature/fast-pareto branch November 25, 2022 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants