Skip to content

Commit 9203a70

Browse files
NaraendaNB4444MyNameIsTrezex-rzrSnektron
authored
Develop stream 2025-01-28 (#607)
* Set c++ version to 17 and create warning * Fix no_discard warning c++17 * Build for both c++ 14 and 17 * Add to changelog * Fix warnings when generating sphinx docs * Replace GitHub URL with its issue number * Update documentation generation instructions * Fix CI on rocm/dev-ubuntu * Make rocRAND usable from FetchContent * Remove extra dashes in the documentation its \param and \tparam * Documentation to CI upload * Match cuRAND benchmarks with rocRAND ones * Replace download_project with FetchContent * fix: missing err stream * Resolve "Some tests create discrete_distribution but do not use it" * docs(changelog): move c++14 deprecation notice to upcoming changes * Deprecate sobol constants and vectors --------- Co-authored-by: Nick Breed <[email protected]> Co-authored-by: Sander Bos <[email protected]> Co-authored-by: Anton Gorenko <[email protected]> Co-authored-by: Robin Voetter <[email protected]> Co-authored-by: Borys Petrov <[email protected]> Co-authored-by: Beatriz Navidad Vilches <[email protected]>
1 parent 1bc75f3 commit 9203a70

File tree

68 files changed

+3827
-2898
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+3827
-2898
lines changed

.gitlab-ci.yml

+31-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2017-2024 Advanced Micro Devices, Inc. All rights reserved.
3+
# Copyright (c) 2017-2025 Advanced Micro Devices, Inc. All rights reserved.
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal
@@ -163,6 +163,7 @@ copyright-date:
163163
-D DISABLE_WERROR=OFF
164164
-D CMAKE_C_COMPILER_LAUNCHER=phc_sccache_c
165165
-D CMAKE_CXX_COMPILER_LAUNCHER=phc_sccache_cxx
166+
-D CMAKE_CXX_STANDARD="$BUILD_VERSION"
166167
- cmake --build $CI_PROJECT_DIR/build
167168
- if [[ "${BUILD_SHARED_LIBS}" = "ON" ]]; then cmake --build $CI_PROJECT_DIR/build --target package; fi
168169

@@ -189,6 +190,7 @@ copyright-date:
189190
-D CMAKE_C_COMPILER_LAUNCHER=phc_sccache_c
190191
-D CMAKE_CXX_COMPILER_LAUNCHER=phc_sccache_cxx
191192
-D CMAKE_CUDA_COMPILER_LAUNCHER=phc_sccache_cuda
193+
-D CMAKE_CXX_STANDARD=14
192194
- cmake --build $CI_PROJECT_DIR/build
193195
- if [[ "${BUILD_SHARED_LIBS}" = "ON" ]]; then cmake --build $CI_PROJECT_DIR/build --target package; fi
194196

@@ -200,11 +202,9 @@ copyright-date:
200202
- $CI_PROJECT_DIR/build/test/test_*
201203
- $CI_PROJECT_DIR/build/**/CTestTestfile.cmake
202204
- $CI_PROJECT_DIR/build/benchmark/benchmark_*
203-
- $CI_PROJECT_DIR/build/deps/googlebenchmark/
204205
- $CI_PROJECT_DIR/build/CMakeCache.txt
205206
- $CI_PROJECT_DIR/build/*.deb
206207
- $CI_PROJECT_DIR/build/*.zip
207-
expire_in: 2 weeks
208208

209209
build:rocm-cmake-minimum:
210210
tags:
@@ -217,6 +217,7 @@ build:rocm-cmake-minimum:
217217
variables:
218218
BUILD_SHARED_LIBS: "ON"
219219
BUILD_BENCHMARK_TUNING: "ON"
220+
BUILD_VERSION: 14
220221

221222
build:rocm-hipcc-cmake-minimum:
222223
tags:
@@ -228,6 +229,7 @@ build:rocm-hipcc-cmake-minimum:
228229
- .save-artifacts
229230
variables:
230231
BUILD_SHARED_LIBS: "ON"
232+
BUILD_VERSION: 14
231233

232234
build:rocm-static-cmake-minimum:
233235
tags:
@@ -238,6 +240,7 @@ build:rocm-static-cmake-minimum:
238240
- .rocm:build
239241
variables:
240242
BUILD_SHARED_LIBS: "OFF"
243+
BUILD_VERSION: 14
241244

242245
build:rocm-cmake-latest:
243246
tags:
@@ -248,6 +251,10 @@ build:rocm-cmake-latest:
248251
- .rocm:build
249252
variables:
250253
BUILD_SHARED_LIBS: "ON"
254+
parallel:
255+
matrix:
256+
- BUILD_VERSION: [14, 17]
257+
251258

252259
build:nvcc-cmake-minimum:
253260
tags:
@@ -324,13 +331,13 @@ benchmark:benchmark-tuning:
324331
-D BENCHMARK_TUNING_BLOCK_OPTIONS="${BENCHMARK_TUNING_BLOCK_OPTIONS}"
325332
-D CMAKE_C_COMPILER_LAUNCHER=phc_sccache_c
326333
-D CMAKE_CXX_COMPILER_LAUNCHER=phc_sccache_cxx
334+
-D CMAKE_CXX_STANDARD=14
327335
- cmake --build $CI_PROJECT_DIR/build --target benchmark_rocrand_tuning
328336
- $CI_PROJECT_DIR/build/benchmark/tuning/benchmark_rocrand_tuning --benchmark_out_format=json --benchmark_out=$CI_PROJECT_DIR/build/rocrand_config_tuning_${GPU_TARGET}_${CI_JOB_ID}.json
329337
artifacts:
330338
paths:
331339
- $CI_PROJECT_DIR/build/library/
332340
- $CI_PROJECT_DIR/build/benchmark/
333-
- $CI_PROJECT_DIR/build/deps/googlebenchmark/
334341
- $CI_PROJECT_DIR/build/CMakeCache.txt
335342
- $CI_PROJECT_DIR/build/*.json
336343
expire_in: 2 weeks
@@ -420,17 +427,17 @@ benchmark:nvcc:
420427
- .rules:test
421428
script:
422429
- $SUDO_CMD apt-get update -qq
423-
- $SUDO_CMD apt-get install -y -qq python3 python3-pip python3-numpy
424-
- $SUDO_CMD apt-get install -y -qq wget
425-
- pip3 install setuptools
430+
- $SUDO_CMD apt-get install -y -qq python3 python3-pip python3-venv
426431
- export ROCRAND_PATH=$CI_PROJECT_DIR/build/library/
427432
# rocRAND Wrapper with Python 3
428-
- pip3 --version
429433
- cd $CI_PROJECT_DIR/python/rocrand
430-
- python3 setup.py test
431-
- pip3 install . --user
434+
- python3 -m venv rocrand-venv
435+
- source rocrand-venv/bin/activate
436+
- python3 -m pip install setuptools numpy
437+
- python3 -m pip install .
432438
- python3 tests/rocrand_test.py
433-
- pip3 uninstall --yes rocrand
439+
- python3 -m pip uninstall --yes rocrand
440+
- deactivate
434441

435442
test:rocm-python:
436443
tags:
@@ -514,7 +521,11 @@ test:cpp-wrapper:
514521
-D BUILD_FORTRAN_WRAPPER=OFF
515522
-D BUILD_FILE_REORG_BACKWARD_COMPATIBILITY=OFF
516523
-D CMAKE_CXX_COMPILER=${COMPILER}
517-
- $SUDO_CMD cmake --build $CI_PROJECT_DIR/build_only_install --target install
524+
-D CMAKE_C_COMPILER_LAUNCHER=phc_sccache_c
525+
-D CMAKE_CXX_COMPILER_LAUNCHER=phc_sccache_cxx
526+
-D CMAKE_CUDA_COMPILER_LAUNCHER=phc_sccache_cuda
527+
# Preserve $PATH when sudoing
528+
- $SUDO_CMD env PATH="$PATH" cmake --build $CI_PROJECT_DIR/build_only_install --target install
518529
- cmake
519530
-S $CI_PROJECT_DIR/test/package/
520531
-B $CI_PROJECT_DIR/install_test
@@ -546,6 +557,10 @@ test:doc:
546557
extends:
547558
- .rules:test
548559
- .build:docs
560+
artifacts:
561+
paths:
562+
- $DOCS_DIR/_build/html/
563+
expire_in: 2 weeks
549564

550565
.test:parity:
551566
stage: test
@@ -604,6 +619,7 @@ test:nvcc-parity:
604619
-D CMAKE_INSTALL_PREFIX:PATH="$CI_PROJECT_DIR/build/install"
605620
-D CMAKE_PREFIX_PATH:PATH="${env:HIP_PATH}/lib/cmake"
606621
-D DISABLE_WERROR=OFF *>&1
622+
-D CMAKE_CXX_STANDARD=14
607623
# Building
608624
- cmake --build "$CI_PROJECT_DIR/build" *>&1
609625

@@ -632,6 +648,7 @@ test:windows:
632648
-D CMAKE_BUILD_TYPE=Release
633649
-D CMAKE_CXX_COMPILER:FILEPATH="${env:HIP_PATH}/bin/clang++.exe"
634650
-D CMAKE_PREFIX_PATH:FILEPATH="${env:HIP_PATH}/lib/cmake;$CI_PROJECT_DIR/build/install" *>&1
651+
-D CMAKE_CXX_STANDARD=14
635652
# Build package test
636653
- cmake --build "$CI_PROJECT_DIR/build_install_test"
637654
# Copy rocRAND.dll to the package test build directory
@@ -663,14 +680,15 @@ test:windows:
663680
-D CMAKE_CXX_COMPILER=${COMPILER}
664681
-D CMAKE_C_COMPILER_LAUNCHER=phc_sccache_c
665682
-D CMAKE_CXX_COMPILER_LAUNCHER=phc_sccache_cxx
683+
-D CMAKE_CXX_STANDARD=14
666684
- cmake --build ${ROCRAND_STAT_TESTS_DIR}/build
667685
- mkdir ${LOGS_DIR}
668686
- cd ${ROCRAND_STAT_TESTS_DIR}/build
669687
- nproc
670688
artifacts:
671689
paths:
672690
- ${LOGS_DIR}/*
673-
expire_in: never
691+
expire_in: 3 months
674692

675693
# TestU01 SmallCrush, 10 tests, 15 statistics, takes about 5 seconds
676694
statistical-test:crush-small:

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@ Documentation for rocRAND is available at
1212
### Changed
1313

1414
* Updated several `gfx942` auto tuning parameters.
15+
* Deprecated C++14 and set the default target to C++17.
16+
* Directly accessing the (scrambled) sobol32 and sobol64 constants and direction vectors is deprecated:
17+
* `h_scrambled_sobol32_constants`, use `rocrand_get_scramble_constants32` instead.
18+
* `h_scrambled_sobol64_constants`, use `rocrand_get_scramble_constants64` instead.
19+
* `rocrand_h_sobol32_direction_vectors`, use `rocrand_get_direction_vectors32` instead.
20+
* `rocrand_h_sobol64_direction_vectors`, use `rocrand_get_direction_vectors64` instead.
21+
* `rocrand_h_scrambled_sobol32_direction_vectors`, use `rocrand_get_direction_vectors32` instead.
22+
* `rocrand_h_scrambled_sobol64_direction_vectors`, use `rocrand_get_direction_vectors64` instead.
23+
24+
### Upcoming changes
25+
* C++14 will be removed in the next major release.
26+
* Directly accessing the (scrambled) sobol32 and sobol64 constants and direction vectors will be removed in the next major release.
27+
1528

1629
### Fixed
1730

CMakeLists.txt

+9-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ include(cmake/VerifyCompiler.cmake)
142142
option(DISABLE_WERROR "Disable building with Werror" ON)
143143

144144
# Build CXX flags
145-
set(CMAKE_CXX_STANDARD 11)
145+
if (NOT DEFINED CMAKE_CXX_STANDARD)
146+
set(CMAKE_CXX_STANDARD 17)
147+
endif()
146148
set(CMAKE_CXX_STANDARD_REQUIRED ON)
147149
set(CMAKE_CXX_EXTENSIONS OFF)
148150
if(DISABLE_WERROR)
@@ -154,6 +156,12 @@ if(CODE_COVERAGE)
154156
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-instr-generate -fcoverage-mapping")
155157
endif()
156158

159+
if (CMAKE_CXX_STANDARD EQUAL 14)
160+
message(WARNING "C++14 will be deprecated in the next major release")
161+
elseif(NOT CMAKE_CXX_STANDARD EQUAL 17)
162+
message(FATAL_ERROR "Only C++14 and C++17 are supported")
163+
endif()
164+
157165
# HIP on Windows: xhip is required with clang++ to get __half defined
158166
if (WIN32)
159167
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-xhip>")

README.md

+55-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# rocRAND
22

3+
> [!NOTE]
4+
> 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).
5+
36
The rocRAND project provides functions that generate pseudorandom and quasirandom numbers.
47
The rocRAND library is implemented in the [HIP](https://github.com/ROCm/HIP)
58
programming language and optimized for AMD's latest discrete GPUs. It is designed to run on top
@@ -24,28 +27,6 @@ split into a separate library. As of version 6.0, hipRAND can no longer be built
2427
* Scrambled Sobol64
2528
* ThreeFry
2629

27-
## Documentation
28-
29-
> [!NOTE]
30-
> The published rocRAND documentation is available at [rocRAND](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 rocRAND/docs folder of this repository. As with all ROCm projects, the documentation is open source. For more information, see [Contribute to ROCm documentation](https://rocm.docs.amd.com/en/latest/contribute/contributing.html).
31-
32-
To build documentation locally, use the following code:
33-
34-
```sh
35-
# Go to the docs directory
36-
cd docs
37-
38-
# Install Python dependencies
39-
python3 -m pip install -r sphinx/requirements.txt
40-
41-
# Build the documentation
42-
python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html
43-
44-
# E.g. serve the HTML docs locally
45-
cd _build/html
46-
python3 -m http.server
47-
```
48-
4930
## Requirements
5031

5132
* CMake (3.16 or later)
@@ -225,6 +206,58 @@ been migrated to the new framework.
225206
* [Fortran wrappers](./library/src/fortran/).
226207
* [Python wrappers](./python/): [rocRAND](./python/rocrand).
227208

209+
## Building the documentation locally
210+
211+
### Requirements
212+
213+
#### Doxygen
214+
215+
The 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.
216+
217+
After you have downloaded Doxygen version 1.9.4:
218+
219+
```shell
220+
# Add doxygen to your PATH
221+
echo 'export PATH=<doxygen 1.9.4 path>/bin:$PATH' >> ~/.bashrc
222+
223+
# Apply the updated .bashrc
224+
source ~/.bashrc
225+
226+
# Confirm that you are using version 1.9.4
227+
doxygen --version
228+
```
229+
230+
#### Python
231+
232+
The build system uses Python version 3.10. You can try using a newer version, but that might cause issues.
233+
234+
You can install Python 3.10 alongside your other Python versions using [pyenv](https://github.com/pyenv/pyenv?tab=readme-ov-file#installation):
235+
236+
```shell
237+
# Install Python 3.10
238+
pyenv install 3.10
239+
240+
# Create a Python 3.10 virtual environment
241+
pyenv virtualenv 3.10 venv_rocrand
242+
243+
# Activate the virtual environment
244+
pyenv activate venv_rocrand
245+
```
246+
247+
### Building
248+
249+
After cloning this repository, and `cd`ing into it:
250+
251+
```shell
252+
# Install Python dependencies
253+
python3 -m pip install -r docs/sphinx/requirements.txt
254+
255+
# Build the documentation
256+
python3 -m sphinx -T -E -b html -d docs/_build/doctrees -D language=en docs docs/_build/html
257+
```
258+
259+
You can then open `docs/_build/html/index.html` in your browser to view the documentation.
260+
228261
## Support
229262

230263
Bugs and feature requests can be reported through the

0 commit comments

Comments
 (0)