forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGPUDefMacros.h
More file actions
56 lines (45 loc) · 2.22 KB
/
GPUDefMacros.h
File metadata and controls
56 lines (45 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file GPUDefMacros.h
/// \author David Rohr
// clang-format off
#ifndef GPUDEFMACROS_H
#define GPUDEFMACROS_H
#define GPUCA_M_EXPAND(x) x
#define GPUCA_M_STRIP_A(...) __VA_ARGS__
#define GPUCA_M_STRIP(X) GPUCA_M_STRIP_A X
#define GPUCA_M_STR_X(a) #a
#define GPUCA_M_STR(a) GPUCA_M_STR_X(a)
#define GPUCA_M_CAT_A(a, b) a ## b
#define GPUCA_M_CAT(...) GPUCA_M_CAT_A(__VA_ARGS__)
#define GPUCA_M_CAT3_A(a, b, c) a ## b ## c
#define GPUCA_M_CAT3(...) GPUCA_M_CAT3_A(__VA_ARGS__)
#define GPUCA_M_FIRST_A(a, ...) a
#define GPUCA_M_FIRST(...) GPUCA_M_FIRST_A(__VA_ARGS__)
#define GPUCA_M_SHIFT_A(a, ...) __VA_ARGS__
#define GPUCA_M_SHIFT(...) GPUCA_M_SHIFT_A(__VA_ARGS__)
#define GPUCA_M_FIRST2_A(a, b, ...) a, b
#define GPUCA_M_FIRST2(...) GPUCA_M_FIRST2_A(__VA_ARGS__, 0)
#define GPUCA_M_STRIP_FIRST(a) GPUCA_M_FIRST(GPUCA_M_STRIP(a))
#define GPUCA_M_COUNT_A(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, N, ...) N
#define GPUCA_M_COUNT3_A(_1, _2, _3, N, ...) N
#define GPUCA_M_COUNT(...) GPUCA_M_COUNT_A(__VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
#define GPUCA_M_SINGLEOPT(...) GPUCA_M_COUNT_A(__VA_ARGS__, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1)
#define GPUCA_M_MAX2_3(...) GPUCA_M_COUNT3_A(__VA_ARGS__, GPUCA_M_FIRST2(__VA_ARGS__), GPUCA_M_FIRST2(__VA_ARGS__), GPUCA_M_FIRST(__VA_ARGS__), )
#define GPUCA_M_MAX1_3(...) GPUCA_M_COUNT3_A(__VA_ARGS__, GPUCA_M_FIRST(__VA_ARGS__), GPUCA_M_FIRST(__VA_ARGS__), GPUCA_M_FIRST(__VA_ARGS__), )
#define GPUCA_M_UNROLL_
#define GPUCA_M_UNROLL_U(...) _Pragma(GPUCA_M_STR(unroll __VA_ARGS__))
#ifndef GPUCA_UNROLL
#define GPUCA_UNROLL(...)
#endif
#define GPUCA_CEIL_INT_DIV(a, b) (((a) + (b) - 1) / (b))
#endif
// clang-format on