<div dir="ltr"><div><div><div><div><div><div>Hi all,<br><br></div>Thanks Jaime for pinging me, I don't follow scipy-dev regularly.<br><br></div>My
frustration with the first release of poliastro, a Python library for
astrodynamics that I created some years ago, was that it mixed MATLAB
(Octave), FORTRAN (all caps) and Python code and that it was a mess to
distribute (this was 2013). I had no experience with C so Cython looked
intimidating to me (I even tried to do some debugging recently and
simply couldn't cope with cython-gdb, see <a href="https://groups.google.com/d/msg/cython-users/SCk2IDG9M5g/muhUhmw9AwAJ" target="_blank">https://groups.google.com/d/<wbr>msg/cython-users/SCk2IDG9M5g/<wbr>muhUhmw9AwAJ</a>).
When I saw that I could achieve a decent performance with numba, I
threw away all the FORTRAN and now the library is pure Python.<br><br></div>For
some releases, my approach was exactly what Ralf said: have a `@jit`
decorator that selected what to do depending on whether numba was
installed. This was nice because there was no easy way to install numba
with pip when I started, and in doing so I guaranteed performance with
`conda install poliastro` and a working system with `pip install
poliastro`.<br><br><a href="https://github.com/poliastro/poliastro/blob/0.6.x/src/poliastro/jit.py" target="_blank">https://github.com/poliastro/<wbr>poliastro/blob/0.6.x/src/<wbr>poliastro/jit.py</a><br><br></div>However,
now there are wheels on PyPI for both numba and llvmlite, so I removed
the conditional `@jit` and included numba as a required dependency
(except on PyPy):<br><br><a href="https://github.com/poliastro/poliastro/blob/master/setup.py#L40" target="_blank">https://github.com/poliastro/<wbr>poliastro/blob/master/setup.<wbr>py#L40</a><br><br></div><div>As a last note, numba works beautifully with C code through CFFI:<br><br><a href="https://www.anaconda.com/blog/developer-blog/calling-c-libraries-numba-using-cffi/" target="_blank">https://www.anaconda.com/blog/<wbr>developer-blog/calling-c-<wbr>libraries-numba-using-cffi/</a><br><a href="http://old.pybonacci.org/2016/02/07/como-crear-extensiones-en-c-para-python-usando-cffi-y-numba/" target="_blank">http://old.pybonacci.org/2016/<wbr>02/07/como-crear-extensiones-<wbr>en-c-para-python-usando-cffi-<wbr>y-numba/</a> [my take, in Spanish]<br></div><div><br></div>I
understand the concerns about numba because it used to work only with
conda and "it comes from a company" (which some people consider a bad
thing). numba is no doubt a complex project, but the devs are committed
to it and the installation and packaging are now few (specially compared
to the situation we had in 2013). Also, the Julia folks will drive the
LLVM ecosystem to more platforms I would say.<br><br></div>Hope this helps!<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 7, 2018 at 9:40 AM, Jaime Fernández del Río <span dir="ltr"><<a href="mailto:jaime.frio@gmail.com" target="_blank">jaime.frio@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, Mar 7, 2018 at 9:02 AM Ralf Gommers <<a href="mailto:ralf.gommers@gmail.com" target="_blank">ralf.gommers@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 6, 2018 at 1:55 PM, Stephan Hoyer <span dir="ltr"><<a href="mailto:shoyer@gmail.com" target="_blank">shoyer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Numba does have a mechanism for exporting pre-compiled code: <a href="http://numba.pydata.org/numba-doc/dev/user/pycc.html" target="_blank">http://numba.pydata.org/<wbr>numba-doc/dev/user/pycc.html</a><div><br></div><div>It would be interesting to see if those limitations are flexible enough for SciPy.</div></div></blockquote><div><br></div><div>I suspect that (a) we're then going to run into more Numba bugs because pre-compilation is not well-tested, and (b) we throw away some of the advantages of Numba, e.g. we then get back the binary size explosion for multiple dtype templating.<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="m_-6573661952433176632m_2986242801949315916gmail-m_3992264896273130889HOEnZb"><div class="m_-6573661952433176632m_2986242801949315916gmail-m_3992264896273130889h5"><br><div class="gmail_quote"><div dir="ltr">On Tue, Mar 6, 2018 at 1:21 PM CJ Carey <<a href="mailto:perimosocordiae@gmail.com" target="_blank">perimosocordiae@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I think adding a required runtime dependency may be overly restrictive, given scipy's position near(-ish) the base of the scientific computing pyramid.<div><br></div><div>Would it be possible to run numba-optimized code on systems with numba installed without impacting "vanilla" users?</div></div></blockquote></div></div></div></blockquote><div><br></div><div>It's worth thinking about. We could put a jit decorator in scipy._lib that becomes numba @jit if numba is installed and is do-nothing otherwise.<br></div></div></div></div></blockquote><div><br></div><div>I'll admit I have a "fear of the unknown" mistrust of numba, but reading through this thread I was thinking of something like this as being something even I would have no problem with.</div><div><br></div><div>Juan Luis Cano, who probably reads this, but who I have just in case CCed in this e-mail, is the author of <a href="https://github.com/poliastro/poliastro" target="_blank">https://github.com/<wbr>poliastro/poliastro</a>, a numerical library that gave up on Fortran/Cython/C by design and embraced Numba from the start, would be nice to hear his take on making it a dependency.</div><div><br></div><div>Jaime</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div> </div>Ralf<br><br></div></div></div>
______________________________<wbr>_________________<br>
SciPy-Dev mailing list<br>
<a href="mailto:SciPy-Dev@python.org" target="_blank">SciPy-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scipy-dev" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/scipy-dev</a><span class="HOEnZb"><font color="#888888"><br>
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br clear="all"><div><br></div>-- <br><div dir="ltr" class="m_-6573661952433176632m_2986242801949315916gmail_signature">(\__/)<br>( O.o)<br>( > <) Este es Conejo. Copia a Conejo en tu firma y ayúdale en sus planes de dominación mundial.</div></font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Juan Luis Cano<br></div></div></div></div>
</div>