-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add awkward_ListArray_min_range CUDA kernel
- Loading branch information
1 parent
24ea1cf
commit c25209e
Showing
4 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/awkward/_connect/cuda/cuda_kernels/awkward_ListArray_min_range.cu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE | ||
|
||
template <typename T, typename C, typename U> | ||
__global__ void | ||
awkward_ListArray_min_range(T* tomin, | ||
const C* fromstarts, | ||
const U* fromstops, | ||
int64_t lenstarts, | ||
uint64_t invocation_index, | ||
uint64_t* err_code) { | ||
if (err_code[0] == NO_ERROR) { | ||
int64_t thread_id = blockIdx.x * blockDim.x + threadIdx.x; | ||
int64_t shorter = fromstops[0] - fromstarts[0]; | ||
|
||
if (thread_id >=1 && thread_id < lenstarts) { | ||
int64_t rangeval = fromstops[thread_id] - fromstarts[thread_id]; | ||
shorter = (shorter < rangeval) ? shorter : rangeval; | ||
atomicMin(tomin, shorter); | ||
} | ||
} | ||
} |