ATLAS Offline Software
Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 //
4 // Dear emacs, this is -*- c++ -*-
5 //
6 
7 #ifndef CALORECGPU_HELPERS_H
8 #define CALORECGPU_HELPERS_H
9 
10 #include <utility>
11 #include <type_traits>
12 #include <cstring>
13 //For memcpy, of all things...
14 #include <string>
15 #include <cstdio>
16 #include <iostream>
17 #include <thread>
18 #include <mutex>
19 #include <memory>
20 #include <vector>
21 #include <climits>
22 #include <new>
23 #include <cmath>
24 
25 #if __cpp_lib_math_constants
26  #include <numbers>
27 #endif
28 //This is the best way to have pi,
29 //but we provide a more manual alternative.
30 //Of course, there's also M_PI,
31 //but we wanted to ensure the type matched
32 //to prevent any GPU-based casting shenanigans.
33 
34 namespace CaloRecGPU
35 {
36 
37 #ifndef CUDA_AVAILABLE
38 
39  #ifdef __CUDA_ARCH__
40  #define CUDA_AVAILABLE 1
41  #elif __CUDA__
42  #define CUDA_AVAILABLE 1
43  #elif __CUDACC__
44  #define CUDA_AVAILABLE 1
45  #else
46  #define CUDA_AVAILABLE 0
47  #endif
48 
49 #endif
50 
51 #if CUDA_AVAILABLE
52 
53 #define CUDA_HOS_DEV __host__ __device__
54 
55 
61  CUDA_HOS_DEV inline void CUDA_gpu_assert(cudaError_t code, const char * file, int line, bool abort = true)
62  {
63  if (code != cudaSuccess)
64  {
65  printf("CUDA error: %s (%s %d)\n", cudaGetErrorString(code), file, line);
66  if (abort)
67  {
68 #ifdef __CUDA_ARCH__
69  asm("trap;");
70 #else
71  exit(code);
72 #endif
73  }
74  }
75  }
76 
81 #define CUDA_ERRCHECK(...) CUDA_ERRCHECK_HELPER(__VA_ARGS__, true)
82 
83 #define CUDA_ERRCHECK_HELPER(ans, ...) do { ::CaloRecGPU::CUDA_gpu_assert((ans), __FILE__, __LINE__, CUDA_ERRCHECK_GET_FIRST(__VA_ARGS__, true) ); } while(0)
84 #define CUDA_ERRCHECK_GET_FIRST(x, ...) x
85 
86 
87 #if defined(__CUDA_ARCH__) && __CUDA_ARCH__ > 350
88  #if CUDART_VERSION >= 12000
89  #define CUDA_CAN_USE_TAIL_LAUNCH 1
90  #else
91  #define CUDA_CAN_USE_TAIL_LAUNCH 0
92  #endif
93 #elif defined(__CUDA_ARCH__)
94  #error "CUDA compute capability at least 3.5 is needed so we can have dynamic parallelism!"
95 #endif
96 
97 
98 #else
99 
100 #define CUDA_HOS_DEV
101 #define CUDA_ERRCHECK(...)
102 
103 #endif
104 
105  namespace CUDA_Helpers
106  {
107 
109  {
110  void * ptr = nullptr;
111 
112  template <class T = const void>
113  constexpr operator T * () const
114  {
115  return (T *) ptr;
116  }
117 
118  constexpr operator bool() const
119  {
120  return ptr != nullptr;
121  }
122 
123  template <class T>
125  {
126  }
127 
128  CUDAStreamPtrHolder() = default;
129  };
130  //Can't do much more than this
131  //since cudaStream_t is a typedef...
132  //Though not typesafe, it is still
133  //semantically more safe than a naked void *...
134 
138  void * allocate(const size_t num);
139 
143  void deallocate(void * address);
144 
148  void * allocate_pinned(const size_t num);
149 
154 
155 
159  void GPU_to_CPU(void * dest, const void * const source, const size_t num);
160 
164  void CPU_to_GPU(void * dest, const void * const source, const size_t num);
165 
169  void GPU_to_GPU(void * dest, const void * const source, const size_t num);
170 
171 
175  void GPU_to_CPU_async(void * dest, const void * const source, const size_t num, CUDAStreamPtrHolder stream = {});
176 
180  void CPU_to_GPU_async(void * dest, const void * const source, const size_t num, CUDAStreamPtrHolder stream = {});
181 
185  void GPU_to_GPU_async(void * dest, const void * const source, const size_t num, CUDAStreamPtrHolder stream = {});
186 
191 
195  void optimize_block_and_grid_size(void * func, int & block_size, int & grid_size, const int dynamic_memory = 0, const int block_size_limit = 0);
196 
200  void optimize_block_and_grid_size_for_cooperative_launch(void * func, int & block_size, int & grid_size, const int dynamic_memory = 0, const int block_size_limit = 0);
201 
203 
205 
206  std::string GPU_name();
207  }
208 
209  namespace Helpers
210  {
211 
213  inline constexpr int int_ceil_div(const int num, const int denom)
214  {
215  return num / denom + (num % denom != 0);
216  }
217 
219  inline constexpr int int_floor_div(const int num, const int denom)
220  {
221  return num / denom;
222  }
223 
225  template <class Base = float, class Exp = int>
226  inline constexpr Base compile_time_pow2(const Exp exp)
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  }
245  //Though we could possibly bit-hack stuff due to IEEE-754 reliance elsewhere,
246  //it's not valid and type-safe C++...
247  //Since it's compile-time, this being a trifle slower is meaningless.
248 
249 
252  template <class T>
253  inline constexpr unsigned char Pearson_hash(const T number)
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  }
275 
276 
279  template <class T>
280  inline constexpr unsigned short Pearson_hash_16_bit(const T number)
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  }
302 
303 
305  namespace Constants
306  {
307 #ifdef __cpp_lib_math_constants
308  template <class T>
309  inline constexpr T pi = std::numbers::pi_v<T>;
310 
311  template <class T>
312  inline constexpr T sqrt2 = std::numbers::sqrt2_v<T>;
313 #else
314  template <class T>
315  inline constexpr T pi = T(3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624L);
316 
317  template <class T>
318  inline constexpr T sqrt2 = T(1.4142135623730950488016887242096980785696718753769480731766797379907324784621070388503875343276415727350138462309122970249248360558507372126441214970999358314132226659275055927557999505011527820605714701095599716059702745345968620147285174186408891986095523292304843087143214508397626036279952514079896872533965463318088296406206152583523950547457502877599617298355752203375318570113543746034084988471603868999706990048150305440277903164542478230684929369186215805784631115966687130130156185689872372352885092649L);
319 #endif
320 
321  template <class T>
322  inline constexpr T inv_sqrt2 = T(0.70710678118654752440084436210484903928483593768847403658833986899536623923105351942519376716382078636750692311545614851246241802792536860632206074854996791570661133296375279637789997525057639103028573505477998580298513726729843100736425870932044459930477616461524215435716072541988130181399762570399484362669827316590441482031030762917619752737287514387998086491778761016876592850567718730170424942358019344998534950240751527201389515822712391153424646845931079028923155579833435650650780928449361861764425463243L);
323  //Why is this not in the C++ constants?!
324 
325  }
326 
327  CUDA_HOS_DEV static inline
328  float erf_inv_wrapper (const float x)
329  {
330  using namespace std;
331 #ifdef __CUDA_ARCH__
332  return erfinvf(x);
333 #else
334  //Copied directly from ROOT...
335 
336  int kMaxit = 50;
337  float kEps = 1e-14;
338  float kConst = 0.8862269254527579; // sqrt(pi)/2.0
339 
340  if (abs(x) <= kEps)
341  {
342  return kConst * x;
343  }
344 
345  // Newton iterations
346  float erfi, derfi, y0, y1, dy0, dy1;
347  if (fabsf(x) < 1.0f)
348  {
349  erfi = kConst * fabsf(x);
350  y0 = erff(0.9f * erfi);
351  derfi = 0.1 * erfi;
352  for (int iter = 0; iter < kMaxit; iter++)
353  {
354  y1 = 1. - erfc(erfi);
355  dy1 = fabsf(x) - y1;
356  if (fabsf(dy1) < kEps)
357  {
358  if (x < 0)
359  {
360  return -erfi;
361  }
362  else
363  {
364  return erfi;
365  }
366  }
367  dy0 = y1 - y0;
368  derfi *= dy1 / dy0;
369  y0 = y1;
370  erfi += derfi;
371  if (fabsf(derfi / erfi) < kEps)
372  {
373  if (x < 0)
374  {
375  return -erfi;
376  }
377  else
378  {
379  return erfi;
380  }
381  }
382  }
383  }
384  return 0; //did not converge
385 #endif
386  }
387 
388  CUDA_HOS_DEV static inline
389  float regularize_angle(const float b, const float a = 0.f)
390  //a. k. a. proxim in Athena code.
391  {
392  using namespace std;
393  const float diff = b - a;
394  const float divi = (fabsf(diff) - Helpers::Constants::pi<float>) / (2 * Helpers::Constants::pi<float>);
395  return b - ceilf(divi) * ((b > a + Helpers::Constants::pi<float>) - (b < a - Helpers::Constants::pi<float>)) * 2 * Helpers::Constants::pi<float>;
396  }
397 
398  CUDA_HOS_DEV static inline
399  double regularize_angle(const double b, const double a = 0.)
400  //a. k. a. proxim in Athena code.
401  {
402  using namespace std;
403  const float diff = b - a;
404  const float divi = (fabs(diff) - Helpers::Constants::pi<double>) / (2 * Helpers::Constants::pi<double>);
405  return b - ceil(divi) * ((b > a + Helpers::Constants::pi<double>) - (b < a - Helpers::Constants::pi<double>)) * 2 * Helpers::Constants::pi<double>;
406  }
407 
408  template <class T>
409  CUDA_HOS_DEV static inline
410  T angular_difference(const T x, const T y)
411  {
412  return regularize_angle(x - y, T(0));
413  //Might be problematic if x and y have a significant difference
414  //in terms of factors of pi, in which case one should add
415  //a regularize_angle(x) and regularize_angle(y) in there.
416  //For our use case, I think this will be fine.
417  //(The Athena ones are even worse,
418  // being a branchy thing that only
419  // takes care of one factor of 2 pi...)
420  }
421 
422  CUDA_HOS_DEV static inline
423  float eta_from_coordinates(const float x, const float y, const float z)
424  {
425  using namespace std;
426  const float rho2 = x * x + y * y;
427  if (rho2 > 0.)
428  {
429  const float m = sqrtf(rho2 + z * z);
430  return 0.5 * logf((m + z) / (m - z));
431  }
432  else
433  {
434  constexpr float s_etaMax = 22756.0;
435  return z + ((z > 0) - (z < 0)) * s_etaMax;
436  }
437  }
438 
439  CUDA_HOS_DEV static inline
440  double eta_from_coordinates(const double x, const double y, const double z)
441  {
442  using namespace std;
443  const double rho2 = x * x + y * y;
444  if (rho2 > 0.)
445  {
446  const double m = sqrt(rho2 + z * z);
447  return 0.5 * log((m + z) / (m - z));
448  }
449  else
450  {
451  constexpr double s_etaMax = 22756.0;
452  return z + ((z > 0) - (z < 0)) * s_etaMax;
453  }
454  }
455 
457  namespace MemoryContext
458  {
459  struct CPU
460  {
461  constexpr static char const * name = "CPU";
462  };
463  struct CUDAGPU
464  {
465  constexpr static char const * name = "CUDA GPU";
466  };
468  {
469  constexpr static char const * name = "CUDA Pinned CPU";
470  };
471  }
472 
474  template <class T, class indexer>
476  {
477  private:
478  template <class C, class dummy = void> struct unary_helper;
479 
480  template <class dummy> struct unary_helper<MemoryContext::CPU, dummy>
481  {
482  static inline T * allocate(const indexer size)
483  {
484  return new T[size];
485  }
486 
487  static inline void deallocate(T *& arr)
488  {
489  delete[] arr;
490  }
491 
492  };
493 
494  template <class dummy> struct unary_helper<MemoryContext::CUDAGPU, dummy>
495  {
496  static inline T * allocate(const indexer size)
497  {
498  return static_cast<T *>(CUDA_Helpers::allocate(sizeof(T) * size));
499  }
500 
501  static inline void deallocate(T *& arr)
502  {
504  }
505  };
506 
507 
508  template <class dummy> struct unary_helper<MemoryContext::CUDAPinnedCPU, dummy>
509  {
510  static inline T * allocate(const indexer size)
511  {
512  return static_cast<T *>(CUDA_Helpers::allocate_pinned(sizeof(T) * size));
513  }
514 
515  static inline void deallocate(T *& arr)
516  {
518  }
519  };
520 
521  template <class C1, class C2, class dummy = void> struct copy_helper;
522 
523  template <class dummy> struct copy_helper<MemoryContext::CPU, MemoryContext::CPU, dummy>
524  {
525  static inline void copy (T * dest, const T * const source, const indexer sz)
526  {
527  std::memcpy(dest, source, sizeof(T) * sz);
528  }
529  };
530 
531  template <class dummy> struct copy_helper<MemoryContext::CPU, MemoryContext::CUDAGPU, dummy>
532  {
533  static inline void copy (T * dest, const T * const source, const indexer sz)
534  {
535  CUDA_Helpers::GPU_to_CPU(dest, source, sizeof(T) * sz);
536  }
537  };
538 
539  template <class dummy> struct copy_helper<MemoryContext::CUDAGPU, MemoryContext::CUDAGPU, dummy>
540  {
541  static inline void copy (T * dest, const T * const source, const indexer sz)
542  {
543  CUDA_Helpers::GPU_to_GPU(dest, source, sizeof(T) * sz);
544  }
545  };
546 
547  template <class dummy> struct copy_helper<MemoryContext::CUDAGPU, MemoryContext::CPU, dummy>
548  {
549  static inline void copy (T * dest, const T * const source, const indexer sz)
550  {
551  CUDA_Helpers::CPU_to_GPU(dest, source, sizeof(T) * sz);
552  }
553  };
554 
555  template <class dummy> struct copy_helper<MemoryContext::CUDAPinnedCPU, MemoryContext::CPU, dummy>
556  {
557  static inline void copy (T * dest, const T * const source, const indexer sz)
558  {
559  std::memcpy(dest, source, sizeof(T) * sz);
560  }
561  };
562 
563  template <class dummy> struct copy_helper<MemoryContext::CPU, MemoryContext::CUDAPinnedCPU, dummy>
564  {
565  static inline void copy (T * dest, const T * const source, const indexer sz)
566  {
567  std::memcpy(dest, source, sizeof(T) * sz);
568  }
569  };
570 
571  template <class dummy> struct copy_helper<MemoryContext::CUDAPinnedCPU, MemoryContext::CUDAPinnedCPU, dummy>
572  {
573  static inline void copy (T * dest, const T * const source, const indexer sz)
574  {
575  std::memcpy(dest, source, sizeof(T) * sz);
576  }
577  };
578 
579  template <class dummy> struct copy_helper<MemoryContext::CUDAPinnedCPU, MemoryContext::CUDAGPU, dummy>
580  {
581  static inline void copy (T * dest, const T * const source, const indexer sz)
582  {
583  CUDA_Helpers::GPU_to_CPU(dest, source, sizeof(T) * sz);
584  }
585  };
586 
587  template <class dummy> struct copy_helper<MemoryContext::CUDAGPU, MemoryContext::CUDAPinnedCPU, dummy>
588  {
589  static inline void copy (T * dest, const T * const source, const indexer sz)
590  {
591  CUDA_Helpers::CPU_to_GPU(dest, source, sizeof(T) * sz);
592  }
593  };
594 
595 
596  template <class C1, class C2, class dummy = void> struct move_helper;
597 
598  template <class C1, class C2, class dummy> struct move_helper
599  {
600  inline static void move(T *& dest, T *& source, const indexer sz)
601  {
603  MemoryManagement<T, indexer>::template copy<C1, C2>(dest, source, sz);
604  MemoryManagement<T, indexer>::template deallocate<C2>(source);
605  }
606  };
607 
608  template <class C, class dummy> struct move_helper<C, C, dummy>
609  {
610  inline static void move(T *& dest, T *& source, const indexer)
611  {
612  dest = source;
613  source = nullptr;
614  }
615  };
616 
617  public:
619  template <class Context> static inline T * allocate(const indexer size)
620  {
621  T * ret = nullptr;
622  if (size > 0)
623  {
625  }
626 #if CALORECGPU_HELPERS_DEBUG
627  std::cerr << "ALLOCATED " << size << " x " << sizeof(T) << " in " << Context::name << ": " << ret << std::endl;
628 #endif
629  return ret;
630  }
631 
633  template <class Context> static inline void deallocate(T *& arr)
634  {
635  if (arr == nullptr)
636  //This check is to ensure the code behaves on non-CUDA enabled platforms
637  //where some destructors might still be called with nullptr.
638  {
639  return;
640  }
642 #if CALORECGPU_HELPERS_DEBUG
643  std::cerr << "DEALLOCATED in " << Context::name << ": " << arr << std::endl;
644 #endif
645  arr = nullptr;
646  }
647 
648 
650  template <class DestContext, class SourceContext>
651  static inline void copy(T * dest, const T * const source, const indexer sz)
652  {
653  if (sz > 0 && source != nullptr)
654  {
656  }
657 #if CALORECGPU_HELPERS_DEBUG
658  std::cerr << "COPIED " << sz << " from " << SourceContext::name << " to " << DestContext::name << ": " << source << " to " << dest << std::endl;
659 #endif
660  }
661 
662 
668  template <class DestContext, class SourceContext>
669  static inline void move(T *& dest, T *& source, const indexer sz)
670  {
671 #if CALORECGPU_HELPERS_DEBUG
672  std::cerr << "MOVED " << sz << " from " << SourceContext::name << " to " << DestContext::name << ": " << source << " to " << dest;
673 #endif
674  if (sz > 0 && source != nullptr)
675  {
677  }
678  else
679  {
680  dest = nullptr;
681  deallocate<SourceContext>(source);
682  }
683 #if CALORECGPU_HELPERS_DEBUG
684  std::cerr << " | " << source << " to " << dest << std::endl;
685 #endif
686  }
687 
688  };
689 
696  template <class T, class indexer, class Context, bool hold_arrays = true>
698 
699  template <class T, class indexer, class Context>
700  class SimpleContainer<T, indexer, Context, true>
701  {
702  static_assert(std::is_trivially_copyable<T>::value, "SimpleContainer only works with a trivially copyable type.");
703  T * m_array;
704  indexer m_size;
705 
706  template <class a, class b, class c, bool d> friend class SimpleContainer;
707 
709 
710  public:
711 
712  CUDA_HOS_DEV inline indexer size() const
713  {
714  return m_size;
715  }
716 
717  CUDA_HOS_DEV inline T & operator[] (const indexer i)
718  {
719  return m_array[i];
720  }
721 
722  CUDA_HOS_DEV inline const T & operator[] (const indexer i) const
723  {
724  return m_array[i];
725  }
726 
727  inline void clear()
728  {
729  Manager::deallocate(m_array);
730  m_size = 0;
731  }
732 
733  inline void resize(const indexer new_size)
734  {
735  if (new_size == 0)
736  {
737  clear();
738  }
739  else if (new_size != m_size)
740  {
741  T * temp = m_array;
742  m_array = Manager::template allocate<Context>(new_size);
743  Manager::template copy<Context, Context>(m_array, temp, (m_size < new_size ? m_size : new_size));
744  Manager::template deallocate<Context>(temp);
745  m_size = new_size;
746  }
747  }
748 
749  SimpleContainer() : m_array(nullptr), m_size(0)
750  {
751  }
752 
753  SimpleContainer(const indexer sz)
754  {
755  m_array = Manager::template allocate<Context>(sz);
756  m_size = sz;
757  }
758 
762  SimpleContainer(T * other_array, const indexer sz)
763  {
764  m_array = Manager::template allocate<Context>(sz);
765  Manager::template copy<Context, Context>(m_array, other_array, sz);
766  m_size = sz;
767  }
768 
770  {
771  m_size = other.m_size;
772  m_array = Manager::template allocate<Context>(m_size);
773  Manager::template copy<Context, Context>(m_array, other.m_array, m_size);
774  }
775 
777  {
778  m_size = other.m_size;
779  m_array = nullptr;
780  Manager::template move<Context, Context>(m_array, other.m_array, m_size);
781  other.m_size = 0;
782  }
783 
784  template <class other_indexer, class other_context, bool other_hold>
786  {
787  m_size = other.m_size;
788  m_array = Manager::template allocate<Context>(m_size);
789  Manager::template copy<Context, other_context>(m_array, other.m_array, m_size);
790  }
791 
792  template <class other_indexer, class other_context>
794  {
795  m_size = other.m_size;
796  m_array = nullptr;
797  Manager::template move<Context, other_context>(m_array, other.m_array, m_size);
798  other.m_size = 0;
799  }
800 
801  SimpleContainer & operator= (const SimpleContainer & other)
802  {
803  if (this == &other)
804  {
805  return (*this);
806  }
807  else
808  {
809  resize(other.size());
810  Manager::template copy<Context, Context>(m_array, other.m_array, m_size);
811  return (*this);
812  }
813  }
814 
816  {
817  if (this == &other)
818  {
819  return (*this);
820  }
821  else
822  {
823  clear();
824  Manager::template move<Context, Context>(m_array, other.m_array, other.size());
825  m_size = other.m_size;
826  other.m_size = 0;
827  return (*this);
828  }
829  }
830 
831 
832  template <class other_indexer, class other_context, bool other_hold>
834  {
835  resize(other.m_size);
836  Manager::template copy<Context, other_context>(m_array, other.m_array, m_size);
837  return (*this);
838  }
839 
840  template <class other_indexer, class other_context>
842  {
843  clear();
844  Manager::template move<Context, other_context>(m_array, other.m_array, other.m_size);
845  m_size = other.m_size;
846  other.m_size = 0;
847  return (*this);
848  }
849 
851  {
852  Manager::template deallocate<Context>(m_array);
853  m_size = 0;
854  }
855 
856  CUDA_HOS_DEV operator const T * () const
857  {
858  return m_array;
859  }
860 
861  CUDA_HOS_DEV operator T * ()
862  {
863  return m_array;
864  }
865 
866  template <class stream, class str = std::basic_string<typename stream::char_type> >
867  void textual_output(stream & s, const str & separator = " ") const
868  {
870  {
871  s << m_size << separator;
872  for (indexer i = 0; i < m_size - 1; ++i)
873  {
874  s << m_array[i] << separator;
875  }
876  s << m_array[m_size - 1];
877  }
878  else
879  {
881  other.textual_output(s, separator);
882  }
883  }
884 
885  template <class stream>
887  {
889  {
890  indexer new_size;
891  s >> new_size >> std::ws;
892  if (s.fail())
893  {
894  //Throw errors, perhaps? Don't know if we can/should use exceptions...
895  std::cerr << "FAILED READING " << this << "!" << std::endl;
896  new_size = 0;
897  }
898  resize(new_size);
899  for (indexer i = 0; i < m_size - 1; ++i)
900  {
901  s >> m_array[i];
902  s >> std::ws;
903  }
904  s >> m_array[m_size - 1];
905  }
906  else
907  {
909  other.textual_input(s);
910  (*this) = other;
911  }
912  }
913 
914  template <class stream>
915  void binary_output(stream & s) const
916  {
918  {
919  s.write((char *) &m_size, sizeof(indexer));
920  for (indexer i = 0; i < m_size; ++i)
921  {
922  s.write((char *) (m_array + i), sizeof(T));
923  }
924  }
925  else
926  {
928  other.binary_output(s);
929  }
930  }
931 
932  template <class stream>
934  {
936  {
937  indexer new_size;
938  s.read((char *) &new_size, sizeof(indexer));
939  if (s.fail())
940  {
941  //Throw errors, perhaps? Don't know if we can/should use exceptions...
942  std::cerr << "FAILED READING " << this << "!" << std::endl;
943  new_size = 0;
944  }
945  resize(new_size);
946  for (indexer i = 0; i < m_size; ++i)
947  {
948  s.read((char *) (m_array + i), sizeof(T));
949  }
950  }
951  else
952  {
954  other.binary_input(s);
955  (*this) = other;
956  }
957  }
958 
959  };
960 
961  template <class T, class indexer, class Context>
962  class SimpleContainer<T, indexer, Context, false>
963  {
964  static_assert(std::is_trivially_copyable<T>::value, "SimpleContainer only works with a trivially copyable type.");
965  T * m_array;
966  indexer m_size;
967 
969 
970  template <class a, class b, class c, bool d> friend class SimpleContainer;
971 
972  public:
973 
974  CUDA_HOS_DEV inline indexer size() const
975  {
976  return m_size;
977  }
978 
979  CUDA_HOS_DEV inline T & operator[] (const indexer i)
980  {
981  return m_array[i];
982  }
983 
984  CUDA_HOS_DEV inline const T & operator[] (const indexer i) const
985  {
986  return m_array[i];
987  }
988 
989  // cppcheck-suppress uninitMemberVar
990  //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro...
991  CUDA_HOS_DEV SimpleContainer() : m_array(nullptr), m_size(0)
992  {
993  }
994 
998  // cppcheck-suppress uninitMemberVar
999  //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro...
1000  CUDA_HOS_DEV SimpleContainer(T * other_array, const indexer sz) : m_array(other_array), m_size(sz)
1001  {
1002  }
1003 
1004  template <class other_indexer, bool other_hold>
1005  // cppcheck-suppress uninitMemberVar
1006  //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro...
1008  {
1009  m_size = other.m_size;
1010  m_array = other.m_array;
1011  }
1012 
1013  // cppcheck-suppress operatorEqVarError
1014  //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro...
1016  {
1017  if (this == &other)
1018  {
1019  return (*this);
1020  }
1021  else
1022  {
1023  m_array = other.m_array;
1024  m_size = other.m_size;
1025  return (*this);
1026  }
1027  }
1028 
1029  template <class other_indexer, bool other_hold>
1030  // cppcheck-suppress operatorEqVarError
1031  //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro...
1033  {
1034  m_size = other.m_size;
1035  m_array = other.m_array;
1036  return (*this);
1037  }
1038 
1039  CUDA_HOS_DEV operator const T * () const
1040  {
1041  return m_array;
1042  }
1043 
1044  CUDA_HOS_DEV operator T * ()
1045  {
1046  return m_array;
1047  }
1048  };
1049 
1051  template <class T, class indexer = unsigned int>
1053 
1055  template <class T, class indexer = unsigned int>
1057 
1059  template <class T, class indexer = unsigned int>
1061 
1068  template <class T, class Context, bool hold_object = true>
1070 
1071  template <class T, class Context>
1072  class SimpleHolder<T, Context, true>
1073  {
1074  static_assert(std::is_trivially_copyable<T>::value, "SimpleHolder only works with a trivially copyable type.");
1075 
1076  using indexer = unsigned int;
1077 
1079 
1081 
1082  template <class a, class b, bool c> friend class SimpleHolder;
1083 
1084  public:
1085 
1086  CUDA_HOS_DEV const T & operator *() const
1087  {
1088  return *m_object;
1089  }
1090 
1092  {
1093  return *m_object;
1094  }
1095 
1096  CUDA_HOS_DEV const T * operator ->() const
1097  {
1098  return m_object;
1099  }
1100 
1101  CUDA_HOS_DEV T * operator ->()
1102  {
1103  return m_object;
1104  }
1105 
1106  CUDA_HOS_DEV inline bool valid() const
1107  {
1108  return m_object != nullptr;
1109  }
1110 
1111  inline void clear()
1112  {
1113  Manager::template deallocate<Context>(m_object);
1114  }
1115 
1116  inline void allocate()
1117  {
1118  if (m_object == nullptr)
1119  {
1120  m_object = Manager::template allocate<Context>(1);
1121  }
1122  }
1123 
1124  SimpleHolder(): m_object(nullptr)
1125  {
1126  }
1127 
1128  SimpleHolder(const bool really_allocate)
1129  {
1130  if (really_allocate)
1131  {
1132  m_object = Manager::template allocate<Context>(1);
1133  }
1134  else
1135  {
1136  m_object = nullptr;
1137  }
1138  }
1139 
1144  explicit SimpleHolder(X * other_p)
1145  {
1146  m_object = Manager::template allocate<Context>(1);
1147  Manager::template copy<Context, Context>(m_object, other_p, 1);
1148  }
1149 
1154  SimpleHolder(const X & other_v) : SimpleHolder(&other_v)
1155  {
1156 
1157 
1158  }
1159 
1161  {
1162  if (other.valid())
1163  {
1164  m_object = Manager::template allocate<Context>(1);
1165  Manager::template copy<Context, Context>(m_object, other.m_object, other.valid());
1166  }
1167  else
1168  {
1169  m_object = nullptr;
1170  }
1171  }
1172 
1173  template < class X, class other_context, bool other_hold,
1176  {
1177  if (other.valid())
1178  {
1179  m_object = Manager::template allocate<Context>(1);
1180  Manager::template copy<Context, other_context>(m_object, other.m_object, other.valid());
1181  }
1182  else
1183  {
1184  m_object = nullptr;
1185  }
1186  }
1187 
1189  {
1190  m_object = nullptr;
1191  Manager::template move<Context, Context>(m_object, other.m_object, other.valid());
1192  }
1193 
1194  template < class X, class other_context,
1197  {
1198  m_object = nullptr;
1199  Manager::template move<Context, other_context>(m_object, other.m_object, other.valid());
1200  }
1201 
1202  // cppcheck-suppress operatorEqVarError
1203  //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro...
1204  SimpleHolder & operator= (const SimpleHolder & other)
1205  {
1206  if (!valid() && other.valid())
1207  {
1208  allocate();
1209  }
1210  if (&other != this)
1211  {
1212  Manager::template copy<Context, Context>(m_object, other.m_object, other.valid());
1213  }
1214  return (*this);
1215  }
1216 
1217  template < class X, class other_context, bool other_hold,
1219  // cppcheck-suppress operatorEqVarError
1220  //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro...
1222  {
1223  if (!valid() && other.valid())
1224  {
1225  allocate();
1226  }
1227  Manager::template copy<Context, other_context>(m_object, other.m_object, other.valid());
1228  return (*this);
1229  }
1230 
1231  // cppcheck-suppress operatorEqVarError
1232  //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro...
1234  {
1235  if (&other != this)
1236  {
1237  clear();
1238  Manager::template move<Context, Context>(m_object, other.m_object, other.valid());
1239  }
1240  return (*this);
1241  }
1242 
1243  template < class X, class other_context,
1245  // cppcheck-suppress operatorEqVarError
1246  //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro...
1248  {
1249  clear();
1250  Manager::template move<Context, other_context>(m_object, other.m_object, other.valid());
1251  return (*this);
1252  }
1253 
1255  {
1256  Manager::template deallocate<Context>(m_object);
1257  }
1258 
1260  CUDA_HOS_DEV operator const X * () const
1261  {
1262  return m_object;
1263  }
1264 
1266  CUDA_HOS_DEV operator X * ()
1267  {
1268  return m_object;
1269  }
1270 
1271  template <class stream, class str = std::basic_string<typename stream::char_type> >
1272  void textual_output(stream & s, const str & separator = " ") const
1273  {
1275  {
1276  if (m_object == nullptr)
1277  {
1278  s << 0;
1279  }
1280  else
1281  {
1282  s << 1 << separator << (*m_object);
1283  }
1284  }
1285  else
1286  {
1288  other.textual_output(s, separator);
1289  }
1290  }
1291 
1292  template <class stream>
1294  {
1296  {
1297  bool is_valid;
1298  s >> is_valid >> std::ws;
1299  if (s.fail())
1300  {
1301  //Throw errors, perhaps? Don't know if we can/should use exceptions...
1302  std::cerr << "FAILED READING " << this << "!" << std::endl;
1303  is_valid = false;
1304  }
1305  if (is_valid)
1306  {
1307  allocate();
1308  s >> (*m_object);
1309  }
1310  else
1311  {
1312  clear();
1313  }
1314  }
1315  else
1316  {
1318  other.textual_input(s);
1319  (*this) = other;
1320  }
1321  }
1322 
1323  template <class stream>
1324  void binary_output(stream & s) const
1325  {
1326  if (m_object == nullptr)
1327  {
1328  return;
1329  }
1331  {
1332  s.write((char *) m_object, sizeof(T));
1333  }
1334  else
1335  {
1337  other.binary_output(s);
1338  }
1339  }
1340 
1341  template <class stream>
1343  {
1345  {
1346  allocate();
1347  s.read((char *) m_object, sizeof(T));
1348  }
1349  else
1350  {
1352  other.binary_input(s);
1353  (*this) = other;
1354  }
1355  }
1356 
1357  };
1358 
1359  template <class T, class Context>
1360  class SimpleHolder<T, Context, false>
1361  {
1362  static_assert(std::is_trivially_copyable<T>::value, "SimpleHolder only works with a trivially copyable type.");
1363 
1364  using indexer = unsigned int;
1365 
1367 
1369 
1370  template <class a, class b, bool c> friend class SimpleHolder;
1371 
1372  public:
1373 
1374  CUDA_HOS_DEV const T & operator *() const
1375  {
1376  return *m_object;
1377  }
1378 
1380  {
1381  return *m_object;
1382  }
1383 
1384  CUDA_HOS_DEV const T * operator ->() const
1385  {
1386  return m_object;
1387  }
1388 
1389  CUDA_HOS_DEV T * operator ->()
1390  {
1391  return m_object;
1392  }
1393 
1394  CUDA_HOS_DEV inline bool valid() const
1395  {
1396  return m_object != nullptr;
1397  }
1398 
1399  // cppcheck-suppress uninitMemberVar
1400  //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro...
1401  CUDA_HOS_DEV SimpleHolder() : m_object(nullptr)
1402  {
1403  }
1404 
1409  // cppcheck-suppress uninitMemberVar
1410  //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro...
1412  {
1413  m_object = other_p;
1414  }
1415 
1416  template < class X, bool other_hold,
1418  // cppcheck-suppress uninitMemberVar
1419  //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro...
1421  {
1422  m_object = other.m_object;
1423  }
1424 
1425  template < class X, bool other_hold,
1427  // cppcheck-suppress operatorEqVarError
1428  //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro...
1430  {
1431  m_object = other.m_object;
1432  return (*this);
1433  }
1434 
1436  CUDA_HOS_DEV operator const X * () const
1437  {
1438  return m_object;
1439  }
1440 
1442  CUDA_HOS_DEV operator X * ()
1443  {
1444  return m_object;
1445  }
1446  };
1447 
1449  template <class T>
1451 
1453  template <class T>
1455 
1457  template <class T>
1459 
1461  template <class T>
1463 
1473  template <class T>
1475  {
1476  private:
1477  std::vector< std::unique_ptr<T> > m_held;
1478  std::vector< typename std::thread::id > m_thread_equivs;
1479  //For a sufficiently small number of threads
1480  //(not much more than 100 or so?)
1481  //it's faster to have linear search+insert
1482  //than any other addressing mode
1483  //(e. g. unordered_map)
1484  //We could still consider a more sophisticated solution...
1485 
1486  //Simple alternative: some sort of stack for non-assigned objects,
1487  //pushing and popping instead of linear searching.
1488  //(But with constant memory -> no (de)allocations.)
1489 
1491 
1492  public:
1493  T & get_one()
1494  {
1495  std::lock_guard<std::mutex> lock_guard(m_mutex);
1496  std::thread::id this_id = std::this_thread::get_id();
1497  const std::thread::id invalid_id{};
1498  for (size_t i = 0; i < m_thread_equivs.size(); ++i)
1499  {
1500  if (m_thread_equivs[i] == invalid_id)
1501  {
1502  m_thread_equivs[i] = this_id;
1503  return *(m_held[i]);
1504  }
1505  }
1506  m_held.emplace_back(std::make_unique<T>());
1507  m_thread_equivs.emplace_back(this_id);
1508  return *(m_held.back());
1509  }
1510 
1512  T & get_for_thread() const
1513  {
1514  std::thread::id this_id = std::this_thread::get_id();
1515  for (size_t i = 0; i < m_thread_equivs.size(); ++i)
1516  {
1517  if (m_thread_equivs[i] == this_id)
1518  {
1519  return *(m_held[i]);
1520  }
1521  }
1522  //Here would be a good place for an unreachable.
1523  //C++23?
1524  return *(m_held.back());
1525  }
1526 
1528  {
1529  std::lock_guard<std::mutex> lock_guard(m_mutex);
1530  std::thread::id this_id = std::this_thread::get_id();
1531  const std::thread::id invalid_id{};
1532  for (size_t i = 0; i < m_thread_equivs.size(); ++i)
1533  {
1534  if (m_thread_equivs[i] == this_id)
1535  {
1536  m_thread_equivs[i] = invalid_id;
1537  }
1538  }
1539  }
1540 
1541  void resize(const size_t new_size)
1542  {
1543  std::lock_guard<std::mutex> lock_guard(m_mutex);
1544  if (new_size < m_held.size())
1545  {
1546  m_held.resize(new_size);
1547  m_thread_equivs.resize(new_size);
1548  }
1549  else if (new_size > m_held.size())
1550  {
1551  const size_t to_add = new_size - m_held.size();
1552  const std::thread::id invalid_id{};
1553  for (size_t i = 0; i < to_add; ++i)
1554  {
1555  m_held.emplace_back(std::make_unique<T>());
1556  m_thread_equivs.emplace_back(invalid_id);
1557  }
1558  }
1559  }
1560 
1561  template <class F, class ... Args>
1562  void operate_on_all(F && f, Args && ... args)
1563  {
1564  std::lock_guard<std::mutex> lock_guard(m_mutex);
1565  for (std::unique_ptr<T> & obj : m_held)
1566  {
1567  f(*obj, std::forward<Args>(args)...);
1568  }
1569  }
1570 
1571  size_t held_size() const
1572  {
1573  return m_held.size();
1574  }
1575 
1576  size_t available_size() const
1577  {
1578  size_t count = 0;
1579  const std::thread::id invalid_id{};
1580  for (const auto & id : m_thread_equivs)
1581  {
1582  if (id == invalid_id)
1583  {
1584  ++count;
1585  }
1586  }
1587  return count;
1588  }
1589 
1590  size_t filled_size() const
1591  {
1592  return this->held_size() - this->available_size();
1593  }
1594  };
1595 
1598  template <class T>
1600  {
1601  private:
1603  T * m_held;
1604  public:
1606  m_sth(s), m_held(nullptr)
1607  {
1608  }
1609  T & get_one()
1610  {
1611  if (m_held == nullptr)
1612  {
1613  m_held = &(m_sth.get_one());
1614  }
1615  return *m_held;
1616  }
1618  {
1619  if (m_held != nullptr)
1620  {
1621  m_sth.release_one();
1622  m_held = nullptr;
1623  }
1624  }
1626  {
1627  if (m_held != nullptr)
1628  {
1629  m_sth.release_one();
1630  }
1631  }
1634  {
1635  get_one();
1636  ptr = m_held;
1637  }
1638  };
1639 
1644  template <class T>
1646  {
1647  private:
1648 
1649  alignas(T) char m_buf[sizeof(T)];
1650  T * m_object = nullptr;
1651 
1652  public:
1653 
1654  maybe_allocate(const bool allocate, const T & t)
1655  {
1656  if (allocate)
1657  {
1658  m_object = new (m_buf) T(t);
1659  }
1660  }
1661 
1662  maybe_allocate(const bool allocate, T && t)
1663  {
1664  if (allocate)
1665  {
1666  m_object = new (m_buf) T(t);
1667  }
1668  }
1669 
1670  template <class ... Args>
1671  maybe_allocate(const bool allocate, Args && ... args)
1672  {
1673  if (allocate)
1674  {
1675  m_object = new (m_buf) T(std::forward<Args>(args)...);
1676  }
1677  }
1678 
1680  {
1681  }
1682 
1683 
1685  {
1686  }
1687 
1689  {
1690  if (&other != this)
1691  {
1692  if (m_object != nullptr)
1693  {
1694  (*m_object) = other.get();
1695  }
1696  else
1697  {
1698  m_object = new (m_buf) T(other.get());
1699  }
1700  }
1701  return (*this);
1702  }
1703 
1704 
1706  {
1707  if (&other != this)
1708  {
1709  if (m_object != nullptr)
1710  {
1711  (*m_object) = other.get();
1712  }
1713  else
1714  {
1715  m_object = new (m_buf) T(other.get());
1716  }
1717  }
1718  return (*this);
1719  }
1720 
1722  {
1723  if (m_object != nullptr)
1724  {
1725  m_object->~T();
1726  }
1727  }
1728 
1729  bool valid() const
1730  {
1731  return m_object != nullptr;
1732  }
1733 
1734  T && get() &&
1735  {
1736  return *m_object;
1737  }
1738 
1739  T & get() &
1740  {
1741  return *m_object;
1742  }
1743 
1744  const T & get() const &
1745  {
1746  return *m_object;
1747  }
1748 
1749  const T * operator ->() const
1750  {
1751  return m_object;
1752  }
1753 
1755  {
1756  return m_object;
1757  }
1758 
1759  operator T & ()
1760  {
1761  return *m_object;
1762  }
1763 
1764  operator T && () &&
1765  {
1766  return *m_object;
1767  }
1768 
1769  operator const T & () const
1770  {
1771  return *m_object;
1772  }
1773  };
1774  }
1775 
1776 }
1777 
1778 #endif // CALORECGPU_HELPERS_H
CaloRecGPU::Helpers::maybe_allocate::maybe_allocate
maybe_allocate(maybe_allocate &&other)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1684
CaloRecGPU::CUDA_Helpers::CPU_to_GPU_async
void CPU_to_GPU_async(void *dest, const void *const source, const size_t num, CUDAStreamPtrHolder stream={})
Copies num bytes from source in CPU memory to dest in GPU memory, asynchronously.
temp
Definition: JetEventDict.h:21
CaloRecGPU::Helpers::maybe_allocate::maybe_allocate
maybe_allocate(const bool allocate, T &&t)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1662
CaloRecGPU::Helpers::maybe_allocate::operator=
maybe_allocate & operator=(const maybe_allocate &other)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1688
CaloRecGPU::Helpers::MemoryManagement
! Handles allocation of a type T, using indexer as the integer type to indicate sizes.
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:476
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
CaloRecGPU::CUDA_Helpers::optimize_block_and_grid_size
void optimize_block_and_grid_size(void *func, int &block_size, int &grid_size, const int dynamic_memory=0, const int block_size_limit=0)
Optimizes block and grid size according to cudaOccupancyMaxPotentialBlockSize.
CaloRecGPU::CUDA_Helpers::supports_cooperative_launches
bool supports_cooperative_launches()
CaloRecGPU::Helpers::MemoryManagement::copy_helper< MemoryContext::CUDAGPU, MemoryContext::CPU, dummy >::copy
static void copy(T *dest, const T *const source, const indexer sz)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:549
CaloRecGPU::Helpers::MemoryManagement::copy_helper< MemoryContext::CPU, MemoryContext::CUDAPinnedCPU, dummy >::copy
static void copy(T *dest, const T *const source, const indexer sz)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:565
checkFileSG.line
line
Definition: checkFileSG.py:75
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::SimpleHolder
SimpleHolder(SimpleHolder &&other)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1188
CaloRecGPU::CUDA_Helpers::GPU_to_CPU_async
void GPU_to_CPU_async(void *dest, const void *const source, const size_t num, CUDAStreamPtrHolder stream={})
Copies num bytes from source in GPU memory to dest in CPU memory, asynchronously.
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::SimpleContainer
SimpleContainer(const SimpleContainer< T, other_indexer, other_context, other_hold > &other)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:785
xAOD::short
short
Definition: Vertex_v1.cxx:165
fitman.sz
sz
Definition: fitman.py:527
CaloRecGPU::Helpers::MemoryManagement::move_helper
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:596
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
CaloRecGPU::Helpers::MemoryManagement::unary_helper< MemoryContext::CUDAPinnedCPU, dummy >::allocate
static T * allocate(const indexer size)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:510
CaloRecGPU::Helpers::Constants::pi
constexpr T pi
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:315
CaloRecGPU::Helpers::MemoryManagement::unary_helper
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:478
CaloRecGPU::CUDA_Helpers::optimize_block_and_grid_size_for_cooperative_launch
void optimize_block_and_grid_size_for_cooperative_launch(void *func, int &block_size, int &grid_size, const int dynamic_memory=0, const int block_size_limit=0)
Optimizes block and grid size for a cooperative launch.
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CaloRecGPU::Helpers::MemoryManagement::deallocate
static void deallocate(T *&arr)
!
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:633
CaloRecGPU::CUDA_Helpers::CPU_to_GPU
void CPU_to_GPU(void *dest, const void *const source, const size_t num)
Copies num bytes from source in CPU memory to dest in GPU memory.
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::valid
CUDA_HOS_DEV bool valid() const
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1106
CaloRecGPU::Helpers::maybe_allocate::maybe_allocate
maybe_allocate(const maybe_allocate &other)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1679
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::binary_output
void binary_output(stream &s) const
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1324
CaloRecGPU::Helpers::separate_thread_holder::resize
void resize(const size_t new_size)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1541
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::textual_output
void textual_output(stream &s, const str &separator=" ") const
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:867
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::SimpleHolder
SimpleHolder(const bool really_allocate)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1128
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::~SimpleContainer
~SimpleContainer()
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:850
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::clear
void clear()
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1111
xAOD::char
char
Definition: TrigDecision_v1.cxx:38
CaloRecGPU::Helpers::MemoryManagement::allocate
static T * allocate(const indexer size)
!
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:619
DMTest::C
C_v1 C
Definition: C.h:26
CaloRecGPU::Helpers::SimpleHolder
Holds one objects of type \T in memory context Context.
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1069
CaloRecGPU::Helpers::Pearson_hash_16_bit
constexpr unsigned short Pearson_hash_16_bit(const T number)
Calculates a 16-bit Pearson hash from @ number.
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:280
CaloRecGPU::Helpers::MemoryManagement::unary_helper< MemoryContext::CUDAGPU, dummy >::allocate
static T * allocate(const indexer size)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:496
CaloRecGPU::Helpers::int_ceil_div
constexpr int int_ceil_div(const int num, const int denom)
Returns the ceiling of num/denom, with proper rounding.
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:213
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::allocate
void allocate()
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1116
CaloRecGPU::Helpers::separate_thread_accessor::separate_thread_accessor
separate_thread_accessor(separate_thread_holder< T > &s)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1605
taskman.template
dictionary template
Definition: taskman.py:317
CaloRecGPU::Helpers::SimpleHolder< T, Context, false >::valid
CUDA_HOS_DEV bool valid() const
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1394
CaloRecGPU::CUDA_Helpers::GPU_synchronize
void GPU_synchronize(CUDAStreamPtrHolder stream={})
Synchronizes the stream.
CaloRecGPU::CUDA_Helpers::deallocate_pinned
void deallocate_pinned(void *address)
Deallocates address in CPU pinned memory.
CaloRecGPU::Helpers::SimpleHolder< T, Context, false >::indexer
unsigned int indexer
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1364
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::SimpleHolder
SimpleHolder(const X &other_v)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1154
CaloRecGPU::Helpers::separate_thread_holder::m_held
std::vector< std::unique_ptr< T > > m_held
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1477
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::SimpleContainer
SimpleContainer(SimpleContainer &&other)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:776
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
CaloRecGPU::Helpers::maybe_allocate::operator->
const T * operator->() const
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1749
CaloRecGPU::Helpers::separate_thread_holder::operate_on_all
void operate_on_all(F &&f, Args &&... args)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1562
CaloRecGPU::Helpers::MemoryContext::CUDAGPU
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:464
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, false >::SimpleContainer
CUDA_HOS_DEV SimpleContainer(T *other_array, const indexer sz)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1000
athena.value
value
Definition: athena.py:122
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::textual_input
void textual_input(stream &s)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:886
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::SimpleContainer
SimpleContainer(SimpleContainer< T, other_indexer, other_context, true > &&other)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:793
perfmonmt-printer.dest
dest
Definition: perfmonmt-printer.py:189
CaloRecGPU::Helpers::MemoryManagement::unary_helper< MemoryContext::CPU, dummy >::deallocate
static void deallocate(T *&arr)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:487
CaloRecGPU::Helpers::MemoryManagement::unary_helper< MemoryContext::CUDAPinnedCPU, dummy >::deallocate
static void deallocate(T *&arr)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:515
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
CaloRecGPU::Helpers::MemoryManagement::unary_helper< MemoryContext::CPU, dummy >::allocate
static T * allocate(const indexer size)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:482
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
CaloRecGPU::Helpers::MemoryManagement::unary_helper< MemoryContext::CUDAGPU, dummy >::deallocate
static void deallocate(T *&arr)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:501
Args
Definition: test_lwtnn_fastgraph.cxx:12
fitman.rho2
rho2
Definition: fitman.py:544
CaloRecGPU::Helpers::maybe_allocate::maybe_allocate
maybe_allocate(const bool allocate, Args &&... args)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1671
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::SimpleHolder
SimpleHolder()
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1124
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::SimpleContainer
SimpleContainer(const indexer sz)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:753
x
#define x
CaloRecGPU::Helpers::MemoryManagement::copy_helper< MemoryContext::CUDAGPU, MemoryContext::CUDAGPU, dummy >::copy
static void copy(T *dest, const T *const source, const indexer sz)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:541
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::SimpleHolder
SimpleHolder(SimpleHolder< X, other_context, true > &&other)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1196
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::indexer
unsigned int indexer
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1076
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::binary_input
void binary_input(stream &s)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:933
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::binary_output
void binary_output(stream &s) const
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:915
CaloRecGPU::Helpers::int_floor_div
constexpr int int_floor_div(const int num, const int denom)
Returns the floor of num/denom, with proper rounding.
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:219
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
CaloRecGPU::Helpers::MemoryContext::CUDAPinnedCPU
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:468
CaloRecGPU::CUDA_Helpers::deallocate
void deallocate(void *address)
Deallocates address in GPU memory.
CaloRecGPU::Helpers::MemoryManagement::move_helper< C, C, dummy >::move
static void move(T *&dest, T *&source, const indexer)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:610
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::textual_input
void textual_input(stream &s)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1293
CaloRecGPU::Helpers::Pearson_hash
constexpr unsigned char Pearson_hash(const T number)
Calculates a Pearson hash from @ number.
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:253
CaloRecGPU::Helpers::MemoryContext::CUDAGPU::name
constexpr static char const * name
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:465
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
calibdata.valid
list valid
Definition: calibdata.py:45
CaloRecGPU::Helpers::separate_thread_holder::filled_size
size_t filled_size() const
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1590
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::SimpleHolder
SimpleHolder(X *other_p)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1144
InDetDD::operator*
SiLocalPosition operator*(const SiLocalPosition &position, const double factor)
Definition: SiLocalPosition.cxx:98
CaloRecGPU::Helpers::MemoryManagement::copy_helper< MemoryContext::CPU, MemoryContext::CUDAGPU, dummy >::copy
static void copy(T *dest, const T *const source, const indexer sz)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:533
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::SimpleContainer
SimpleContainer()
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:749
CUDA_HOS_DEV
#define CUDA_HOS_DEV
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:100
CaloRecGPU::CUDA_Helpers::GPU_name
std::string GPU_name()
CaloRecGPU::Helpers::MemoryContext::CUDAPinnedCPU::name
constexpr static char const * name
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:469
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::size
CUDA_HOS_DEV indexer size() const
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:712
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::textual_output
void textual_output(stream &s, const str &separator=" ") const
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1272
lumiFormat.i
int i
Definition: lumiFormat.py:92
z
#define z
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::~SimpleHolder
~SimpleHolder()
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1254
ret
T ret(T t)
Definition: rootspy.cxx:260
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::binary_input
void binary_input(stream &s)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1342
CaloRecGPU::Helpers::separate_thread_holder::m_thread_equivs
std::vector< typename std::thread::id > m_thread_equivs
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1478
Base
CaloRecGPU::CUDA_Helpers::GPU_to_GPU
void GPU_to_GPU(void *dest, const void *const source, const size_t num)
Copies num bytes from source to dest, both in GPU memory.
CaloRecGPU::Helpers::MemoryContext::CPU::name
constexpr static char const * name
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:461
file
TFile * file
Definition: tile_monitor.h:29
CaloRecGPU::CUDA_Helpers::GPU_to_CPU
void GPU_to_CPU(void *dest, const void *const source, const size_t num)
Copies num bytse from source in GPU memory to dest in CPU memory.
CaloRecGPU::Helpers::maybe_allocate::valid
bool valid() const
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1729
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::clear
void clear()
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:727
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::SimpleHolder
SimpleHolder(const SimpleHolder< X, other_context, other_hold > &other)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1175
python.xAODType.dummy
dummy
Definition: xAODType.py:4
CaloRecGPU::CUDA_Helpers::supports_dynamic_parallelism
bool supports_dynamic_parallelism()
CaloRecGPU::Helpers::SimpleHolder< T, Context, false >::SimpleHolder
CUDA_HOS_DEV SimpleHolder()
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1401
CaloRecGPU::Helpers::separate_thread_holder::get_one
T & get_one()
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1493
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::m_object
T * m_object
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1078
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, false >::SimpleContainer
CUDA_HOS_DEV SimpleContainer(const SimpleContainer< T, other_indexer, Context, other_hold > &other)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1007
CaloRecGPU::Helpers::MemoryManagement::copy_helper< MemoryContext::CUDAPinnedCPU, MemoryContext::CUDAPinnedCPU, dummy >::copy
static void copy(T *dest, const T *const source, const indexer sz)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:573
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::m_array
T * m_array
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:702
CaloRecGPU::Helpers::SimpleHolder< T, Context, false >::m_object
T * m_object
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1366
CaloRecGPU::Helpers::SimpleContainer
Holds a run-time amount of objects of type \T, measuring sizes with indexer, in memory context Contex...
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:697
calibdata.exit
exit
Definition: calibdata.py:236
compute_lumi.denom
denom
Definition: compute_lumi.py:76
CaloRecGPU::Helpers::MemoryManagement::copy_helper< MemoryContext::CPU, MemoryContext::CPU, dummy >::copy
static void copy(T *dest, const T *const source, const indexer sz)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:525
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::SimpleContainer
SimpleContainer(T *other_array, const indexer sz)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:762
CaloRecGPU::Helpers::MemoryContext::CPU
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:460
CaloRecGPU::Helpers::MemoryManagement::copy_helper< MemoryContext::CUDAPinnedCPU, MemoryContext::CUDAGPU, dummy >::copy
static void copy(T *dest, const T *const source, const indexer sz)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:581
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, false >::size
CUDA_HOS_DEV indexer size() const
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:974
CaloRecGPU::CUDA_Helpers::allocate
void * allocate(const size_t num)
Allocates and returns the address of num bytes from GPU memory.
CaloRecGPU::Helpers::maybe_allocate::m_object
T * m_object
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1650
CaloRecGPU::CUDA_Helpers::allocate_pinned
void * allocate_pinned(const size_t num)
Allocates and returns the address of num bytes from CPU pinned memory.
CaloRecGPU::Helpers::Constants::sqrt2
constexpr T sqrt2
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:318
pmontree.code
code
Definition: pmontree.py:443
CaloRecGPU::Helpers::MemoryManagement::copy_helper< MemoryContext::CUDAPinnedCPU, MemoryContext::CPU, dummy >::copy
static void copy(T *dest, const T *const source, const indexer sz)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:557
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:191
python.selection.number
number
Definition: selection.py:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
CaloRecGPU::Helpers::separate_thread_holder
Manages objects of type T in a thread-safe way, ensuring that there's an object available for each se...
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1475
CaloRecGPU::Helpers::separate_thread_holder::get_for_thread
T & get_for_thread() const
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1512
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, false >::m_array
T * m_array
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:964
CaloRecGPU::Helpers::maybe_allocate::get
const T & get() const &
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1744
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, false >::SimpleContainer
CUDA_HOS_DEV SimpleContainer()
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:991
CaloRecGPU::Helpers::MemoryManagement::move
static void move(T *&dest, T *&source, const indexer sz)
!
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:669
CaloRecGPU::Helpers::separate_thread_accessor::separate_thread_accessor
separate_thread_accessor(separate_thread_holder< T > &s, T *&ptr)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1632
CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:109
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::m_size
indexer m_size
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:704
RTTAlgmain.address
address
Definition: RTTAlgmain.py:55
CaloRecGPU::CUDA_Helpers::GPU_to_GPU_async
void GPU_to_GPU_async(void *dest, const void *const source, const size_t num, CUDAStreamPtrHolder stream={})
Copies num bytes from source to dest, both in GPU memory, asynchronously.
CaloRecGPU::Helpers::SimpleHolder< T, Context, false >::SimpleHolder
CUDA_HOS_DEV SimpleHolder(const SimpleHolder< X, Context, other_hold > &other)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1420
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::SimpleContainer
SimpleContainer(const SimpleContainer &other)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:769
CaloRecGPU::Helpers::SimpleHolder< T, Context, true >::SimpleHolder
SimpleHolder(const SimpleHolder &other)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1160
CaloRecGPU::Helpers::MemoryManagement::copy
static void copy(T *dest, const T *const source, const indexer sz)
!
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:651
CaloRecGPU::Helpers::maybe_allocate::maybe_allocate
maybe_allocate(const bool allocate, const T &t)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1654
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
CaloRecGPU::Helpers::maybe_allocate
Possibly holds an object in its internal buffer.
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1646
a
TList * a
Definition: liststreamerinfos.cxx:10
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
VKalVrtAthena::varHolder_detail::clear
void clear(T &var)
Definition: NtupleVars.h:48
y
#define y
CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder::CUDAStreamPtrHolder
CUDAStreamPtrHolder()=default
CaloRecGPU::Helpers::separate_thread_holder::release_one
void release_one()
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1527
CaloRecGPU::Helpers::maybe_allocate::m_buf
char m_buf[sizeof(T)]
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1649
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
F
#define F(x, y, z)
Definition: MD5.cxx:112
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, false >::m_size
indexer m_size
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:966
python.CaloCondTools.log
log
Definition: CaloCondTools.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
CaloRecGPU::Helpers::separate_thread_holder::m_mutex
std::mutex m_mutex
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1490
CaloRecGPU::Helpers::compile_time_pow2
constexpr Base compile_time_pow2(const Exp exp)
Returns 2 to the power of exp.
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:226
CaloRecGPU::Helpers::MemoryManagement::copy_helper
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:521
CaloRecGPU::Helpers::MemoryManagement::copy_helper< MemoryContext::CUDAGPU, MemoryContext::CUDAPinnedCPU, dummy >::copy
static void copy(T *dest, const T *const source, const indexer sz)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:589
CaloRecGPU::Helpers::separate_thread_accessor::release_one
void release_one()
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1617
str
Definition: BTagTrackIpAccessor.cxx:11
calibdata.copy
bool copy
Definition: calibdata.py:27
CaloRecGPU::Helpers::MemoryManagement::move_helper::move
static void move(T *&dest, T *&source, const indexer sz)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:600
CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder::CUDAStreamPtrHolder
CUDAStreamPtrHolder(T *p)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:124
CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder::ptr
void * ptr
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:110
CaloRecGPU::Helpers::Constants::inv_sqrt2
constexpr T inv_sqrt2
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:322
CaloRecGPU::Helpers::separate_thread_accessor::m_held
T * m_held
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1603
python.PyAthena.obj
obj
Definition: PyAthena.py:135
CaloRecGPU
Definition: BaseDefinitions.h:11
CaloRecGPU::Helpers::separate_thread_holder::available_size
size_t available_size() const
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1576
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
CaloRecGPU::Helpers::separate_thread_accessor::m_sth
separate_thread_holder< T > & m_sth
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1602
python.CaloScaleNoiseConfig.args
args
Definition: CaloScaleNoiseConfig.py:80
CaloRecGPU::Helpers::separate_thread_accessor::get_one
T & get_one()
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1609
CaloRecGPU::Helpers::separate_thread_accessor::~separate_thread_accessor
~separate_thread_accessor()
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1625
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
CaloRecGPU::Helpers::SimpleHolder< T, Context, false >::SimpleHolder
CUDA_HOS_DEV SimpleHolder(X *other_p)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1411
CaloRecGPU::Helpers::maybe_allocate::get
T && get() &&
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1734
CaloRecGPU::Helpers::separate_thread_accessor
!
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1600
CaloRecGPU::Helpers::maybe_allocate::~maybe_allocate
~maybe_allocate()
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1721
CaloRecGPU::Helpers::SimpleContainer< T, indexer, Context, true >::resize
void resize(const indexer new_size)
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:733
CaloRecGPU::Helpers::separate_thread_holder::held_size
size_t held_size() const
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1571
CaloRecGPU::Helpers::maybe_allocate::get
T & get() &
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:1739