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 1050 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 1448 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 1054 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 1058 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 1456 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 1452 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

◆ CUDA_pinned_CPU_object

Holds an object of type T in CUDA GPU memory.

Definition at line 1460 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 227 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

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

◆ 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 214 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

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

◆ 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 220 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

221  {
222  return num / denom;
223  }

◆ Pearson_hash()

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

Calculates a Pearson hash from @ number.

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

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

◆ 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 281 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

282  {
283  constexpr unsigned short initial_value = 42754;
284  //The answer and the standard.
285 
286  constexpr unsigned short c_mult = 7;
287  constexpr unsigned short c_add = 1;
288  //For our "look up table": table[i] = c_mult * i + c_add
289  //For an appropriate choice of constants (such as this),
290  //this will be bijective (modulo 255), as required.
291 
292  unsigned short ret = initial_value;
293 
294  for (unsigned int i = 0; i < sizeof(T); i += sizeof(unsigned short))
295  {
296  const unsigned short to_hash = number >> (i * CHAR_BIT);
297  const unsigned short operand = ret ^ to_hash;
298  ret = c_mult * operand + c_add;
299  }
300 
301  return ret;
302  }
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:85
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