manodeep / Corrfunc

⚡️⚡️⚡️Blazing fast correlation functions on the CPU.
https://corrfunc.readthedocs.io
MIT License
166 stars 51 forks source link

Corrfunc 3.0 release discussion #328

Open manodeep opened 2 months ago

manodeep commented 2 months ago

@lgarrison To guide what needs to/could happen for Corrfunc 3.0, here is my list:

Essential (?)

Possibly (?)

May be (?)

This is also open for community discussion. If anyone has opinions on what should go in, please do add a comment.

lgarrison commented 2 months ago

Add modern packaging with pyproject.toml / meson / whatever-else-we-should-be-using

I see a packaging and build-system overhaul as the top priority for improving the user experience in Corrfunc 3. I have a student working on a prototype right now that uses meson, meson-python, and pybind11. The basic setup seems to work, and we're looking at runtime SIMD dispatch now. I would love to be able to build and distribute binaries for Corrfunc 3! When the code is ready to share, I'll link it here.

manodeep commented 2 months ago

That sounds great!

Any reason to go with pybind11 rather than cffi? Is that to future-proof in case we switch to C++ code?

lgarrison commented 2 months ago

Any reason to go with pybind11 rather than cffi? Is that to future-proof in case we switch to C++ code?

Yeah, future-proofing was part of it. Pybind11 is also a better developer experience; it tends to emit informative error messages instead of segfaults! It's also NumPy-aware, which makes it easy to enforce conditions on the memory order and shape of arrays.

manodeep commented 2 months ago

@lgarrison Would nanobind be a drop-in replacement for pybind11?

I really like how @dfm used templating within simple functions with C++ and nanobind - see here.

lgarrison commented 2 months ago

I think it would be great to use nanobind! Meson isn't an officially supported build system for nanobind so I decided to stick with pybind11 for the summer project, but I don't think it would be very hard to figure nanobind out. At the API level, it would probably be nearly a drop-in replacement since our usage is simple.

manodeep commented 2 months ago

Excellent!

What do you think about adding Typing into the function parameters? Looking at astropy code, type hints do seem to remove a lot of redundant code from the function body (into the function declaration ... )

lgarrison commented 2 months ago

I'm all for type hints! However, type hints don't have any effect at runtime, so it wouldn't let us remove code from the function body. They're just used by type checkers, language servers, and other static analysis tools.

I do think we could improve/change the Python API, including type hints. E.g. some positional arguments could probably be keyword arguments, and the return type should probably be a columnar container like a pandas df or an Astropy table (or maybe just a dict/dataclass of arrays). It's something we can iterate on once we get the harder (build system) stuff working.