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

Adding C-kernel #229

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Adding C-kernel #229

wants to merge 1 commit into from

Conversation

prisae
Copy link
Member

@prisae prisae commented Nov 1, 2024

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.)
benchmark

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.py and run pytest tests/test_model.py.

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

Successfully merging this pull request may close these issues.

1 participant