christinahedges / scatterbrain

GPU version of tessbackdrop
0 stars 1 forks source link

Strided arrays #2

Open christinahedges opened 2 years ago

christinahedges commented 2 years ago

@dmargala has pointed out that we're not actually using the batched version of the cholesky solve, and we can benefit from strided arrays to get that to work.

This is his snippet to get this to work

assert a2d.shape == (n, n)
a3d = cp.lib.stride_tricks.as_strided(a2d, shape=(k, n, n), strides=(0, n*a2d.itemsize, a2d.itemsize))
assert a3d.shape == (k, n, n)
dmargala commented 2 years ago

I would guess that using the non-batched cholesky solve on a problem with NRHS > 1 is more efficient than "tricking" the batched cholesky solve by turning the NRHS dimension into a batch dimension.

The stride trick would be useful if the non-batched choleksy solver could not handle NRHS > 1 or if using it with the batched choleksy solver is actually more efficient.

The nomenclature is confusing. I'm not sure what the proper term for a NRHS > 1 problem is. It sounds interchangeable with "batch" but I suspect it makes a difference to underlying algorithm implementation.