numba-dpex
                                
                                 numba-dpex copied to clipboard
                                
                                    numba-dpex copied to clipboard
                            
                            
                            
                        Support for RNG in `numba_dpex`
https://github.com/IntelPython/numba-dpex/issues/159 was closed as completed after analogue to np.random functions were added to dpnp but it does not addresses some use cases that are met with numba.cuda.random:
- generating float32random numbers. For devices that do not support float64 random numbers, that means no RNG at all:
error: Double type is not supported on this platform.
in kernel: 'typeinfo name for oneapi::mkl::rng::detail::engine_func_mt<oneapi::mkl::rng::mt19937, double, double, oneapi::mkl::rng::detail::gpu::uniform_std<double, double>, double*, false, false>'
error: backend compiler failed build.
- A lesser but still valid case is fusing random number generation with other compute in the same kernel.
numba.cuda.random RNG does not come from low level functions but is implemented in numba so in fact the current state of numba.cuda.random is easy to port or to mimic.
E.g here's an attempt at creating dpex.func kernel functions that can be used in dpex.kernel kernels.
We just merged it see https://github.com/soda-inria/sklearn-numba-dpex/commit/6190f8f2ffc9a3872ac07a58137a7c59131966a8 for module and tests.
It's true that jax rng interface is nicer but the xoroshiro128 pr was on its way to merge before we learn about it. Maybe for future updates =)
@fcharras sorry for getting to this issue so late. Will you want to open a PR contributing your RNG implementation to numba-dpex? We can review and merge it.
Hello @diptorupd sure I can do that, TY for the invitation ! I will be busy early this week, I'll start working on it mid-week if that's fine for you.
I will be busy early this week, I'll start working on it mid-week if that's fine for you.
I am out this week. If you want to start next week or later that too is fine.