empymod
empymod copied to clipboard
Adding C-kernel
C-Kernel
@JanThorbecke and I implemented a C-kernel, simply out of curiosity to compare to the existing Numba Kernel.
Benchmarking has shown that, in the case of empymod, the speed between Numba and C is very comparable. (Different runs will show slightly different results, don't over-interpret the figure.)
To make use of the C-kernel you have to download/clone the repo, checkout the branch c-kernel, and run make install in the root directory. If you then set ht='cdlf' (instead of ht='dlf'), the C-kernel will be used.
- Installation
git clone [email protected]:emsig/empymod cd empymod git switch c-kernel make install # or `make dev-install` - Using in Python
import empymod emfield = empymod.bipole( src=..., # your normal inputs rec=..., depth=..., res=..., freqtime=..., ht='cdlf', # Ensure to set ht to 'cdlf' )
Please post question and feedback regarding the C-kernel in this PR.
There are still some edge-cases where the C-Kernel produces different results. To test and debug, run, e.g.:
-
pytest tests/test_kernel.py -
pytest tests/test_transform.py - Uncomment lines 16 and 17 in
tests/test_model.pyand runpytest tests/test_model.py.