Skip to content

Batch PyKokkos Kernels #347

@kennykos

Description

@kennykos

The example script launches B small kernels with requisite overhead
that could be grouped into one larger kernel to reduce launch overhead.
It would be nice if there was pykokkos functionality to indicate kernel batching
while keeping the current structure of the outer for loop.

import cupy as cp
import pykokkos as pk

@pk.workunit
def work(wid, a): 
    a[wid] = a[wid] + 1 

def main():
    B = 10
    N = 10
    a = cp.ones((B, N)) 
    pk.set_default_space(pk.Cuda)
    for batch in range(B):
        pk.parallel_for("work", 10, work, a=a[batch])
    print(a)

main()

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions