{"id":17632762,"url":"https://github.com/rocm/rocrand","last_synced_at":"2026-04-02T11:46:44.698Z","repository":{"id":26485478,"uuid":"98926883","full_name":"ROCm/rocRAND","owner":"ROCm","description":"RAND library for HIP programming language ","archived":false,"fork":false,"pushed_at":"2025-04-11T14:30:25.000Z","size":107046,"stargazers_count":117,"open_issues_count":8,"forks_count":73,"subscribers_count":48,"default_branch":"develop","last_synced_at":"2025-04-12T14:19:26.515Z","etag":null,"topics":["cuda","gpu","hip","random","rng","rocm"],"latest_commit_sha":null,"homepage":"https://rocmdocs.amd.com/projects/rocRAND/en/latest/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ROCm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-31T20:26:54.000Z","updated_at":"2025-04-09T23:00:40.000Z","dependencies_parsed_at":"2023-02-16T12:15:45.585Z","dependency_job_id":"d7410ab1-a81b-4997-8488-cf0a68b67715","html_url":"https://github.com/ROCm/rocRAND","commit_stats":{"total_commits":1070,"total_committers":81,"mean_commits":"13.209876543209877","dds":0.8467289719626168,"last_synced_commit":"dc3656f1e957a900289b6e8b18fb66a63277711b"},"previous_names":["rocm/rocrand","rocmsoftwareplatform/rocrand"],"tags_count":75,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ROCm%2FrocRAND","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ROCm%2FrocRAND/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ROCm%2FrocRAND/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ROCm%2FrocRAND/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ROCm","download_url":"https://codeload.github.com/ROCm/rocRAND/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248578875,"owners_count":21127714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cuda","gpu","hip","random","rng","rocm"],"created_at":"2024-10-23T01:45:39.201Z","updated_at":"2026-04-02T11:46:44.666Z","avatar_url":"https://github.com/ROCm.png","language":"C++","readme":"# rocRAND\n\n\u003e [!NOTE]\n\u003e The published rocRAND documentation is available [here](https://rocm.docs.amd.com/projects/rocRAND/en/latest/) in an organized, easy-to-read format, with search and a table of contents. The documentation source files reside in the `docs` folder of this repository. As with all ROCm projects, the documentation is open source. For more information on contributing to the documentation, see [Contribute to ROCm documentation](https://rocm.docs.amd.com/en/latest/contribute/contributing.html).\n\nThe rocRAND project provides functions that generate pseudorandom and quasirandom numbers.\nThe rocRAND library is implemented in the [HIP](https://github.com/ROCm/HIP)\nprogramming language and optimized for AMD's latest discrete GPUs. It is designed to run on top\nof AMD's [ROCm](https://rocm.docs.amd.com) runtime, but it also works on CUDA-enabled GPUs.\n\nPrior to ROCm version 5.0, this project included the\n[hipRAND](https://github.com/ROCm/hipRAND.git) wrapper. As of version 5.0, it was\nsplit into a separate library. As of version 6.0, hipRAND can no longer be built from rocRAND.\n\n## Supported random number generators\n\n* XORWOW\n* MRG31k3p\n* MRG32k3a\n* Mersenne Twister (MT19937)\n* Mersenne Twister for Graphic Processors (MTGP32)\n* Philox (4x32, 10 rounds)\n* LFSR113\n* Sobol32\n* Scrambled Sobol32\n* Sobol64\n* Scrambled Sobol64\n* ThreeFry\n\n## Requirements\n\n* CMake (3.16 or later)\n* C++ compiler with C++17 support to build the library.\n  * Recommended to use at least gcc 9\n  * clang uses the development headers and libraries from gcc, so a recent version of it must still\n    be installed when compiling with clang\n* C++ compiler with C++11 support to consume the library.\n* For AMD platforms:\n  * [ROCm](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/native-install/index.html) (1.7 or later)\n  * [HIP-clang](https://github.com/ROCm/HIP/blob/master/INSTALL.md#hip-clang) compiler, which must be\n    set as C++ compiler on ROCm platform.\n* For CUDA platforms:\n  * [HIP](https://github.com/ROCm/HIP)\n  * Latest CUDA SDK\n* Python 3.6 or higher (HIP on Windows only, only required for install script)\n* Visual Studio 2019 with clang support (HIP on Windows only)\n* Strawberry Perl (HIP on Windows only)\n\nOptional:\n\n* [GoogleTest](https://github.com/google/googletest) (required only for tests; building tests is enabled\n  by default)\n  * Use `GTEST_ROOT` to specify the GoogleTest location (see also\n    [FindGTest](https://cmake.org/cmake/help/latest/module/FindGTest.html))\n  * Note: If GoogleTest is not already installed, it will be automatically downloaded and built\n* Fortran compiler (required only for Fortran wrapper)\n  * `gfortran` is recommended\n* Python 3.5+ (required only for Python wrapper)\n* [doxygen](https://www.doxygen.nl/) to build the documentation\n\nIf some dependencies are missing, the CMake script automatically downloads, builds, and installs them.\nSetting the `DEPENDENCIES_FORCE_DOWNLOAD` option to `ON` forces the script to download all\ndependencies, rather than using the system-installed libraries.\n\n## Build and install\n\n```shell\ngit clone https://github.com/ROCm/rocRAND.git\n\n# Go to rocRAND directory, create and go to build directory\ncd rocRAND; mkdir build; cd build\n\n# Configure rocRAND, setup options for your system\n# Build options: BUILD_TEST (off by default), BUILD_BENCHMARK (off by default), BUILD_SHARED_LIBS (on by default)\n# Additionally, the ROCm installation prefix should be passed using CMAKE_PREFIX_PATH or by setting the ROCM_PATH environment variable.\n#\n# ! IMPORTANT !\n# Set C++ compiler to HIP-clang. You can do it by adding 'CXX=\u003cpath-to-compiler\u003e'\n# before 'cmake' or setting cmake option 'CMAKE_CXX_COMPILER' to path to the compiler.\n#\n# The python interface do not work with static library.\n#\n[CXX=hipcc] cmake -DBUILD_BENCHMARK=ON ../. -DCMAKE_PREFIX_PATH=/opt/rocm # or cmake-gui ../.\n\n# To configure rocRAND for NVIDIA platforms, the CXX compiler must be set to a host compiler. The CUDA compiler can\n# be set explicitly using `-DCMAKE_CUDA_COMPILER=\u003cpath-to-nvcc\u003e`.\n# Additionally, the path to FindHIP.cmake should be passed via CMAKE_MODULE_PATH. By default, this is module is\n# installed in /opt/rocm/hip/cmake.\ncmake -DBUILD_BENCHMARK=ON ../. -DCMAKE_PREFIX_PATH=/opt/rocm -DCMAKE_MODULE_PATH=/opt/rocm/hip/cmake # or cmake-gui ../.\n# or\n[CXX=g++] cmake -DBUILD_BENCHMARK=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc -DCMAKE_PREFIX_PATH=/opt/rocm -DCMAKE_MODULE_PATH=/opt/rocm/hip/cmake ../. # or cmake-gui ../.\n\n# Build\nmake -j4\n\n# Optionally, run tests if they're enabled\nctest --output-on-failure\n\n# Install\n[sudo] make install\n```\n\n### HIP on Windows\n\nWe've added initial support for HIP on Windows, which you can install using the `rmake.py` python\nscript:\n\n```shell\ngit clone https://github.com/ROCm/rocRAND.git\ncd rocRAND\n\n# the -i option will install rocPRIM to C:\\hipSDK by default\npython rmake.py -i\n\n# the -c option will build all clients including unit tests\npython rmake.py -c\n```\n\nThe existing GoogleTest library in the system (especially static GoogleTest libraries built with other\ncompilers) may cause a build failure; if you encounter errors with the existing GoogleTest library or\nother dependencies, you can pass the `DEPENDENCIES_FORCE_DOWNLOAD` flag to CMake, which can\nhelp to solve the problem.\n\n## Running unit tests\n\n```shell\n# Go to rocRAND build directory\ncd rocRAND; cd build\n\n# To run all tests\nctest\n\n# To run unit tests\n./test/\u003cunit-test-name\u003e\n```\n\n## Running benchmarks\n\n```shell\n# Go to rocRAND build directory\ncd rocRAND; cd build\n\n# To run benchmark for the host generate functions:\n# The benchmarks are registered with Google Benchmark as `device_generate\u003cengine,distribution\u003e`, where\n# engine -\u003e xorwow, mrg31k3p, mrg32k3a, mtgp32, philox, lfsr113, mt19937,\n#           threefry2x32, threefry2x64, threefry4x32, threefry4x64,\n#           sobol32, scrambled_sobol32, sobol64, scrambled_sobol64\n# distribution -\u003e uniform-uint, uniform-uchar, uniform-ushort,\n#                 uniform-half, uniform-float, uniform-double,\n#                 normal-half, normal-float, normal-double,\n#                 log-normal-half, log-normal-float, log-normal-double, poisson\n# Further option can be found using --help\n./benchmark/benchmark_rocrand_host_api\n# To run specific benchmarks:\n./benchmark/benchmark_rocrand_host_api --benchmark_filter=\u003cregex\u003e\n# For example to run benchmarks with engine sobol64:\n./benchmark/benchmark_rocrand_host_api --benchmark_filter=\"device_generate\u003csobol64*\"\n# To view all registered benchmarks:\n./benchmark/benchmark_rocrand_host_api --benchmark_list_tests=true\n# The benchmark also supports user input:\n./benchmark/benchmark_rocrand_host_api --size \u003cnumber\u003e --trials \u003cnumber\u003e --offset \u003cnumber\u003e --dimensions \u003cnumber\u003e --lambda \u003cfloat float float ...\u003e\n# And can print output in different formats:\n./benchmark/benchmark_rocrand_host_api --benchmark_format=\u003cconsole|json|csv\u003e\n\n# To run benchmark for device kernel functions:\n# The benchmarks are registered with Google Benchmark as `device_kernel\u003cengine,distribution\u003e`, where\n# engine -\u003e xorwow, mrg31k3p, mrg32k3a, mtgp32, philox, lfsr113,\n#           threefry2x32, threefry2x64, threefry4x32, threefry4x64,\n#           sobol32, scrambled_sobol32, sobol64, scrambled_sobol64\n# distribution -\u003e uniform-uint or uniform-ullong, uniform-float, uniform-double, normal-float, normal-double,\n#                 log-normal-float, log-normal-double, poisson, discrete-poisson, discrete-custom\n# Further option can be found using --help\n./benchmark/benchmark_rocrand_device_api\n# To run specific benchmarks:\n./benchmark/benchmark_rocrand_device_api --benchmark_filter=\u003cregex\u003e\n# For example to run benchmarks with engine sobol64:\n./benchmark/benchmark_rocrand_device_api --benchmark_filter=\"device_kernel\u003csobol64*\"\n# To view all registered benchmarks:\n./benchmark/benchmark_rocrand_device_api --benchmark_list_tests=true\n# The benchmark also supports user input:\n./benchmark/benchmark_rocrand_device_api --size \u003cnumber\u003e --trials \u003cnumber\u003e --dimensions \u003cnumber\u003e --lambda \u003cfloat float float ...\u003e\n# And can print output in different formats:\n./benchmark/benchmark_rocrand_device_api --benchmark_format=\u003cconsole|json|csv\u003e\n\n# To compare against cuRAND (cuRAND must be supported):\n./benchmark/benchmark_curand_host_api [google benchmark options]\n./benchmark/benchmark_curand_device_api [google benchmark options]\n```\n\n### Legacy benchmarks\n\nYou can disable legacy benchmarks (those used prior to Google Benchmark) by setting the\nCMake option `BUILD_LEGACY_BENCHMARK` to `OFF`. For compatibility, the default setting is `ON`\nwhen `BUILD_BENCHMARK` is set.\n\nLegacy benchmarks are deprecated and will be removed in a future version once all benchmarks have\nbeen migrated to the new framework.\n\n## Wrappers\n\n* C++ wrappers for the rocRAND host API are in [`rocrand.hpp`](./library/include/rocrand/rocrand.hpp).\n* [Fortran wrappers](./library/src/fortran/).\n* [Python wrappers](./python/): [rocRAND](./python/rocrand).\n\n## Building the documentation locally\n\n### Requirements\n\n#### Doxygen\n\nThe build system uses Doxygen [version 1.9.4](https://github.com/doxygen/doxygen/releases/tag/Release_1_9_4). You can try using a newer version, but that might cause issues.\n\nAfter you have downloaded Doxygen version 1.9.4:\n\n```shell\n# Add doxygen to your PATH\necho 'export PATH=\u003cdoxygen 1.9.4 path\u003e/bin:$PATH' \u003e\u003e ~/.bashrc\n\n# Apply the updated .bashrc\nsource ~/.bashrc\n\n# Confirm that you are using version 1.9.4\ndoxygen --version\n```\n\n#### Python\n\nThe build system uses Python version 3.10. You can try using a newer version, but that might cause issues.\n\nYou can install Python 3.10 alongside your other Python versions using [pyenv](https://github.com/pyenv/pyenv?tab=readme-ov-file#installation):\n\n```shell\n# Install Python 3.10\npyenv install 3.10\n\n# Create a Python 3.10 virtual environment\npyenv virtualenv 3.10 venv_rocrand\n\n# Activate the virtual environment\npyenv activate venv_rocrand\n```\n\n### Building\n\nAfter cloning this repository, and `cd`ing into it:\n\n```shell\n# Install Python dependencies\npython3 -m pip install -r docs/sphinx/requirements.txt\n\n# Build the documentation\npython3 -m sphinx -T -E -b html -d docs/_build/doctrees -D language=en docs docs/_build/html\n```\n\nYou can then open `docs/_build/html/index.html` in your browser to view the documentation.\n\n## Support\n\nBugs and feature requests can be reported through the\n[issue tracker](https://github.com/ROCm/rocRAND/issues).\n\n## Contributions and license\n\nContributions of any kind are most welcome! You can find more information at\n[CONTRIBUTING](./CONTRIBUTING.md).\n\nLicensing information is located at [LICENSE](./LICENSE.txt).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocm%2Frocrand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frocm%2Frocrand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocm%2Frocrand/lists"}