ROOT
master
Reference Guide
Loading...
Searching...
No Matches
RooBatchComputeTypes.h
Go to the documentation of this file.
1
/*
2
* Project: RooFit
3
* Authors:
4
* Emmanouil Michalainas, CERN 6 January 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
#ifndef ROOFIT_BATCHCOMPUTE_ROOBATCHCOMPUTETYPES_H
14
#define ROOFIT_BATCHCOMPUTE_ROOBATCHCOMPUTETYPES_H
15
16
17
#ifdef __CUDACC__
18
#define __roodevice__ __device__
19
#define __roohost__ __host__
20
#define __rooglobal__ __global__
21
#else
22
#define __roodevice__
23
#define __roohost__
24
#define __rooglobal__
25
#endif
// #indef __CUDACC__
26
27
// Double-precision atomicAdd() is only provided by the CUDA runtime for
28
// compute capability 6.0 and higher. This is the canonical fallback
29
// implementation from the CUDA C++ Programming Guide for older devices.
30
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ < 600
31
static
__inline__ __device__
double
atomicAdd(
double
*address,
double
val)
32
{
33
unsigned
long
long
int
*address_as_ull = (
unsigned
long
long
int
*)address;
34
unsigned
long
long
int
old = *address_as_ull;
35
unsigned
long
long
int
assumed;
36
do
{
37
assumed = old;
38
old = atomicCAS(address_as_ull, assumed, __double_as_longlong(val + __longlong_as_double(assumed)));
39
}
while
(assumed != old);
40
return
__longlong_as_double(old);
41
}
42
#endif
43
44
#endif
roofit
batchcompute
res
RooBatchComputeTypes.h
ROOTmaster - Reference Guide Generated on Fri Oct 16 2026 04:43:11 (GVA Time) using Doxygen 1.10.0