-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
ENH: Added submodule numpy.random_intel #8209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Added submodule numpy.random_intel #8209
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: [email protected]. @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 [email protected]
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_intel
is MKL-based alternative fornumpy.random
, firstfeatured in the Intel Distribution for Python.
It implements all distributions of
numpy.random
as 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_intel
implements 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_normal
which 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