Migrating the Quasirandom Generator from CUDA* to SYCL*

ID 779526
Updated 10/23/2023
Version Latest

Get the Latest on All Things CODE




The QuasirandomGenerator sample implements Niederreiter Quasirandom Sequence Generator and Inverse Cumulative Normal Distribution functions for the generation of Standard Normal Distributions. The original CUDA* source code is migrated to SYCL for portability across GPUs from multiple vendors.




What you will learn

Migrate Quasi-random Generator sample from CUDA to SYCL

Time to complete

15 minutes

Category Code Optimization

Key Implementation Details 

The code defines a kernel function quasirandomGeneratorKernel() which generates random numbers for a given seed and number of samples N. The kernel is launched using a parallel-for loop and is executed on a GPU device. The initTableGPU() function initializes a constant memory table used by the quasirandomGeneratorKernel() function. Finally, the code includes an implementation of Moro's inverse cumulative normal distribution function approximation, which is used to convert the random numbers generated by the quasirandomGeneratorKernel() function into normally distributed random numbers.

Original CUDA source files: quasirandomGenerator.

Migrated SYCL source files including step-by-step instructions: guided_quasirandomGenerator_SYCLMigration.