Skip to content

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.

2 participants