### How to reimplement Function::eval in cuda-compatible cpp ?

89
views
0
4 months ago by
Hello, I am trying to rebuild a silicon detector simulator including Cuda implementatio of the electron drifting. I do not need GPU for solving Poisson's equation, only for moving particles inside the calculated electric field. The problem I encounter is that I need to call Function::eval from the GPU in order to get the value of the fields in a given point but I cannot call directly fenics' specific functions withing device(GPU) code in cuda. My first approach is to create my own map of values and pass that to the GPU but it seems very inneficient to me.

Is there a way to replace Function::eval with a function of my own that would have similar behaviour but would not require calling fenics functions for sampling the given field?
Maybe there is a cuda-compatible version of fenics that I am not aware of? If so it would be ideal if it was 1.6 or lower since I would have to fix compatibility of the simulator for higher versions.

In case it helps, the code (only for CPU) can be seen here: https://github.com/IFCA-HEP/TRACS/ . The part of the simulation I am focusing on implementing in Cuda is Carrier::simulate_drift(double dt, double max_time, double x_init, double y_init )

Thank you very much for any help

Alvaro Diez
Community: FEniCS Project