Project
Loading...
Searching...
No Matches
Definitions.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
14
15#ifndef TRACKINGITS_DEFINITIONS_H_
16#define TRACKINGITS_DEFINITIONS_H_
17
18// #define CA_DEBUG
19// #define VTX_DEBUG
20#define __USE_GPU_TRACER__
21
22template <typename T>
23void discardResult(const T&)
24{
25}
26
27#ifndef GPUCA_GPUCODE_DEVICE
28#include <array>
29#endif
30
31#ifdef CA_DEBUG
32#define CA_DEBUGGER(x) x
33#else
34#define CA_DEBUGGER(x) \
35 do { \
36 } while (0)
37#endif
38
39#if defined(__CUDA_ARCH__) // ????
40#define TRACKINGITSU_GPU_DEVICE
41#endif
42
43#if defined(__CUDACC__) || defined(__HIPCC__)
44#define MATH_CEIL ceil
45
46#ifndef GPUCA_GPUCODE_DEVICE
47#include <cstddef>
48#endif
49#include "../GPU/ITStrackingGPU/Array.h"
50
51template <typename T, size_t Size>
53
54#ifdef __CUDACC__
55#define GPU_ARCH "CUDA"
56
57typedef cudaStream_t GPUStream;
58inline int getGPUCores(const int major, const int minor)
59{
60 // Defines for GPU Architecture types (using the SM version to determine the # of cores per SM
61 typedef struct
62 {
63 int SM; // 0xMm (hexidecimal notation), M = SM Major version, and m = SM minor version
64 int Cores;
65 } sSMtoCores;
66
67 sSMtoCores nGpuArchCoresPerSM[] =
68 {
69 {0x20, 32}, // Fermi Generation (SM 2.0) GF100 class
70 {0x21, 48}, // Fermi Generation (SM 2.1) GF10x class
71 {0x30, 192}, // Kepler Generation (SM 3.0) GK10x class
72 {0x32, 192}, // Kepler Generation (SM 3.2) GK10x class
73 {0x35, 192}, // Kepler Generation (SM 3.5) GK11x class
74 {0x37, 192}, // Kepler Generation (SM 3.7) GK21x class
75 {0x50, 128}, // Maxwell Generation (SM 5.0) GM10x class
76 {0x52, 128}, // Maxwell Generation (SM 5.2) GM20x class
77 {0x53, 128}, // Maxwell Generation (SM 5.3) GM20x class
78 {0x60, 64}, // Pascal Generation (SM 6.0) GP100 class
79 {0x61, 128}, // Pascal Generation (SM 6.1) GP10x class
80 {0x62, 128}, // Pascal Generation (SM 6.2) GP10x class
81 {0x70, 64}, // Volta Generation (SM 7.0) GV100 class
82 {0x72, 64}, // Volta Generation (SM 7.2) GV10B class
83 {0x75, 64}, // Turing Generation (SM 7.5) TU1xx class
84 {-1, -1}};
85
86 int index = 0;
87
88 while (nGpuArchCoresPerSM[index].SM != -1) {
89 if (nGpuArchCoresPerSM[index].SM == ((major << 4) + minor)) {
90 return nGpuArchCoresPerSM[index].Cores;
91 }
92
93 index++;
94 }
95
96 // If we don't find the values, we default use the previous one to run properly
97 return nGpuArchCoresPerSM[index - 1].Cores;
98}
99inline int getGPUMaxThreadsPerComputingUnit()
100{
101 return 8;
102}
103
104#else // __HIPCC__
105#define GPU_ARCH "HIP"
106typedef hipStream_t GPUStream;
107inline int getGPUCores(const int major, const int minor)
108{
109 // Hardcoded result for AMD RADEON WX 9100, to be decided if and how determine this paramter
110 return 4096;
111}
112
113inline int getGPUMaxThreadsPerComputingUnit()
114{
115 return 8;
116}
117#endif
118
119#else
120#define MATH_CEIL std::ceil
121#ifndef __VECTOR_TYPES_H__
122#include "GPUCommonDef.h"
123#endif
124#ifndef __OPENCL__
125#include <cstddef>
126template <typename T, size_t Size>
127using GPUArray = std::array<T, Size>;
128#else
129#include "../GPU/ITStrackingGPU/Array.h"
130template <typename T, size_t Size>
132#endif
133
134typedef struct _dummyStream {
136#endif
137
138#endif
struct _dummyStream GPUStream
std::array< T, Size > GPUArray
void discardResult(const T &)
Definition Definitions.h:23
uint32_t minor
Definition RawData.h:6
uint32_t major
Definition RawData.h:7
GLuint index
Definition glcorearb.h:781