kokkos / pykokkos-base

Python bindings for data interoperability with Kokkos (View, DynRankView)
Other
26 stars 9 forks source link

Defaulting layout to Right versus following Kokkos' default #34

Open kaschau opened 2 years ago

kaschau commented 2 years ago

Is there a reason layouts are defaulted to LayoutRight for kokkos.arrays instead of being exec space preference based like native Kokkos?

Currently, if one creates a CudaSpace array without specifying LayoutLeft, a LayoutRight array is created, and the predictable performance hit is experienced. We could add some simple logic to the array creation like is already done if a numpy array is passed. Or better yet just access the space's preferred layout straight from kokkos source (nor sure if that's feasible or not). I guess at this point its more or less as simple as GPU <-> Left CPU <-> Right so its not too tedious to just specify on the python side.

jrmadsen commented 2 years ago

Is there a reason layouts are defaulted to LayoutRight for kokkos.arrays instead of being exec space preference based like native Kokkos?

No, it was just an oversight.

Or better yet just access the space's preferred layout straight from kokkos source (nor sure if that's feasible or not).

It wouldn't be terribly difficult to create a get_default_layout(<memory-space>) function which accepts a memory space enum in enumeration.cpp which returns the preferred layout -- as long as you can follow along with the existing template metaprogramming. Then you could just change the default param to None in utility.py and make that call when it is None.

Unfortunately, I am no longer actively handling this sort of development. If you can't, ping @crtrott and @dalg24 and they might be able to find a core dev that can do it.

jrmadsen commented 2 years ago

@NaderAlAwar it looks like the modifications in #32 are similar to the request here.