Skip to content

Commit

Permalink
Update reducer types allowed in parallel reduction.
Browse files Browse the repository at this point in the history
  • Loading branch information
pkestene committed Dec 1, 2023
1 parent 01f920f commit c443cee
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/kokkos/random_sum.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class RandomSum:
def __init__(self, n):
self.N: int = n
self.total: int = 0
self.total: pk.int32 = 0
self.a: pk.View1D[pk.int32] = pk.View([n], pk.int32)

for i in range(self.N):
Expand Down
18 changes: 17 additions & 1 deletion pykokkos/core/translators/bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def get_return_type(operation: str, workunit: cppast.MethodDecl) -> str:
:param operation: the type of the operation (for, reduce, scan, or workload)
:param workunit: the workunit for which the binding is being generated
:returns: the return type as a string
"""
"""

acc_decl: Optional[cppast.ParmVarDecl] = None
if operation == "reduce":
Expand Down Expand Up @@ -575,6 +575,22 @@ def bind_main_single(
if "pk.Acc" in element:
if "pk.int64" in element:
acc_type = "int64_t"
elif "pk.int32" in element:
acc_type = "int32_t"
elif "pk.int16" in element:
acc_type = "int16_t"
elif "pk.int8" in element:
acc_type = "int8_t"
elif "pk.uint64" in element:
acc_type = "uint64_t"
elif "pk.uint32" in element:
acc_type = "uint32_t"
elif "pk.uint16" in element:
acc_type = "uint16_t"
elif "pk.uint8" in element:
acc_type = "uint8_t"
elif "pk.float" in element:
acc_type = "float"
elif "pk.double" in element:
acc_type = "double"

Expand Down

0 comments on commit c443cee

Please sign in to comment.