CMS 3D CMS Logo

Classes | Functions | Variables
cms::cudacompat Namespace Reference

Classes

struct  CPUTraits
 
struct  dim3
 
struct  GPUTraits
 
struct  HostTraits
 

Functions

template<typename T >
T __ldg (T const *x)
 
void __syncthreads ()
 
bool __syncthreads_and (bool x)
 
bool __syncthreads_or (bool x)
 
void __threadfence ()
 
template<typename T1 , typename T2 >
T1 atomicAdd (T1 *a, T2 b)
 
template<typename T1 , typename T2 >
T1 atomicCAS (T1 *address, T1 compare, T2 val)
 
template<typename T1 , typename T2 >
T1 atomicInc (T1 *a, T2 b)
 
template<typename T1 , typename T2 >
T1 atomicMax (T1 *a, T2 b)
 
template<typename T1 , typename T2 >
T1 atomicMin (T1 *a, T2 b)
 
template<typename T1 , typename T2 >
T1 atomicSub (T1 *a, T2 b)
 
void resetGrid ()
 

Variables

const dim3 blockDim = {1, 1, 1}
 
thread_local dim3 blockIdx
 
thread_local dim3 gridDim
 
const dim3 threadIdx = {0, 0, 0}
 

Function Documentation

◆ __ldg()

template<typename T >
T cms::cudacompat::__ldg ( T const *  x)
inline

◆ __syncthreads()

void cms::cudacompat::__syncthreads ( )
inline

Definition at line 72 of file cudaCompat.h.

72 {}

◆ __syncthreads_and()

bool cms::cudacompat::__syncthreads_and ( bool  x)
inline

Definition at line 75 of file cudaCompat.h.

75 { return x; }

◆ __syncthreads_or()

bool cms::cudacompat::__syncthreads_or ( bool  x)
inline

Definition at line 74 of file cudaCompat.h.

74 { return x; }

◆ __threadfence()

void cms::cudacompat::__threadfence ( )
inline

Definition at line 73 of file cudaCompat.h.

73 {}

◆ atomicAdd()

template<typename T1 , typename T2 >
T1 cms::cudacompat::atomicAdd ( T1 *  a,
T2  b 
)

◆ atomicCAS()

template<typename T1 , typename T2 >
T1 cms::cudacompat::atomicCAS ( T1 *  address,
T1  compare,
T2  val 
)

Definition at line 31 of file cudaCompat.h.

31  {
32  T1 old = *address;
33  *address = old == compare ? val : old;
34  return old;
35  }

References heppy_batch::val.

◆ atomicInc()

template<typename T1 , typename T2 >
T1 cms::cudacompat::atomicInc ( T1 *  a,
T2  b 
)

Definition at line 38 of file cudaCompat.h.

38  {
39  auto ret = *a;
40  if ((*a) < T1(b))
41  (*a)++;
42  return ret;
43  }

References a, b, and runTheMatrix::ret.

◆ atomicMax()

template<typename T1 , typename T2 >
T1 cms::cudacompat::atomicMax ( T1 *  a,
T2  b 
)

Definition at line 66 of file cudaCompat.h.

66  {
67  auto ret = *a;
68  *a = std::max(*a, T1(b));
69  return ret;
70  }

References a, b, SiStripPI::max, and runTheMatrix::ret.

◆ atomicMin()

template<typename T1 , typename T2 >
T1 cms::cudacompat::atomicMin ( T1 *  a,
T2  b 
)

Definition at line 60 of file cudaCompat.h.

60  {
61  auto ret = *a;
62  *a = std::min(*a, T1(b));
63  return ret;
64  }

References a, b, min(), and runTheMatrix::ret.

◆ atomicSub()

template<typename T1 , typename T2 >
T1 cms::cudacompat::atomicSub ( T1 *  a,
T2  b 
)

◆ resetGrid()

void cms::cudacompat::resetGrid ( )
inline

Definition at line 81 of file cudaCompat.h.

81  {
82  blockIdx = {0, 0, 0};
83  gridDim = {1, 1, 1};
84  }

References blockIdx, and gridDim.

Variable Documentation

◆ blockDim

const dim3 cms::cudacompat::blockDim = {1, 1, 1}

◆ blockIdx

thread_local dim3 cms::cudacompat::blockIdx

◆ gridDim

thread_local dim3 cms::cudacompat::gridDim

◆ threadIdx

const dim3 cms::cudacompat::threadIdx = {0, 0, 0}
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:373
min
T min(T a, T b)
Definition: MathUtil.h:58
cms::cudacompat::gridDim
thread_local dim3 gridDim
Definition: cudaCompat.cc:6
b
double b
Definition: hdecay.h:118
a
double a
Definition: hdecay.h:119
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
heppy_batch.val
val
Definition: heppy_batch.py:351
genVertex_cff.x
x
Definition: genVertex_cff.py:12
compare
Definition: compare.py:1
cms::cudacompat::blockIdx
thread_local dim3 blockIdx
Definition: cudaCompat.cc:5