Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Numpy-like array indexing #274

Open
kennykos opened this issue Jul 2, 2024 · 0 comments
Open

Feature request: Numpy-like array indexing #274

kennykos opened this issue Jul 2, 2024 · 0 comments

Comments

@kennykos
Copy link
Contributor

kennykos commented Jul 2, 2024

In a pk.workunit, my code fails when I try to access a cupy array as x[a, b] instead of x[a][b]. For example, the script

import cupy as cp
import pykokkos as pk

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

def main():
    N = 10
    a = cp.ones((N, N))
    pk.set_default_space(pk.Cuda)
    pk.parallel_for("work", 10, work, a=a)
    print(a)

main()

fails with error

Error on line 6 : 'a' is not a View1D
DEBUG AST:
Subscript(
    value=Name(id='a', ctx=Load()),
    slice=Tuple(
        elts=[
            Name(id='wid', ctx=Load()),
            Name(id='wid', ctx=Load())],
        ctx=Load()),
    ctx=Store())
    a[wid,wid] = a[wid,wid] + 1
    ^^^^^^^^^^
Translation of <ast.FunctionDef object at 0x150231e8fd00> work failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant