opened
WeatherGod
username_0
I am giving the master branch a try to see if my usage of sgp4 could be sped up. I am getting a "numba lowering error" (traceback below).

I suspect this is actually a numba bug rather than a problem with sgp4, but I haven't spent enough time with numba to know for sure. Have you been able to successfully use numba with sgp4? Have you considered using cython instead?

```
Failed at object (object mode frontend)
Caused By:
Traceback (most recent call last):
  File "/home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/numba/compiler.py", line 238, in run
    stage()
  File "/home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/numba/compiler.py", line 599, in stage_objectmode_backend
    self._backend(lowerfn, objectmode=True)
  File "/home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/numba/compiler.py", line 576, in _backend
    lowered = lowerfn()
  File "/home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/numba/compiler.py", line 550, in backend_object_mode
    self.flags)
  File "/home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/numba/compiler.py", line 882, in py_lowering_stage
    lower.lower()
  File "/home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/numba/lowering.py", line 135, in lower
    self.lower_normal_function(self.fndesc)
  File "/home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/numba/lowering.py", line 176, in lower_normal_function
    entry_block_tail = self.lower_function_body()
  File "/home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/numba/lowering.py", line 201, in lower_function_body
    self.lower_block(block)
  File "/home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/numba/lowering.py", line 216, in lower_block
    self.lower_inst(inst)
  File "/home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/numba/errors.py", line 249, in new_error_context
    six.reraise(type(newerr), newerr, sys.exc_info()[2])
  File "/home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/numba/errors.py", line 243, in new_error_context
    yield
  File "/home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/numba/lowering.py", line 216, in lower_block
    self.lower_inst(inst)
  File "/home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/numba/objmode.py", line 131, in lower_inst
    self.delvar(inst.value)
  File "/home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/numba/objmode.py", line 534, in delvar
    self._live_vars.remove(name)
LoweringError: 'sineo1'
File "../../scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/sgp4/propagation.py", line 1742
[1] During: lowering "del sineo1" at /home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/sgp4/propagation.py (1742)

Failed at object (object mode backend)
'sineo1'
File "../../scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/sgp4/propagation.py", line 1742
[1] During: lowering "del sineo1" at /home/broot/scratch/miniconda/envs/floodmappy4/lib/python2.7/site-packages/sgp4/propagation.py (1742)
```
numba acceleration not working?
issue
created
ckuethe
username_1
I can reproduce this with both numba 0.23 and 0.34.. I'll bisect to see where it broke but this smells like numba is unhappy with passing more complex objects around, rather than simple types like ints, floats, or booleans.
comment
created
WeatherGod
username_0
I am back on this... Which version of numba were you using that worked?
comment
created
brandon-rhodes
username_2
(I won't interrupt except to confirm that I haven't yet had time to sit down and seriously wrestle with Numba and the library, so I've not yet run into this behavior.)
comment
created
WeatherGod
username_0
I have brought this issue to the attention of a numba developer here at the SciPy 2018 coding sprints. It would still help to know which version of numba works for debugging purposes.
comment
created
ckuethe
username_1
I'm back to hacking on this too with python 2.7.15rc1 / python 3.6.5 + numba 0.39.0 + 0.24.0

Right now the `_dspace` function is the hot spot. If you don't jit anything else, do this one. It's safe to `@jit(cache=True, nopython=True)`.

I would eventually like to get this into a state where all of sgp4 could be jitted; I'll have to see if I can construct a test harness to figure out what it would win us to have the whole thing be compiled.
comment
created
brandon-rhodes
username_2
As the Numba approach never quite worked, and as the library now compiles Vallado’s C++ directly where the system supports it, I am going to close this issue. Thanks for making this experiment in speeding up the library!
comment
closed
brandon-rhodes
username_2
issue