Repository navigation
Add dpnp.random.Generator on the oneMKL device RNG API
#3157
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
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
e0c61a6
Add dpnp.random.Generator on the oneMKL device RNG API
ndgrigorian 7fc1ecb
Address the review of the device RNG Generator
ndgrigorian a8f0976
Address the second review of the device RNG Generator
ndgrigorian 6a9b08f
Use oneMath's device RNG API in a oneMath build
ndgrigorian 30846c8
Wrap the Generator docstring lines at 80 columns
ndgrigorian 7d63c29
Name oneMath next to oneMKL in the Generator docs
ndgrigorian bc94247
Note that list and NumPy array parameters wait for the queue
ndgrigorian dec51f9
Skip the CuPy uniform KS test on devices without fp64
ndgrigorian 70c3737
Pin the float64 random and standard_normal values to the Philox refer…
ndgrigorian 7961c51
Test that an array scale of normal applies per element
ndgrigorian f86cc96
Read parameters broadcast along the leading dimensions without a copy
ndgrigorian bd28863
Take the modulo only for parameters smaller than the result
ndgrigorian dcfa23b
Skip the NumPy checks for Python scalar parameters
ndgrigorian 53ebab4
Say that array parameters may be smaller than the result in the docst…
ndgrigorian ec90e44
Say that standard_normal takes dtype as NumPy does
ndgrigorian 0f5b6e9
Name oneMath next to oneMKL in the engine adapter comments
ndgrigorian 9ca80f6
Say that NumPy 2.5.5 advances random_raw by the number of elements too
ndgrigorian 2fa9e98
Link random_raw to NumPy's documentation
ndgrigorian 5f053e1
Say that uniform may return high and needs a non-negative range
ndgrigorian 27043a0
Say how default_rng takes None, ints and NumPy objects as seed
ndgrigorian 128b780
Link BitGenerator.spawn to NumPy and document the TypeError of spawn
ndgrigorian 76ea8d0
List Philox4x3210.state in the docs and say that state can be set
ndgrigorian 61bcf42
Test that Python float parameters reach the kernel unrounded
ndgrigorian 05b83a5
Drop test_queue, which test_sycl_queue.py covers
ndgrigorian 048cdf3
Read repeating parameters in a kernel of their own
ndgrigorian ac8926f
Force inlining of the normal into the blocked NormalSampler kernels
ndgrigorian 7a7eb2d
Merge remote-tracking branch 'origin/master' into feature/device-rng-…
ndgrigorian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # ***************************************************************************** | ||
| # Copyright (c) 2026, Intel Corporation | ||
| # All rights reserved. | ||
| # | ||
| # Redistribution and use in source and binary forms, with or without | ||
| # modification, are permitted provided that the following conditions are met: | ||
| # - Redistributions of source code must retain the above copyright notice, | ||
| # this list of conditions and the following disclaimer. | ||
| # - Redistributions in binary form must reproduce the above copyright notice, | ||
| # this list of conditions and the following disclaimer in the documentation | ||
| # and/or other materials provided with the distribution. | ||
| # - Neither the name of the copyright holder nor the names of its contributors | ||
| # may be used to endorse or promote products derived from this software | ||
| # without specific prior written permission. | ||
| # | ||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
| # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
| # THE POSSIBILITY OF SUCH DAMAGE. | ||
| # ***************************************************************************** | ||
|
|
||
| set(python_module_name _rng_impl) | ||
| set(_module_src | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/normal.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/rng_py.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/sample.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/uniform.cpp | ||
| ) | ||
|
|
||
| # a launch takes one work-item per 8 elements, which can exceed INT_MAX | ||
| build_dpnp_pybind11_ext( | ||
| ${python_module_name} | ||
| SOURCES ${_module_src} | ||
| LARGE_RANGES | ||
| ) | ||
|
|
||
| # the samplers rely on IEEE rounding, which reassociation would change | ||
| if(WIN32) | ||
| target_compile_options(${python_module_name} PRIVATE /clang:-fno-fast-math) | ||
| else() | ||
| target_compile_options(${python_module_name} PRIVATE -fno-fast-math) | ||
| endif() | ||
|
|
||
| # the device RNG API is header-only, so no oneMKL or oneMath library is linked | ||
| if(_use_onemath) | ||
| target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMATH) | ||
| target_include_directories( | ||
| ${python_module_name} | ||
| SYSTEM | ||
| PRIVATE $<TARGET_PROPERTY:${ONEMATH_LIB},INTERFACE_INCLUDE_DIRECTORIES> | ||
| ) | ||
| else() | ||
| target_include_directories( | ||
| ${python_module_name} | ||
| SYSTEM | ||
| PRIVATE $<TARGET_PROPERTY:MKL::MKL_SYCL,INTERFACE_INCLUDE_DIRECTORIES> | ||
| ) | ||
| endif() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.