MaCh3  2.4.2
Reference Guide
gpuMCMCProcessorUtils.cuh
Go to the documentation of this file.
1 #pragma once
2 // MaCh3 utils for processing/diagnostic MCMC
3 // Written by Kamil Skwarczynski
4 //
5 // Contains code to run on CUDA GPUs. Right now only can calculate autocorrelations
6 // Potential extensions:
7 // -Covariance matrix calculations and other matrix operations
8 // -Effective Sample Size evaluation
9 
10 #include "Manager/gpuUtils.cuh"
11 
14 
20 __global__ void EvalOnGPU_AutoCorr(
21  const float* __restrict__ ParStep_gpu,
22  const float* __restrict__ ParamSums_gpu,
23  float* NumeratorSum_gpu,
24  float* DenomSum_gpu);
25 
26 
30 {
31  public:
35  virtual ~MCMCProcessorGPU();
36 
41  __host__ void InitGPU_AutoCorr(
42  int n_Entries,
43  int n_Pars,
44  const int n_Lags);
45 
51  __host__ void CopyToGPU_AutoCorr(
52  float *ParStep_cpu,
53  float *NumeratorSum_cpu,
54  float *ParamSums_cpu,
55  float *DenomSum_cpu);
56 
60  __host__ void RunGPU_AutoCorr(float* NumeratorSum_cpu,
61  float* DenomSum_cpu);
62 
64  __host__ void CleanupGPU_AutoCorr();
65 
66 
67  private:
69  float* ParStep_gpu;
71  float* ParamSums_gpu;
72  float* DenomSum_gpu;
73 
74  // h_NAME declares HOST constants (live on CPU)
75  int h_nLag;
76  int h_nDraws;
78 };
Class responsible for performing MCMC Processing with GPU.
__host__ void InitGPU_AutoCorr(int n_Entries, int n_Pars, const int n_Lags)
KS: Initialiser, here we allocate memory for variables and copy constants.
virtual ~MCMCProcessorGPU()
destructor
__host__ void CleanupGPU_AutoCorr()
KS: free memory on gpu.
MCMCProcessorGPU()
constructor
__host__ void CopyToGPU_AutoCorr(float *ParStep_cpu, float *NumeratorSum_cpu, float *ParamSums_cpu, float *DenomSum_cpu)
KS: Copy necessary variables from CPU to GPU.
__host__ void RunGPU_AutoCorr(float *NumeratorSum_cpu, float *DenomSum_cpu)
KS: This call the main kernel responsible for calculating LagL and later copy results back to CPU.
float * ParStep_gpu
Value of each param at GPU.
__global__ void EvalOnGPU_AutoCorr(const float *__restrict__ ParStep_gpu, const float *__restrict__ ParamSums_gpu, float *NumeratorSum_gpu, float *DenomSum_gpu)
Eval autocorrelations based on Box and Jenkins.
Common CUDA utilities and definitions for shared GPU functionality.