/* * BayesNetUtilityKernels.cl * * Created on: Feb 4, 2013 * Author: scannon */ #ifndef BayesNetUtilityKernels_CL #define BayesNetUtilityKernels_CL //#include "ranluxcl.cl" kernel void Kernel_Ranluxcl_Init(private uint ins, global ranluxcl_state_t *ranluxcltab) { ranluxcl_initialization(ins, ranluxcltab); } __kernel void ExpSample_kernel(global ranluxcl_state_t *ranluxcltab, __global float4 *result) { int gid = get_global_id(0); ranluxcl_state_t ranluxclstate; // Download state ranluxcl_download_seed(&ranluxclstate, ranluxcltab); // Calculate sample from exponential distribution result[gid] = -1*native_log(ranluxcl32(&ranluxclstate)); // Upload state again ranluxcl_upload_seed(&ranluxclstate, ranluxcltab); } #endif // BayesNetUtilityKernels_CL