-
Notifications
You must be signed in to change notification settings - Fork 2
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
Clarify what is meant by "kernel" #10
Comments
I agree that the use of "kernel" is a too loose at the moment. I still struggle to give a closed definition to it. I've been using this name for grouping a set of low-level functions used in the forward models for gravity and magnetics. The name "kernel" is inherited from the integral kernels involved in the forward modelling functions of potential fields. where For the gravity potential it would be: And for magnetic potential (in absence of currents): If we want to continue with this idea of a "kernel" function, then the physical properties (density and magnetization) must be included in them.
I agree. In my head the implementation of the magnetic dipole would ask the coordinates of the observation point, the coordinates of the dipole and its magnetization vector.
For now I'm only adding functions without the for loops, so: single computation point and single source. There is a broad interest in having those functions without the for loops. Nevertheless, there are some caveats. We perform the prism forward model by evaluating the analytical solution to these integrals, so we are not actually computing the integral kernel. Should we use a different name for that function then? Which one? Could we still include it in the "kernel" group? |
After a discussion we had during a meeting this week we decided to stick with the following design for Choclo. Everything is JIT compiledWe could offer non-jit compiled versions of our functions, although there are some caveats. Some functions are written to support floats (like the Besides, the forward modelling functions we will offer in Choclo (single source, single computation point) are meant to be run using Numba for loops, so it makes sense for everything to be JIT compiled. No external loopsChoclo will not offer (at least for now) functions that compute forward models over sets of computations points and/or sets of sources. It will only offer forward modelling functions for single computation point and single source. Full forward modelimport choclo as ch
@numba.jit(parallel=True)
def gravity_potential(...):
result = np.zeros(N)
for point in prange(N):
for source in range(M):
result[point] += ch.point.gravity_pot(...)
return result Build Jacobian matriximport choclo as ch
@numba.jit(parallel=True)
def jacobian(...):
A = np.empty(shape)
for i in prange(shape[0]):
for j in range(shape[1]):
A[i, j] = ch.point.gravity_pot(..., density=1) ArchitectureChoclo will be split in submodules, one for each source type plus a Each submodule will have a two level system of functions.
DocsThe docs will include instructions on how to use Choclo functions properly and in an optimized way, showing examples on how to build a full forward model and a Jacobian matrix. |
It would be great to clarify this in the Project Goals. For example, I noticed that the functions don't include universal constants or physical properties. For gravity, this is ok since getting the gravity field is a matter of simple multiplication. For magnetics, the combination is a bit more difficult since it involves a dot product with the vector magnetisation. So it would be worth having that in a function already instead of requiring users to code it. It also may be necessary since doing it out of the jit compiled function would mean losing parallel and low memory execution.
It would be worth clarifying the scope of the package with this in mind. A good way to go about it would be to try to add a magnetic dipole implementation to see how it fits with the current paradigm.
Or maybe the "kernel" could mean the version without the for loops? It may be worth making that available in the API for use in external jit-compiled code (like tesseroids).
The text was updated successfully, but these errors were encountered: