EcologicalNetworks.jl
EcologicalNetworks.jl copied to clipboard
GPU compatability
As part of MetacommunityDynamics.jl, we want to be able to use EN.jl types and generative models on GPUs.
Here's a running list of my understanding of the changes required to use EN.jl with DynamicGrids.jl on a GPU:
- [ ] Non-mutable structs for (Unipartite/Bipartite) networks. This could be done via a wrapper around
UnipartiteNetworkandBipartiteNetwork(e.g.GPUUnipartiteNetwork)
A few points of clarification. A wrapper wouldn't be sufficient, as none of the contents can be mutable either. The object needs to be isbits(obj) = true. What could work is e.g. a StaticUnipartideNetwork built on StaticArrays.jl and modified with Accessors.jl.
Additionally, this is required to work with DynamicGrids.jl even on CPU.
Additionally, this is required to work with DynamicGrids.jl even on CPU.
This is only in the case that you want to use a UnipartiteNetwork/BipartiteNetwork as a custom grid-element, correct? This may be the case for some applications but not all
Yep as the content of a grid on CPU, and as any part of a model on GPU. I don't really know how this package works :)
It's also possible to use immutable structs for the networks and swap the Vectors for CuArray, if the networks are just fields in a rule.
So... the types used to be immutable (but not the content of the fields), and it was a lot more trouble for many, many applications. But this is clearly something I'd like to have at some point. I'm happy to discuss more.
I think a possible solution here would be wrapper types which via macro could convert as-existing EN.jl network types to immutable supertype of each EN.jl type (e.g. GPUUnipartiteNetwork, etc) prior to deploying on GPU