ATLAS Offline Software
Namespaces | Classes | Typedefs | Functions
CaloRecGPU::Helpers Namespace Reference

Namespaces

 Constants
 !
 
 MemoryContext
 ! Holds dummy classes just to identify the place in which memory lives.
 

Classes

struct  maybe_allocate
 Possibly holds an object in its internal buffer. More...
 
class  MemoryManagement
 ! Handles allocation of a type T, using indexer as the integer type to indicate sizes. More...
 
struct  separate_thread_accessor
 ! More...
 
class  separate_thread_holder
 Manages objects of type T in a thread-safe way, ensuring that there's an object available for each separate thread while minimizing the number of allocations. More...
 
class  SimpleContainer
 Holds a run-time amount of objects of type \T, measuring sizes with indexer, in memory context Context. More...
 
class  SimpleContainer< T, indexer, Context, false >
 
class  SimpleContainer< T, indexer, Context, true >
 
class  SimpleHolder
 Holds one objects of type \T in memory context Context. More...
 
class  SimpleHolder< T, Context, false >
 
class  SimpleHolder< T, Context, true >
 

Typedefs

template<class T , class indexer = unsigned int>
using CPU_array = SimpleContainer< T, indexer, MemoryContext::CPU, true >
 Holds a run-time specified amount of objects of type T in CPU memory. More...
 
template<class T , class indexer = unsigned int>
using CUDA_array = SimpleContainer< T, indexer, MemoryContext::CUDAGPU, true >
 Holds a run-time specified amount of objects of type T in CUDA GPU memory. More...
 
template<class T , class indexer = unsigned int>
using CUDA_kernel_array = SimpleContainer< T, indexer, MemoryContext::CUDAGPU, false >
 Non-owning pointer to an array of T in CUDA GPU memory. More...
 
template<class T >
using CPU_object = SimpleHolder< T, MemoryContext::CPU, true >
 Holds an object of type T in CPU memory. More...
 
template<class T >
using CUDA_object = SimpleHolder< T, MemoryContext::CUDAGPU, true >
 Holds an object of type T in CUDA GPU memory. More...
 
template<class T >
using CUDA_kernel_object = SimpleHolder< T, MemoryContext::CUDAGPU, false >
 Non-owning pointer to an object of type T in CUDA GPU memory. More...
 
template<class T >
using CUDA_pinned_CPU_object = SimpleHolder< T, MemoryContext::CUDAPinnedCPU, true >
 Holds an object of type T in CUDA GPU memory. More...
 

Functions

constexpr int int_ceil_div (const int num, const int denom)
 Returns the ceiling of num/denom, with proper rounding. More...
 
constexpr int int_floor_div (const int num, const int denom)
 Returns the floor of num/denom, with proper rounding. More...
 
template<class Base = float, class Exp = int>
constexpr Base compile_time_pow2 (const Exp exp)
 Returns 2 to the power of exp. More...
 
template<class T >
constexpr unsigned char Pearson_hash (const T number)
 Calculates a Pearson hash from @ number. More...
 
template<class T >
constexpr unsigned short Pearson_hash_16_bit (const T number)
 Calculates a 16-bit Pearson hash from @ number. More...
 

Typedef Documentation

◆ CPU_array

template<class T , class indexer = unsigned int>
using CaloRecGPU::Helpers::CPU_array = typedef SimpleContainer<T, indexer, MemoryContext::CPU, true>

Holds a run-time specified amount of objects of type T in CPU memory.

Definition at line 1052 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

◆ CPU_object

template<class T >
using CaloRecGPU::Helpers::CPU_object = typedef SimpleHolder<T, MemoryContext::CPU, true>

Holds an object of type T in CPU memory.

Definition at line 1450 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

◆ CUDA_array

template<class T , class indexer = unsigned int>
using CaloRecGPU::Helpers::CUDA_array = typedef SimpleContainer<T, indexer, MemoryContext::CUDAGPU, true>

Holds a run-time specified amount of objects of type T in CUDA GPU memory.

Definition at line 1056 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

◆ CUDA_kernel_array

template<class T , class indexer = unsigned int>
using CaloRecGPU::Helpers::CUDA_kernel_array = typedef SimpleContainer<T, indexer, MemoryContext::CUDAGPU, false>

Non-owning pointer to an array of T in CUDA GPU memory.

Definition at line 1060 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

◆ CUDA_kernel_object

