-
Notifications
You must be signed in to change notification settings - Fork 25
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
Multi-GPU support with dask #179
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
We should look into the cost of allocating ahead of time for all operations that are currently in-place |
Median out of core is a bad choice. Uses way more memory and is slower. Loose Loose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think I can really review this.
I checked out parts like the PCA code, but generally the whole codebase lacks some abstractions that would get rid of visual noise while exposing the intent, especially for patterns like invoking a kernel with block sizes specified (mentioned here: https://github.com/scverse/rapids_singlecell/pull/179/files#r1838497326)
I also still want to see docstrings for the kernels! (ideally coupled with an abstraction for the kernel pattern)
Let’s tackle both of these abstractions before the next feature PR. I’m happy to meet with you to design them.
If the first abstraction (calling kernels) and the big code moves (e.g. PCA) were done before this PR, I could actually see what changes happened and what’s new and therefore review this, but like this it’s just too much to wrap my head around.
PS: there are a bunch of unaddressed comments still above
@@ -260,6 +266,21 @@ def in_bounds( | |||
) | |||
|
|||
|
|||
def _hvg_expm1(X): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does that have to do with HVG? isn’t it just expm1?
also seems like it could be cleaner with singledispatch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
singledispatch doesnt work with cupy
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
int n_cells) { | ||
int cell = blockDim.x * blockIdx.x + threadIdx.x; | ||
if(cell >= n_cells){ | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as in the other PR: no error handling? is this expected to be called with invalid inputs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how cuda works
if isinstance(X, cp.ndarray): | ||
X = cp.log1p(X) | ||
else: | ||
elif sparse.issparse(X): | ||
X = X.log1p() | ||
|
||
elif isinstance(X, DaskArray): | ||
if isinstance(X._meta, cp.ndarray): | ||
X = X.map_blocks(lambda x: cp.log1p(x), meta=_meta_dense(X.dtype)) | ||
elif isinstance(X._meta, sparse.csr_matrix): | ||
X = X.map_blocks(lambda x: x.log1p(), meta=_meta_sparse(X.dtype)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should become a helper like the expm1 above
import dask | ||
import dask.array as da | ||
|
||
if isinstance(X._meta, sparse.csr_matrix): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please figure out a way to reuse code here.
Co-authored-by: Philipp A. <[email protected]>
for more information, see https://pre-commit.ci
This adds dask support
Functions to add:
calculate_qc_metrics
normalize_total
log1p
highly_variable_genes
withseurat
andcell_ranger
scale
PCA
neighbors