Skip to content

Conversation

@dsfulf
Copy link

@dsfulf dsfulf commented Jan 21, 2020

Addition of numba JIT'ing to a number of different functions. JITKW is a constant passed to each @jit decorator to easily enable/disable the compilation.

Several functions also have a parallel kwarg to turn it on and off. I've tested a number of functions with parallel=True, and many of them will crash due to what I believe is accessing mutable objects in a shared memory space. I've added a comment these.

I've also found that several functions run faster without parallelization. I've also added a comment to note these.

In order to add numba acceleration to the kb2d function, I've had to remove all objects from the JIT'ed code. This includes the scipy.cKDTree object, which is instead evaluated prior to being passed into the compiled function. While this increases memory use, the computation time is decreased by a factor of >100, so the trade-off is worth it for most problems. Because of this significant change, I've created a new function kb2d_jit that is accelerated, and left the kb2d function as it was. Reimplementation of the k-d tree to allow numba compilation, would reduce the memory usage, but some language features used by scipy.KDTree aren't currently supported so it would require significant rework.

There's also an immense amount of reformatting, and a lot of unnecessary white space deletion. This is done by an auto-formatting tool, autopep8, to make the code conform to PEP 8 standards.

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