template<class T >
using CaloRecGPU::Helpers::CUDA_kernel_object = typedef SimpleHolder<T, MemoryContext::CUDAGPU, false>

Non-owning pointer to an object of type T in CUDA GPU memory.

Definition at line 1458 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

◆ CUDA_object

template<class T >
using CaloRecGPU::Helpers::CUDA_object = typedef SimpleHolder<T, MemoryContext::CUDAGPU, true>

Holds an object of type T in CUDA GPU memory.

Definition at line 1454 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

◆ CUDA_pinned_CPU_object

Holds an object of type T in CUDA GPU memory.

Definition at line 1462 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

Function Documentation

◆ compile_time_pow2()

template<class Base = float, class Exp = int>
constexpr Base CaloRecGPU::Helpers::compile_time_pow2 ( const Exp  exp)
inlineconstexpr

Returns 2 to the power of exp.

Definition at line 226 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

227  {
228  Base ret = 1;
229  if (exp < 0)
230  {
231  for (Exp i = 0; i < -exp; ++i)
232  {
233  ret /= Base(2);
234  }
235  }
236  else
237  {
238  for (Exp i = 0; i < exp; ++i)
239  {
240  ret *= Base(2);
241  }
242  }
243  return ret;
244  }

◆ int_ceil_div()

constexpr int CaloRecGPU::Helpers::int_ceil_div ( const int  num,
const int  denom 
)
inlineconstexpr

Returns the ceiling of num/denom, with proper rounding.

Definition at line 213 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

214  {
215  return num / denom + (num % denom != 0);
216  }

◆ int_floor_div()

constexpr int CaloRecGPU::Helpers::int_floor_div ( const int  num,
const int  denom 
)
inlineconstexpr

Returns the floor of num/denom, with proper rounding.

Definition at line 219 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

220  {
221  return num / denom;
222  }

◆ Pearson_hash()

template<class T >
constexpr unsigned char CaloRecGPU::Helpers::Pearson_hash ( const number)
inlineconstexpr

Calculates a Pearson hash from @ number.

Definition at line 253 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

254  {
255  constexpr unsigned char initial_value = 42;
256  //The answer.
257 
258  constexpr unsigned char c_mult = 7;
259  constexpr unsigned char c_add = 1;
260  //For our "look up table": table[i] = c_mult * i + c_add
261  //For an appropriate choice of constants (such as this),
262  //this will be bijective (modulo 255), as required.
263 
264  unsigned char ret = initial_value;
265 
266  for (unsigned int i = 0; i < sizeof(T); i += sizeof(unsigned char))
267  {
268  const unsigned char to_hash = number >> (i * CHAR_BIT);
269  const unsigned char operand = ret ^ to_hash;
270  ret = c_mult * operand + c_add;
271  }
272 
273  return ret;
274  }

◆ Pearson_hash_16_bit()

template<class T >
constexpr unsigned short CaloRecGPU::Helpers::Pearson_hash_16_bit ( const number)
inlineconstexpr

Calculates a 16-bit Pearson hash from @ number.

Definition at line 280 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

281  {
282  constexpr unsigned short initial_value = 42754;
283  //The answer and the standard.
284 
285  constexpr unsigned short c_mult = 7;
286  constexpr unsigned short c_add = 1;
287  //For our "look up table": table[i] = c_mult * i + c_add
288  //For an appropriate choice of constants (such as this),
289  //this will be bijective (modulo 255), as required.
290 
291  unsigned short ret = initial_value;
292 
293  for (unsigned int i = 0; i < sizeof(T); i += sizeof(unsigned short))
294  {
295  const unsigned short to_hash = number >> (i * CHAR_BIT);
296  const unsigned short operand = ret ^ to_hash;
297  ret = c_mult * operand + c_add;
298  }
299 
300  return ret;
301  }
xAOD::short
short
Definition: Vertex_v1.cxx:165
xAOD::char
char
Definition: TrigDecision_v1.cxx:38
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:92
ret
T ret(T t)
Definition: rootspy.cxx:260
Base
compute_lumi.denom
denom
Definition: compute_lumi.py:76
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
python.selection.number
number
Definition: selection.py:20
ExpressionParsing::ast::operand
boost::variant< nil, double, unsigned int, bool, std::string, boost::recursive_wrapper< unaryexpr_ >, boost::recursive_wrapper< expression > > operand
Definition: ParsingInternals.h:43
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35