Device code for Example 3: Randomized Quasi-Monte Carlo
- See also
- DocsTutorial/example3.c
#define StreamType clqmcLatticeRuleStream
#define nextCoordinate clqmcLatticeRuleNextCoordinate
#include <clQMC/DocsTutorial/common.clh>
__kernel void simulateWithRQMC(
__global const clqmcLatticeRule* pointset,
__global const clqmc_fptype* shifts,
uint points_per_work_item,
uint replications,
__global clqmc_fptype* out)
{
uint gsize = get_global_size(0);
uint gid = get_global_id(0);
clqmcLatticeRuleStream stream;
for (uint k = 0; k < replications; k++) {
clqmc_fptype sum = 0.0;
for (uint i = 0; i < points_per_work_item; i++) {
sum += simulateOneRun(&stream);
}
out[k * gsize + gid] = sum / points_per_work_item;
}
}