{"id":27200,"library":"onemkl-sycl-rng","title":"oneMKL SYCL RNG","description":"Intel® oneAPI Math Kernel Library (oneMKL) Random Number Generators (RNG) component for SYCL. Provides high-performance pseudorandom and quasi-random number generation on Intel GPUs and CPUs. Current version 2026.0.0. Released as part of the Intel oneAPI 2026.0 toolkit. Follows Intel's release cadence (yearly).","status":"active","version":"2026.0.0","language":"python","source_language":"en","source_url":"https://github.com/oneapi-src/oneMKL","tags":["oneMKL","random number generation","SYCL","Intel","GPU","high performance computing"],"install":[{"cmd":"pip install onemkl-sycl-rng","lang":"bash","label":"Install from PyPI"},{"cmd":"pip install onemkl-sycl-rng==2026.0.0","lang":"bash","label":"Install specific version"}],"dependencies":[],"imports":[{"note":"Top-level package is onemkl, submodule is _sycl_rng.rng. Direct import of onemkl-sycl-rng fails.","wrong":"import onemkl_sycl_rng","symbol":"rng","correct":"import onemkl._sycl_rng.rng as mkl_rng"}],"quickstart":{"code":"import dpctl\nimport dpnp as np\nfrom onemkl._sycl_rng import rng as mkl_rng\n\n# Create a SYCL queue (e.g., GPU)\nqueue = dpctl.SyclQueue(\"gpu\")\n\n# Create an RNG engine and distribution\nengine = mkl_rng.create_engine(queue, mkl_rng.brng.mrg32k3a)\ndist = mkl_rng.create_distribution(mkl_rng.distribution.uniform, 0.0, 1.0)\n\n# Generate random numbers\nresult = np.empty(1000, dtype=np.float64)\nmkl_rng.generate(queue, engine, dist, result)\nprint(result[:5])\n","lang":"python","description":"Basic usage: create engine, create distribution, generate random numbers into a dpnp array."},"warnings":[{"fix":"Update import to: from onemkl._sycl_rng import rng as mkl_rng","message":"Top-level import path changed: use onemkl._sycl_rng.rng (not onemkl.sycl_rng.rng). The underscore prefix indicates private module – no stability guaranteed.","severity":"breaking","affected_versions":">=2025.0.0"},{"fix":"Replace mkl_random imports with onemkl._sycl_rng.rng and use dpnp arrays.","message":"The mkl_random module (from older mkl-random package) is deprecated. Use onemkl-sycl-rng for SYCL-based random number generation.","severity":"deprecated","affected_versions":"all"},{"fix":"Use dpnp.array(...) or dpctl.tensor.usm_ndarray to allocate memory.","message":"All data buffers must be dpnp arrays (or usm_ndarray). NumPy arrays are not supported and will cause runtime errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Create engine and distribution per queue.","message":"Engine and distribution objects must be re-created for each queue. Attempting to reuse an engine on a different device queue may cause silent failures.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use: from onemkl._sycl_rng import rng","cause":"Direct import of the installed package name instead of the correct submodule path.","error":"ModuleNotFoundError: No module named 'onemkl_sycl_rng'"},{"fix":"Convert to dpnp array: result = dpnp.empty(shape, dtype=np.float64)","cause":"Passing a numpy array instead of a dpnp array or usm_ndarray.","error":"ValueError: Data type not supported"},{"fix":"Always pass a valid dpctl.SyclQueue object as first argument to generate().","cause":"generate() called without a queue argument or queue is None.","error":"RuntimeError: No SYCL queue provided"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}