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

How can I use GPU instead of multiprocessing or scoop in DEAP? #684

Open
ppseverin opened this issue Jan 19, 2023 · 4 comments
Open

How can I use GPU instead of multiprocessing or scoop in DEAP? #684

ppseverin opened this issue Jan 19, 2023 · 4 comments

Comments

@ppseverin
Copy link

Hi! I'm new to using GPU to speed up computations, so this might be a silly question. I have a script that uses DEAP and actually it uses multiprocessing. I would like to use my GPU (it's a RTX 3080 TI, in case it's important to know) to speed up calculations and the whole process. I googled for some examples of how to do it, but couldn't find any :(. Is this possible? How can I achieve this?

@fmder
Copy link
Member

fmder commented Jan 19, 2023

Hi, no silly questions! You'll need to code your evaluation function in a GPU compatible langage such as Numba or CuPy or Pytorch core. However, moving from cpu to gpu has a lot of overhead, you may need to group the evaluation of your whole population together to observe speedup.

@Mujtaba1986
Copy link

Last I checked about this a year ago, I found DEAP does not support this.

@fmder
Copy link
Member

fmder commented Feb 1, 2024 via email

@Leon-Qiao
Copy link

Leon-Qiao commented Mar 26, 2024

I also encountered a similar situation. The main task of my evaluation function was to make predictions through a pre-trained deep-learning model. I gave up using the map function, directly fed the list of individuals into the evaluate function, and converted it into a NumPy array. The return value of the evaluate function was also a batch of fitnesses. By implementing batch calculations instead of using the map to iterate over a list with multiple single-sample calls, the efficiency of my genetic algorithm dramatically improves.

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

No branches or pull requests

4 participants