Analysis-Utilities
26.9.9
C++/ROOT utilities for nuclear measurement data analysis
Toggle main menu visibility
Loading...
Searching...
No Matches
RooStepShelf.cu
Go to the documentation of this file.
1
#include "
RooFitPhotopeakKernels.hpp
"
2
3
#include <cuda_runtime.h>
4
5
namespace
{
6
7
__device__
inline
double
SigmoidNegDev(
double
z) {
8
if
(z < 0.0) {
9
return
1.0 / (1.0 + exp(z));
10
}
11
return
exp(-z) / (1.0 + exp(-z));
12
}
13
14
__global__
void
RooStepShelfKernel(
double
*output,
const
double
*x_vals,
15
double
mu,
double
inv_sigma,
size_t
n) {
16
size_t
i = blockIdx.x * blockDim.x + threadIdx.x;
17
if
(i < n) {
18
double
z = (x_vals[i] - mu) * inv_sigma;
19
double
s = SigmoidNegDev(z);
20
double
v = s * s;
21
output[i] = v > 1e-300 ? v : 1e-300;
22
}
23
}
24
25
}
// namespace
26
27
void
RooStepShelf_launchKernel
(
double
*output,
const
double
*x_vals,
double
mu,
28
double
inv_sigma,
size_t
n) {
29
const
int
threads = 256;
30
const
int
blocks = (n + threads - 1) / threads;
31
RooStepShelfKernel<<<blocks, threads>>>(output, x_vals, mu, inv_sigma, n);
32
}
RooFitPhotopeakKernels.hpp
Host-callable launch wrappers for the photopeak PDF CUDA kernels.
RooStepShelf_launchKernel
void RooStepShelf_launchKernel(double *output, const double *x_vals, double mu, double inv_sigma, size_t n)
Launch the resolution-smeared step-shelf kernel.
Definition
RooStepShelf.cu:27
gpu
RooStepShelf.cu
Generated by
1.17.0