This repository has been archived by the owner on Dec 22, 2021. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Due to instabilities with Numba, lack of proper documentation, and hard-to-debug codes, @leouieda and I thought that would be better to migrate the Tesseroid forward calculations to Cython. This new Cython code have been recovered from an old commit (d2ef02d) and adapted to work with the new tesseroid.py, and the new stack algorithm (see Uieda2016).
Although Numba is a lot easier to write, I think is only better than Cython for high performance calculations where variables have simple types. I'm currently working on improvements in Tesseroid forward calculation and I need to manipulate more sophisticated variables, such as passing functions as arguments.
On the other hand, comparing the speed of the Numba code with this new Cython code, the later is faster than the former. The following codes takes around 18s to run using the Numba code, and 10s using this Cython code (in a Intel i3 2.4Ghz processor). This big difference is mainly due to the fact that the Numba code must be compiled on the first run.
Comparing both codes with a mesh of Tesseroid gives more similar times, but Cython keeps winning.
Numba takes 136s and Cython 116s (tested on the same CPU).
The tests will fail because pytest does not recognize when Cython raises an OverflowError as such, but it throws a Segmentation Fault. The code raises the proper OverflowError when the tesseroid stack tries to be bigger than the STACK_SIZE, so I assume that the problem is in the pytest function. If anyone knows how to overcome this, any advise would be helpful.
Checklist:
doc/install.rst
,environment.yml
,ci/requirements.txt
.cd doc; make
locally)doc/contributors.rst
(leave for last to avoid conflicts)