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