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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
|
// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
#define FILENAME(line) \
FILENAME_FOR_EXCEPTIONS_CUDA("src/cuda-kernels/awkward_reduce_sum_bool.cu", \
line)
#include "standard_parallel_algorithms.h"
#include "awkward/kernels.h"
template <typename IN>
__global__ void
awkward_reduce_sum_bool_kernel(bool* toptr,
const IN* fromptr,
const int64_t* parents,
int64_t lenparents) {
int64_t thread_id = blockIdx.x * blockDim.x + threadIdx.x;
if (thread_id < lenparents) {
toptr[parents[thread_id]] |= (fromptr[thread_id] != 0);
}
}
__global__ void
awkward_reduce_prod_sum_initialize_toptr(bool* toptr, int64_t outlength) {
int64_t thread_id = blockIdx.x * blockDim.x + threadIdx.x;
if (thread_id < outlength) {
toptr[thread_id] = false;
}
}
template <typename IN>
ERROR
awkward_reduce_sum_bool(bool* toptr,
const IN* fromptr,
const int64_t* parents,
int64_t lenparents,
int64_t outlength) {
dim3 blocks_per_grid = blocks(outlength);
dim3 threads_per_block = threads(outlength);
awkward_reduce_prod_sum_initialize_toptr<<<blocks_per_grid,
threads_per_block>>>(toptr,
outlength);
blocks_per_grid = blocks(lenparents);
threads_per_block = threads(lenparents);
awkward_reduce_sum_bool_kernel<<<blocks_per_grid, threads_per_block>>>(
toptr, fromptr, parents, lenparents);
return success();
}
ERROR awkward_reduce_sum_bool_bool_64(
bool* toptr,
const bool* fromptr,
const int64_t* parents,
int64_t lenparents,
int64_t outlength) {
return awkward_reduce_sum_bool<bool>(
toptr,
fromptr,
parents,
lenparents,
outlength);
}
ERROR awkward_reduce_sum_bool_int8_64(
bool* toptr,
const int8_t* fromptr,
const int64_t* parents,
int64_t lenparents,
int64_t outlength) {
return awkward_reduce_sum_bool<int8_t>(
toptr,
fromptr,
parents,
lenparents,
outlength);
}
ERROR awkward_reduce_sum_bool_uint8_64(
bool* toptr,
const uint8_t* fromptr,
const int64_t* parents,
int64_t lenparents,
int64_t outlength) {
return awkward_reduce_sum_bool<uint8_t>(
toptr,
fromptr,
parents,
lenparents,
outlength);
}
ERROR awkward_reduce_sum_bool_int16_64(
bool* toptr,
const int16_t* fromptr,
const int64_t* parents,
int64_t lenparents,
int64_t outlength) {
return awkward_reduce_sum_bool<int16_t>(
toptr,
fromptr,
parents,
lenparents,
outlength);
}
ERROR awkward_reduce_sum_bool_uint16_64(
bool* toptr,
const uint16_t* fromptr,
const int64_t* parents,
int64_t lenparents,
int64_t outlength) {
return awkward_reduce_sum_bool<uint16_t>(
toptr,
fromptr,
parents,
lenparents,
outlength);
}
ERROR awkward_reduce_sum_bool_int32_64(
bool* toptr,
const int32_t* fromptr,
const int64_t* parents,
int64_t lenparents,
int64_t outlength) {
return awkward_reduce_sum_bool<int32_t>(
toptr,
fromptr,
parents,
lenparents,
outlength);
}
ERROR awkward_reduce_sum_bool_uint32_64(
bool* toptr,
const uint32_t* fromptr,
const int64_t* parents,
int64_t lenparents,
int64_t outlength) {
return awkward_reduce_sum_bool<uint32_t>(
toptr,
fromptr,
parents,
lenparents,
outlength);
}
ERROR awkward_reduce_sum_bool_int64_64(
bool* toptr,
const int64_t* fromptr,
const int64_t* parents,
int64_t lenparents,
int64_t outlength) {
return awkward_reduce_sum_bool<int64_t>(
toptr,
fromptr,
parents,
lenparents,
outlength);
}
ERROR awkward_reduce_sum_bool_uint64_64(
bool* toptr,
const uint64_t* fromptr,
const int64_t* parents,
int64_t lenparents,
int64_t outlength) {
return awkward_reduce_sum_bool<uint64_t>(
toptr,
fromptr,
parents,
lenparents,
outlength);
}
ERROR awkward_reduce_sum_bool_float32_64(
bool* toptr,
const float* fromptr,
const int64_t* parents,
int64_t lenparents,
int64_t outlength) {
return awkward_reduce_sum_bool<float>(
toptr,
fromptr,
parents,
lenparents,
outlength);
}
ERROR awkward_reduce_sum_bool_float64_64(
bool* toptr,
const double* fromptr,
const int64_t* parents,
int64_t lenparents,
int64_t outlength) {
return awkward_reduce_sum_bool<double>(
toptr,
fromptr,
parents,
lenparents,
outlength);
}
|