ledatelescope / bifrost

A stream processing framework for high-throughput applications.
BSD 3-Clause "New" or "Revised" License
66 stars 29 forks source link

More Python JIT compilation to remove API overhead #60

Closed MilesCranmer closed 7 years ago

MilesCranmer commented 7 years ago

Barak Zackay convinced me to try Numba. It is very easy and very fast. You tag a @jit decorator on pure python functions (which can use numpy arrays and methods inside), and Numba compiles them to the point where they are as fast as C and certainly faster than using pypy or another interpreter. This is for the future, but it would be interesting if we were to rewrite some of the Python API using Numba. Apparently, there is also a way to compile pure python into CUDA kernels.

A drawback of using Numba is that it is difficult to install the module if you are not using Conda. There is also a lack of optimizer support for python types like dictionaries and lists.

MilesCranmer commented 7 years ago

CUDA kernels with numba: http://numba.pydata.org/numba-doc/dev/cuda/kernels.html

ledatelescope commented 7 years ago

From my naive perspective, I think that benchmarking this in our context would be v. useful, but

There is also a lack of optimizer support for python types like dictionaries and lists.

worries me unless utilization in Bifrost w/ tensorflow syntax demotes the above to ancillary roles.

Makes sense?

Best,

Lincoln

On 1/13/17 10:59, Miles Cranmer wrote:

CUDA kernels with numba: http://numba.pydata.org/numba-doc/dev/cuda/kernels.html

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ledatelescope/bifrost/issues/60#issuecomment-272478158, or mute the thread https://github.com/notifications/unsubscribe-auth/AJfeMjV4MXyiRVR59U1klsFnvtHhhIfeks5rR59bgaJpZM4LjBRD.

-- Lincoln J. Greenhill Harvard-Smithsonian CfA Office: 1 617-495-7194 60 Garden St, Mail Stop 42 Cell: 1 650 722-7798 Cambridge, MA 02138 FAX: 1 617-495-7345 greenhill@cfa.harvard.edu Skype: ljgreenhill www.cfa.harvard.edu/~lincoln

MilesCranmer commented 7 years ago

Hi Lincoln,

It is a good point. I will append and not prepend this feature to my Bifrost to-do list. In the near-term, however, numba might be useful for rapid testing of computationally heavy blocks, especially when they involve GPUs.

Best,

Miles

On Fri, Jan 13, 2017 at 11:23 AM, LEDA Collaboration < notifications@github.com> wrote:

From my naive perspective, I think that benchmarking this in our context would be v. useful, but

There is also a lack of optimizer support for python types like dictionaries and lists.

worries me unless utilization in Bifrost w/ tensorflow syntax demotes the above to ancillary roles.

Makes sense?

Best,

Lincoln

On 1/13/17 10:59, Miles Cranmer wrote:

CUDA kernels with numba: http://numba.pydata.org/numba- doc/dev/cuda/kernels.html

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ledatelescope/bifrost/issues/ 60#issuecomment-272478158, or mute the thread https://github.com/notifications/unsubscribe-auth/ AJfeMjV4MXyiRVR59U1klsFnvtHhhIfeks5rR59bgaJpZM4LjBRD.

-- Lincoln J. Greenhill Harvard-Smithsonian CfA Office: 1 617-495-7194 <(617)%20495-7194> 60 Garden St, Mail Stop 42 Cell: 1 650 722-7798 <(650)%20722-7798> Cambridge, MA 02138 FAX: 1 617-495-7345 <(617)%20495-7345> greenhill@cfa.harvard.edu Skype: ljgreenhill www.cfa.harvard.edu/~lincoln

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ledatelescope/bifrost/issues/60#issuecomment-272480982, or mute the thread https://github.com/notifications/unsubscribe-auth/AHPcRCXu6mkXlSpjeVnAI9y5NCE5MDbJks5rR6T7gaJpZM4LjBRD .

caseyjlaw commented 7 years ago

FWIW, I also hesitated to move my code (e.g., our rtpipe stuff) to the conda installer for a while. Numba and other pydata projects compelled me to do so. I'm happy I did!