![]() |
MaCh3 2.2.1
Reference Guide
|
Class responsible for calculating spline weight on GPU. More...
Public Member Functions | |
SMonolithGPU () | |
constructor | |
virtual | ~SMonolithGPU () |
destructor | |
__host__ void | InitGPU_SplineMonolith (float **cpu_total_weights, int n_events, unsigned int total_nknots, unsigned int n_splines, unsigned int n_tf1, int Eve_size) |
Allocate memory on gpu for spline monolith. | |
__host__ void | CopyToGPU_SplineMonolith (SplineMonoStruct *cpu_spline_handler, std::vector< float > cpu_many_array_TF1, std::vector< short int > cpu_paramNo_arr_TF1, int n_events, std::vector< unsigned int > cpu_nParamPerEvent, std::vector< unsigned int > cpu_nParamPerEvent_TF1, int n_params, unsigned int n_splines, short int spline_size, unsigned int total_nknots, unsigned int n_tf1) |
Copies data from CPU to GPU for the spline monolith. | |
__host__ void | InitGPU_Segments (short int **segment) |
Allocate memory for spline segments. | |
__host__ void | InitGPU_Vals (float **vals) |
Allocate memory for spline segments. | |
__host__ void | RunGPU_SplineMonolith (float *cpu_total_weights, float *vals, short int *segment, const unsigned int h_n_splines, const unsigned int h_n_tf1) |
Run the GPU code for the separate many arrays. As in separate {x}, {y,b,c,d} arrays Pass the segment and the parameter values (binary search already performed in SplineMonolith::FindSplineSegment() | |
__host__ void | CleanupGPU_SplineMonolith (float *cpu_total_weights) |
This function deallocates the resources allocated for the separate {x} and {ybcd} arrays in the and TF1 stuff at GPU. | |
__host__ void | CleanupGPU_Segments (short int *segment, float *vals) |
Clean up pinned variables at CPU. | |
Private Attributes | |
unsigned int * | gpu_nParamPerEvent |
KS: GPU map keeping track how many parameters applies to each event, we keep two numbers here {number of splines per event, index where splines start for a given event}. | |
unsigned int * | gpu_nParamPerEvent_TF1 |
KS: GPU map keeping track how many parameters applies to each event, we keep two numbers here {number of TF1 per event, index where TF1 start for a given event}. | |
float * | gpu_coeff_x |
KS: GPU arrays to hold X coefficient. | |
float * | gpu_coeff_many |
GPU arrays to hold other coefficients. | |
unsigned int * | gpu_nKnots_arr |
KS: GPU Number of knots per spline. | |
short int * | gpu_paramNo_arr |
CW: GPU array with the number of points per spline (not per spline point!) | |
float * | gpu_coeff_TF1_many |
GPU arrays to hold TF1 coefficients. | |
short int * | gpu_nPoints_arr |
GPU arrays to hold number of points. | |
short int * | gpu_paramNo_TF1_arr |
CW: GPU array with the number of points per TF1 object. | |
float * | gpu_total_weights |
GPU arrays to hold weight for event. | |
float * | gpu_weights |
GPU arrays to hold weight for each spline. | |
float * | gpu_weights_tf1 |
GPU arrays to hold weight for each TF1. | |
int | h_n_params |
Number of params living on CPU. | |
int | h_n_events |
Number of events living on CPU. | |
cudaTextureObject_t | text_coeff_x = 0 |
KS: Textures are L1 cache variables which are well optimised for fetching. Make texture only for variables you often access but rarely overwrite. There are limits on texture memory so don't use huge arrays. | |
cudaTextureObject_t | text_nParamPerEvent = 0 |
KS: Map keeping track how many parameters applies to each event, we keep two numbers here {number of splines per event, index where splines start for a given event}. | |
cudaTextureObject_t | text_nParamPerEvent_TF1 = 0 |
KS: Map keeping track how many parameters applies to each event, we keep two numbers here {number of TF1 per event, index where TF1 start for a given event}. | |
Class responsible for calculating spline weight on GPU.
Definition at line 61 of file gpuSplineUtils.cuh.
SMonolithGPU::SMonolithGPU | ( | ) |
constructor
Number of events living on CPU
Definition at line 81 of file gpuSplineUtils.cu.
|
virtual |
__host__ void SMonolithGPU::CleanupGPU_Segments | ( | short int * | segment, |
float * | vals | ||
) |
Clean up pinned variables at CPU.
segment | Found spline segment for each parameter |
vals | Value to which we want reweight for each parameter |
Definition at line 587 of file gpuSplineUtils.cu.
__host__ void SMonolithGPU::CleanupGPU_SplineMonolith | ( | float * | cpu_total_weights | ) |
This function deallocates the resources allocated for the separate {x} and {ybcd} arrays in the and TF1 stuff at GPU.
cpu_total_weights | Pointer to the total weights array on the CPU (used if Weight_On_SplineBySpline_Basis is not defined). |
Definition at line 552 of file gpuSplineUtils.cu.
__host__ void SMonolithGPU::CopyToGPU_SplineMonolith | ( | SplineMonoStruct * | cpu_spline_handler, |
std::vector< float > | cpu_many_array_TF1, | ||
std::vector< short int > | cpu_paramNo_arr_TF1, | ||
int | n_events, | ||
std::vector< unsigned int > | cpu_nParamPerEvent, | ||
std::vector< unsigned int > | cpu_nParamPerEvent_TF1, | ||
int | n_params, | ||
unsigned int | n_splines, | ||
short int | spline_size, | ||
unsigned int | total_nknots, | ||
unsigned int | n_tf1 | ||
) |
Copies data from CPU to GPU for the spline monolith.
This function transfers the necessary spline data and parameters from the CPU to the GPU, including TF1-related arrays and parameters. This setup is crucial for spline evaluations on the GPU.
cpu_spline_handler | Pointer to the structure managing spline data on the CPU. |
cpu_many_array_TF1 | Array of TF1 parameters on the CPU. |
cpu_paramNo_arr_TF1 | Array containing parameter numbers for TF1 objects. |
n_events | Number of events, necessary for correct data handling. |
cpu_nParamPerEvent | Array indicating the number of parameters per event. |
cpu_nParamPerEvent_TF1 | Array indicating the number of parameters per TF1 object. |
n_params | Total number of parameters across all splines. |
n_splines | Total number of spline objects. |
spline_size | Size of each spline object. |
total_nknots | Total number of knots across all splines. |
n_tf1 | Total number of TF1 objects. |
Definition at line 201 of file gpuSplineUtils.cu.
__host__ void SMonolithGPU::InitGPU_Segments | ( | short int ** | segment | ) |
Allocate memory for spline segments.
segment | Found spline segment for each parameter |
Definition at line 178 of file gpuSplineUtils.cu.
__host__ void SMonolithGPU::InitGPU_SplineMonolith | ( | float ** | cpu_total_weights, |
int | n_events, | ||
unsigned int | total_nknots, | ||
unsigned int | n_splines, | ||
unsigned int | n_tf1, | ||
int | Eve_size | ||
) |
Allocate memory on gpu for spline monolith.
cpu_total_weights | KS: Rather than allocate memory in standard way this fancy cuda tool allows to pin host memory which make memory transfer faster |
n_events | Number of events, this is necessary to allocate correctly memory |
total_nknots | Total number of knots in all splines summed |
n_splines | Total number of spline objects, not knots |
n_tf1 | Total number of TF1 objects, not coefficients |
Definition at line 106 of file gpuSplineUtils.cu.
__host__ void SMonolithGPU::InitGPU_Vals | ( | float ** | vals | ) |
Allocate memory for spline segments.
vals | Value to which we want reweight for each parameter |
Definition at line 187 of file gpuSplineUtils.cu.
__host__ void SMonolithGPU::RunGPU_SplineMonolith | ( | float * | cpu_total_weights, |
float * | vals, | ||
short int * | segment, | ||
const unsigned int | h_n_splines, | ||
const unsigned int | h_n_tf1 | ||
) |
Run the GPU code for the separate many arrays. As in separate {x}, {y,b,c,d} arrays Pass the segment and the parameter values (binary search already performed in SplineMonolith::FindSplineSegment()
Executes the GPU code for calculating spline weights.
This function runs the GPU computation for the spline monolith. It assumes that the appropriate segment has already been identified through binary search in the SplineMonolith::FindSplineSegment()
function.
cpu_weights | Pointer to the array of weights on the CPU (used if Weight_On_SplineBySpline_Basis is defined). |
cpu_weights_tf1 | Pointer to the array of TF1 weights (used if Weight_On_SplineBySpline_Basis is defined). |
cpu_total_weights | Pointer to the total weights array (used if Weight_On_SplineBySpline_Basis is not defined). |
vals | Pointer to an array holding the parameter values to be processed. |
segment | Pointer to an array containing segment indices for parameters. |
h_n_splines | Total number of spline objects in the GPU context. |
h_n_tf1 | Total number of TF1 objects in the GPU context. |
Definition at line 459 of file gpuSplineUtils.cu.
|
private |
GPU arrays to hold other coefficients.
Definition at line 192 of file gpuSplineUtils.cuh.
|
private |
GPU arrays to hold TF1 coefficients.
Definition at line 201 of file gpuSplineUtils.cuh.
|
private |
KS: GPU arrays to hold X coefficient.
Definition at line 189 of file gpuSplineUtils.cuh.
|
private |
KS: GPU Number of knots per spline.
Definition at line 195 of file gpuSplineUtils.cuh.
|
private |
KS: GPU map keeping track how many parameters applies to each event, we keep two numbers here {number of splines per event, index where splines start for a given event}.
Definition at line 184 of file gpuSplineUtils.cuh.
|
private |
KS: GPU map keeping track how many parameters applies to each event, we keep two numbers here {number of TF1 per event, index where TF1 start for a given event}.
Definition at line 186 of file gpuSplineUtils.cuh.
|
private |
GPU arrays to hold number of points.
Definition at line 203 of file gpuSplineUtils.cuh.
|
private |
CW: GPU array with the number of points per spline (not per spline point!)
Definition at line 198 of file gpuSplineUtils.cuh.
|
private |
CW: GPU array with the number of points per TF1 object.
Definition at line 205 of file gpuSplineUtils.cuh.
|
private |
GPU arrays to hold weight for event.
Definition at line 208 of file gpuSplineUtils.cuh.
|
private |
GPU arrays to hold weight for each spline.
Definition at line 210 of file gpuSplineUtils.cuh.
|
private |
GPU arrays to hold weight for each TF1.
Definition at line 212 of file gpuSplineUtils.cuh.
|
private |
Number of events living on CPU.
Definition at line 218 of file gpuSplineUtils.cuh.
|
private |
Number of params living on CPU.
Definition at line 216 of file gpuSplineUtils.cuh.
|
private |
KS: Textures are L1 cache variables which are well optimised for fetching. Make texture only for variables you often access but rarely overwrite. There are limits on texture memory so don't use huge arrays.
Definition at line 224 of file gpuSplineUtils.cuh.
|
private |
KS: Map keeping track how many parameters applies to each event, we keep two numbers here {number of splines per event, index where splines start for a given event}.
Definition at line 227 of file gpuSplineUtils.cuh.
|
private |
KS: Map keeping track how many parameters applies to each event, we keep two numbers here {number of TF1 per event, index where TF1 start for a given event}.
Definition at line 229 of file gpuSplineUtils.cuh.