From d8dab8f40654d2d3bf94ecb2c8ed358f5a58e861 Mon Sep 17 00:00:00 2001 From: Armin Sobhani Date: Wed, 11 Oct 2023 17:40:26 -0400 Subject: [PATCH] update example section --- README.md | 63 +++---------------------------------------------------- 1 file changed, 3 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index 0cde1d9..870e37a 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,7 @@ One important feature of `generate()` algorithms provided by `p2rng` is that the - [Running unit tests](#running-unit-tests) - [Running benchmarks](#running-benchmarks) - [Using *p2rng*](#using-p2rng) - - [OpenMP Example](#openmp-example) - - [CUDA/ROCm Example](#cudarocm-example) - - [oneAPI Example](#oneapi-example) + - [Example](#example) ## Features - Multiplatform @@ -122,60 +120,5 @@ endif() add_executable(test_oneapi test.cpp) target_link_libraries(test_oneapi PRIVATE p2rng::oneapi) ``` -### OpenMP Example -```c++ -#include -#include - -int main(int argc, char* argv[]) -{ typedef float T; - const unsigned long seed_pi{3141592654}; - const auto n{100}; - std::vector v(n); - - p2rng::generate_n - ( std::begin(v) - , n - , p2rng::bind(trng::uniform_dist(10, 100), pcg32(seed_pi)) - ); -} -``` -### CUDA/ROCm Example -```c++ -#include -#include - -int main(int argc, char* argv[]) -{ typedef float T; - const unsigned long seed_pi{3141592654}; - const auto n{100}; - thrust::device_vector v(n); - - p2rng::generate_n - ( std::begin(v) - , n - , p2rng::bind(trng::uniform_dist(10, 100), pcg32(seed_pi)) - ); -} -``` -### oneAPI Example -```c++ -#include -#include -#include - -int main(int argc, char* argv[]) -{ typedef float T; - const unsigned long seed_pi{3141592654}; - const auto n{100}; - sycl::queue q; - sycl::buffer v{sycl::range(n)}; - - p2rng::generate_n - ( dpl::begin(v) - , n - , p2rng::bind(trng::uniform_dist(10, 100), pcg32(seed_pi)) - , q // this is optional and can be omitted - ).wait(); -} -``` \ No newline at end of file +# Example +You can find a complete example of the above approach in the [`example`](example/) folder along with build instructions.