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

template<class T1 , class T2 >
constexpr auto int_ceil_div (const T1 num, const T2 denom)
 Returns the ceiling of num/denom, with proper rounding. More...
 
template<class T1 , class T2 >
constexpr auto int_floor_div (const T1 num, const T2 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 1057 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 1455 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 1061 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 1065 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 1463 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 1459 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.

◆ CUDA_pinned_CPU_object

Holds an object of type T in CUDA GPU memory.

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

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

◆ int_ceil_div()

template<class T1 , class T2 >
constexpr auto CaloRecGPU::Helpers::int_ceil_div ( const T1  num,
const T2  denom 
)
inlineconstexpr

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

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

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

◆ int_floor_div()

template<class T1 , class T2 >
constexpr auto CaloRecGPU::Helpers::int_floor_div ( const T1  num,
const T2  denom 
)
inlineconstexpr

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

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

223  {
224  return num / denom;
225  }

◆ Pearson_hash()

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

Calculates a Pearson hash from @ number.

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

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

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

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