DDASToys for NSCLDAQ  6.2-000
Public Member Functions | List of all members
ddastoys::analyticfit::CudaFitEngine2 Class Reference

CUDA-aware fit engine for analytic double pulse fits. More...

#include <jacobian_analytic.h>

Inheritance diagram for ddastoys::analyticfit::CudaFitEngine2:
Inheritance graph
[legend]
Collaboration diagram for ddastoys::analyticfit::CudaFitEngine2:
Collaboration graph
[legend]

Public Member Functions

 CudaFitEngine2 (std::vector< std::pair< uint16_t, uint16_t >> &data)
 Constructor. More...
 
 ~CudaFitEngine2 ()
 Destructor. More...
 
virtual void jacobian (const gsl_vector *p, gsl_matrix *J)
 Marshall the parameter and call the jacobian2 kernel. Then pull the Jacobian matrix out of the GPU and marshall it back into the GSL Jacobian matrix. More...
 
virtual void residuals (const gsl_vector *p, gsl_vector *r)
 Fire off the kernel to compute the pointwise residuals. More...
 
- Public Member Functions inherited from ddastoys::CFitEngine
 CFitEngine (std::vector< std::pair< uint16_t, uint16_t >> &data)
 Constructor. More...
 
virtual ~CFitEngine ()
 Destructor.
 

Additional Inherited Members

- Protected Attributes inherited from ddastoys::CFitEngine
std::vector< uint16_t > x
 Trace x coordinate vector.
 
std::vector< uint16_t > y
 Trace y coordinate vector.
 

Detailed Description

CUDA-aware fit engine for analytic double pulse fits.

The concept is that each GSL lmfitter can supply a pair of methods: One that computes a vector of residuals and one that computes a Jacobian matrix of partial derivatives. At the implementation level we have two types of fits we need done: Single pulse fits and double pulse fits (the engines with names ending in 1 or 2). For each fit type we have two fit engines: 1) Serial computation (the engines with names starting with Serial) 2) GPU accelerated (the engines with names starting with Cuda).

Finally a fit factory can generate the appropriate fit engine as desired by the actual fit.

Todo:
(ASC 10/30/23): Manages some device pointers. Not copyable, and most likely is not ever copied. But we can make it safe.

Constructor & Destructor Documentation

◆ CudaFitEngine2()

ddastoys::analyticfit::CudaFitEngine2::CudaFitEngine2 ( std::vector< std::pair< uint16_t, uint16_t >> &  data)

Constructor.

Parameters
dataThe trace data in x/y pairs.

Allocate the GPU resources:

  • Trace x array
  • Trace y array.
  • Residual array.
  • Jacobian vector (m_npts * 9)
  • Move the trace into the GPU where it stays for all iterations of the fit.

◆ ~CudaFitEngine2()

ddastoys::analyticfit::CudaFitEngine2::~CudaFitEngine2 ( )

Destructor.

Just frees the device blocks.

Member Function Documentation

◆ jacobian()

void ddastoys::analyticfit::CudaFitEngine2::jacobian ( const gsl_vector *  p,
gsl_matrix *  J 
)
virtual

Marshall the parameter and call the jacobian2 kernel. Then pull the Jacobian matrix out of the GPU and marshall it back into the GSL Jacobian matrix.

Parameters
pParameter vector from GSL.
JJacobian matrix to output.
Note
We organize the computing into 32 thread blocks because there are 32 thread per warp.

Implements ddastoys::CFitEngine.

◆ residuals()

void ddastoys::analyticfit::CudaFitEngine2::residuals ( const gsl_vector *  p,
gsl_vector *  r 
)
virtual

Fire off the kernel to compute the pointwise residuals.

Parameters
pFit parameters.
rResidual vector.

Implements ddastoys::CFitEngine.


The documentation for this class was generated from the following files: