All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kernels.float.binomial.kh Maven / Gradle / Ivy

There is a newer version: 0.4-rc3.8
Show newest version
#include 
#include 
__global  float doBinomial(int n, float p, float *randomNumbers,curandGenerator_t s) {
  int x = 0;
  int tid = get_local_id(0) + get_group_id(0) * get_local_size(0);

  for(int i = tid; i < n; i++) {
    if(randomNumbers[i]< p )
      x++;
  }
  return x;
}


extern "C"
__kernel void binomial_float(int len,int n,float *ps,float *randomNumbers,float *result, curandGenerator_t s) {
          int tid = get_local_id(0) + get_group_id(0) * get_local_size(0);
          for(int i = tid; i < len; i += get_local_size(0) * get_num_groups(0)) {
              result[i] = doBinomial(n,ps[i],randomNumbers,s);
          }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy