CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Attributes | Private Attributes
cms::cuda::AtomicPairCounter Class Reference

#include <AtomicPairCounter.h>

Classes

union  Atomic2
 
struct  Counters
 

Public Types

using c_type = unsigned long long int
 

Public Member Functions

__host__ __device__ __attribute__ ((always_inline)) Counters add(uint32_t i)
 
 AtomicPairCounter ()
 
 AtomicPairCounter (c_type i)
 
__device__ __host__ Counters get () const
 
__device__ __host__ AtomicPairCounteroperator= (c_type i)
 

Static Public Attributes

static constexpr c_type incr = 1UL << 32
 

Private Attributes

Atomic2 counter
 

Detailed Description

Definition at line 11 of file AtomicPairCounter.h.

Member Typedef Documentation

◆ c_type

using cms::cuda::AtomicPairCounter::c_type = unsigned long long int

Definition at line 13 of file AtomicPairCounter.h.

Constructor & Destructor Documentation

◆ AtomicPairCounter() [1/2]

cms::cuda::AtomicPairCounter::AtomicPairCounter ( )
inline

Definition at line 15 of file AtomicPairCounter.h.

15 {}

◆ AtomicPairCounter() [2/2]

cms::cuda::AtomicPairCounter::AtomicPairCounter ( c_type  i)
inline

Definition at line 16 of file AtomicPairCounter.h.

16 { counter.ac = i; }

References mps_fire::i.

Member Function Documentation

◆ __attribute__()

__host__ __device__ cms::cuda::AtomicPairCounter::__attribute__ ( (always_inline)  )
inline

Definition at line 38 of file AtomicPairCounter.h.

38  {
39  c_type c = i;
40  c += incr;
41  Atomic2 ret;
42 #ifdef __CUDA_ARCH__
43  ret.ac = atomicAdd(&counter.ac, c);
44 #else
45  ret.ac = counter.ac;
46  counter.ac += c;
47 #endif
48  return ret.counters;
49  }

References cms::cudacompat::atomicAdd(), c, mps_fire::i, incr, and runTheMatrix::ret.

◆ get()

__device__ __host__ Counters cms::cuda::AtomicPairCounter::get ( ) const
inline

◆ operator=()

__device__ __host__ AtomicPairCounter& cms::cuda::AtomicPairCounter::operator= ( c_type  i)
inline

Definition at line 18 of file AtomicPairCounter.h.

18  {
19  counter.ac = i;
20  return *this;
21  }

References mps_fire::i.

Member Data Documentation

◆ counter

Atomic2 cms::cuda::AtomicPairCounter::counter
private

Definition at line 52 of file AtomicPairCounter.h.

Referenced by counter.Counters::__getitem__().

◆ incr

constexpr c_type cms::cuda::AtomicPairCounter::incr = 1UL << 32
staticconstexpr

Definition at line 33 of file AtomicPairCounter.h.

Referenced by __attribute__().

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:542
counter
Definition: counter.py:1
mps_fire.i
i
Definition: mps_fire.py:428
cms::cudacompat::atomicAdd
T1 atomicAdd(T1 *a, T2 b)
Definition: cudaCompat.h:51
cms::cuda::AtomicPairCounter::c_type
unsigned long long int c_type
Definition: AtomicPairCounter.h:13
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
cms::cuda::AtomicPairCounter::incr
static constexpr c_type incr
Definition: AtomicPairCounter.h:33