Skip to content

BUG: default execution space doesn't affect empty view creation #186

@tylerjereddy

Description

@tylerjereddy

This is interfering with my ability to get CUDA/GPU benchmarks for gh-146 and needs a regression test + fix added.

Reproducer is below, where both views need to be allocated to Device memory, otherwise control flows will not make sense at all--you can't have a global execution space default that cherry-picks the scenarios where it respects where things are being allocated, in the absence of an explicit specification to use the host.

import numpy as np
import pykokkos as pk


def main():
    C = pk.View([8, 8], dtype=pk.double)
    print("C.space:", C.space)  # MemorySpace.HostSpace

    a = np.ones((4, 4), dtype=float)
    view_a = pk.from_numpy(a)
    print("view_a.space:", view_a.space) # MemorySpace.CudaSpace


if __name__ == "__main__":
    space = pk.ExecutionSpace.Cuda
    pk.set_default_space(space)
    main()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions