Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
Batches.h
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Authors:
4 * Emmanouil Michalainas, CERN 3 March 2021
5 *
6 * Copyright (c) 2021, CERN
7 *
8 * Redistribution and use in source and binary forms,
9 * with or without modification, are permitted according to the terms
10 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
11 */
12
13/**
14\file Batches.h
15\class Batch
16\class Batches
17\ingroup roofit_dev_docs_batchcompute
18
19These classes encapsulate the necessary data for the computations.
20They are lightweight objects designed to be passed by value and also flexible,
21so that they can contain data for every kind of compute function.
22**/
23#ifndef ROOFIT_BATCHCOMPUTE_BATCHES_H
24#define ROOFIT_BATCHCOMPUTE_BATCHES_H
25
26#include <cstdint>
27
28namespace RooBatchCompute {
29
30class Batch {
31public:
32 const double *__restrict _array = nullptr;
33 bool _isVector = false;
34
35#ifdef __CUDACC__
36 __device__ constexpr double operator[](std::size_t i) const noexcept { return _isVector ? _array[i] : _array[0]; }
37#else
38 constexpr double operator[](std::size_t i) const noexcept { return _array[i]; }
39#endif // #ifdef __CUDACC__
40};
41
42class Batches {
43public:
44 Batch *args = nullptr;
45 double *extra;
46 std::size_t nEvents = 0;
47 std::size_t nBatches = 0;
48 std::size_t nExtra = 0;
49 double *__restrict output = nullptr;
50};
51
52} // end namespace RooBatchCompute
53
54#endif // #ifdef ROOFIT_BATCHCOMPUTE_BATCHES_H
const double *__restrict _array
Definition Batches.h:32
constexpr double operator[](std::size_t i) const noexcept
Definition Batches.h:38
std::size_t nEvents
Definition Batches.h:46
double *__restrict output
Definition Batches.h:49
std::size_t nBatches
Definition Batches.h:47
Namespace for dispatching RooFit computations to various backends.