Hi,
In scikit-learn we really appreciate that the cython const memoryview feature
(
https://github.com/cython/cython/pull/1869) has been merged so thanks a lot
for that! The main reason: we encourage the use of read-only memmaps for
parallel computing through joblib and until #1869 we actually had to go back to
the older ndarray interface (see for example
https://github.com/scikit-learn/scikit-learn/pull/4775/files#diff-5d8b82d506a543bd684a1d403d5941e0).
Similar work-arounds were used in many other instances in pandas and
scikit-learn, some of them can be found in the original cython issue:
https://github.com/cython/cython/issues/1605.
After #1869 was merged, I was quite excited to try it out in
scikit-learn. I bumped into a few limitations that for now prevents
scikit-learn to fully move to const memoryviews:
-
https://github.com/cython/cython/issues/1772: const can not be used in
combination with fused types. A lot of our cython functions can take both 32
and 64 bit arrays so we would like to use const floating[:] for these
function parameters.
-
https://github.com/cython/cython/issues/2134: a non-const memoryview can not
be created from the copy of a const memoryview. This one is more a nice to
have than a blocker.
It would be really nice if both these issues were fixed in 0.28, but of course
as a non cython developer, it is rather hard to know how much time and effort
this represents. I saw that both issues were labelled "first good issues" so
maybe that does not represent to much effort from someone familiar with cython
code base? If you think that with a few pointers a cython newbie could get the
work done, I would be willing to work on PRs for these issues. If not, of
course I would be more than keen to test potential candidate fixes in
scikit-learn.
Cheers,
Loïc