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 Usage #917

Open
danaperrymartin opened this issue Jun 5, 2024 · 3 comments
Open

GPU Usage #917

danaperrymartin opened this issue Jun 5, 2024 · 3 comments

Comments

@danaperrymartin
Copy link

I wold like to run floris simulations using my RTX Titan Nvidia GPU. Is this pos?

@rafmudaf
Copy link
Collaborator

rafmudaf commented Jun 5, 2024

No, not at the moment. You could try using incorporating Numba, but I don't think you'll see any speed up. In fact, it may even be slower. FLORIS sequentially steps through each turbine and applies its wake to the wake field. Because of this, you would be doing a lot of data transfer to the device and using only a tiny portion of that data. If you want to add support for GPUs, I'm happy to work with you to develop an appropriate solver algorithm.

FLORIS uses SIMD vectorization over the atmospheric condition dimensions via NumPy and numexpr. I suppose if you have a small number of wind turbines and a large number of atmospheric conditions, you might see some gain by moving the current solver algorithm to a GPU.

@danaperrymartin
Copy link
Author

That makes sense that it is a temporally and spatially dependent problem and not quite as similar to training cnn's as I had originally thought. I understand there are several ways to approach the solving of ODE's, it looks like you guys are marching from one end of the grid to another (forward difference?), and not much flexibility for doing the math in parallel given the temporal and spatial dependence of the problem.

@misi9170
Copy link
Collaborator

misi9170 commented Jun 6, 2024

Most FLORIS models do not actually involve solving differential equations; rather, analytical expressions for the wakes are evaluated at each turbine location. However, the wake at a downstream turbine's location depends on the thrust produced by upstream turbines, so we do need to step through the turbines from the most upstream to the most downstream sequentially (this is the main for loop in FLORIS, which we can't parallelize).

On the other hand, in FLORIS we solve many different wind conditions (wind speed, wind direction, turbulence intensity tuples) simultaneously. Each condition may produce a different ordering of the turbines, and then the main for loop steps through the most upstream to most downstream for each condition. This is what @rafmudaf was mentioning regarding the atmopsheric condition dimension. This simultaneous solve could, conceivably, be run in parallel on GPUs---currently, it runs "in parallel" in the sense that the operations are vectorized and run using numpy arrays. However, my limited understanding of GPU operations is that converting from these numpy array structures to a GPU-ready format is not trivial, and at this stage we don't have a plan to take that step.

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

3 participants