net.finmath.montecarlo.RandomVariableCudaKernel.cu Maven / Gradle / Ivy
extern "C"
__global__ void capByScalar(int n, float *a, float b, float *result)
{
float cap = b;
int i = blockIdx.x * blockDim.x + threadIdx.x;
if (i floor ? a[i] : floor;
}
}
extern "C"
__global__ void addScalar(int n, float *a, float b, float *result)
{
int i = blockIdx.x * blockDim.x + threadIdx.x;
if (i b[i] ? a[i] : b[i];
}
}
extern "C"
__global__ void add(int n, float *a, float *b, float *result)
{
int i = blockIdx.x * blockDim.x + threadIdx.x;
if (i0; s>>=1) {
if (tid < s) {
sdata[tid] += sdata[tid + s];
}
__syncthreads();
}
// write result for this block to global mem
if (tid == 0) sum[blockIdx.x] = sdata[0];
}