ENH: Added submodule numpy.random_intel#8209
ENH: Added submodule numpy.random_intel#8209oleksandr-pavlyk wants to merge 4 commits intonumpy:masterfrom
Conversation
numpy.random_intel is MKL-based alternative for numpy.random, first featured in the Intel Distribution for Python. It implements all distributions of numpy.random as well as numpy.random_intel.multinormal_cholesky, which allows for fast sampling from multinormal distribution when the Cholseky factor is known ahead of time. Module numpy.random_intel implements sampling from all distributions in a vectorized fashion, just like MKL does, which allows MKL to use vectorized instructions for efficiency. That means that instead of mtrand's rk_normal which produces a single variate sampled from normal distribution, mklrand offers vrk_normal_vec, which produces a vector of variates of requested size.
| void Py_XINCREF(object obj) | ||
|
|
||
| # CObject API | ||
| # If this is uncommented it needs to be fixed to use PyCapsule |
There was a problem hiding this comment.
Take a look at numpy/core/include/numpy/npy_3kcompat.h. Given the current organization, we might want to move that or this work. Not sure what the best organozation will be.
There was a problem hiding this comment.
Also note that PyCapsule is available in Python 2.7 and we no longer support earlier versions. In fact, PyCapsule has been used in numpy/random/mtrand/mtrand.pyx since 1.11.x was branched. As long as it is private, it no longer matters.
There was a problem hiding this comment.
I copied mtrand/Python.pxi over to `mklrand/Python.pxi'. Thanks!
|
What I notice at first glance are long lines (we like < 80 char/line) and not much documentation. There is It would be good to bring this up on the numpy mailing list for discussion: numpy-discussion@scipy.org. @rkern, @njsmith Thoughts? |
|
I've edited the PR description to link to the mailing list discussion in July on this. As far as I can judge from a browse of this PR, this implementation is still standalone and doesn't reflect the design @rkern said he preferred right? |
numpy has not been configured with MKL. Added special case of warning 'ignore' detection to skip random_intel/__init__.py, parallel to skipping random/__init__.py
address PR feedback
727f85e to
8bceebb
Compare
|
On Mon, Oct 24, 2016 at 4:03 PM, Oleksandr Pavlyk notifications@github.com
Hmm, I don't see any replies so far. Other projects that might be Chuck |
…e guidelines adopted by numpy
|
@oleksandr-pavlyk: So you know how this works... usually we use pull request comments to talk about details of code, and for higher-level discussions that affect public API (like: "should numpy have a |
|
Hmm, I don't see any replies so far. Other projects that might be
interested are scikit-learn and stats-models.
I've made my thoughts clear on the mailing list, in this incarnation and
the previous thread. This should be in a separate package.
|
|
@oleksandr-pavlyk Sounds like a separate package it is, so closing this. Thanks for your work on this. |
numpy.random_intelis MKL-based alternative fornumpy.random, firstfeatured in the Intel Distribution for Python.
It implements all distributions of
numpy.randomas well asnumpy.random_intel.multinormal_cholesky, which allows for fastsampling from multinormal distribution when the Cholesky factor
is known ahead of time.
Module
numpy.random_intelimplements sampling from all distributionsin a vectorized fashion, just like MKL does, which allows MKL to use
vectorized instructions for efficiency.
That means that instead of mtrand's
rk_normalwhich produces a singlevariate sampled from normal distribution, mklrand offers
vrk_normal_vec,which produces a vector of variates of requested size.
EDIT: link to mailing list design discussion on this feature: https://mail.scipy.org/pipermail/numpy-discussion/2016-July/075822.html