Experimental Feature: Function delegation to rapids_singlecell when gpu is available #1093
Experimental Feature: Function delegation to rapids_singlecell when gpu is available #1093selmanozleyen wants to merge 81 commits intoscverse:mainfrom
Conversation
for more information, see https://pre-commit.ci
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1093 +/- ##
==========================================
+ Coverage 66.21% 66.62% +0.40%
==========================================
Files 44 46 +2
Lines 7163 7274 +111
Branches 1217 1230 +13
==========================================
+ Hits 4743 4846 +103
- Misses 1943 1948 +5
- Partials 477 480 +3
🚀 New features to boost your workflow:
|
…en/squidpy into feat/device-settings
for more information, see https://pre-commit.ci
…en/squidpy into feat/device-settings
src/squidpy/gr/_ppatterns.py
Outdated
| if effective_device == "gpu": | ||
| from rapids_singlecell.squidpy import co_occurrence as rsc_co_occurrence | ||
|
|
||
| return rsc_co_occurrence( | ||
| adata, | ||
| cluster_key=cluster_key, | ||
| spatial_key=spatial_key, | ||
| interval=interval, | ||
| copy=copy, | ||
| n_splits=n_splits, | ||
| n_jobs=n_jobs, | ||
| backend=backend, | ||
| show_progress_bar=show_progress_bar, | ||
| ) |
There was a problem hiding this comment.
I think this can generally be wrapped up in a decorator where we:
- check
effective_device - Subset the inbound arguments from squidpy to those of rapids' function (I imagine
n_jobsdoesn't apply, this can probably be done with python'sinspectmodule) - run the rapids function
- Optionally bring the data back to the CPU (I would guess people want this, or at least it should be behind a flag)
|
Anndata’s settings are indeed much nicer than scanpy’s. They do need a few parts to work, but with all that in place they’re great!
|
|
Ok knowing what you guys would want was important thanks. Currently I will go with the inspect module and a decorator even though I think we might not be able to support 1-1 dispatch in certain configurations in the future. Also will probably have some friction on docstrings and type-hints if we are going to find common arguments dynamically.But lets see.
yeah these are also important to me so I will ensure this. |
|
Before thinking more about settings. I'd like to clarify that we might even want to do this on a fork of rsc, this is the decision we made with @timtreis in order to speed up things. But I really want to make sure we don't diverge too much and it will be in a state where we can incorperate our changes to rsc back easily. I think this direction would be good for the health of both repos. I have a plan for squidpy functions like
Another benefit: Power users are important and will keep this repo alive. In general if it wasn't for |
ok I understand a bit more the scanpy settings but I don't think I'd need dynamic typing just to store a global preferred device right? |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…en/squidpy into feat/device-settings
for more information, see https://pre-commit.ci
|
I checked and it works in our clusters. |
hi @flying-sheep @ilan-gold @timtreis @Intron7 , for squidpy 2.0 we are planning to delegate to the gpu functionality when there is a device present by default. I am trying to come up with an API for this. I saw that the scanpy settings class was very complicated so I though maybe we need something simpler for our case.
This is what I came up with. I will come up with the
co_occurencesupport after lunch but I wanted an initial feedback on this.Example usage
Installation instructions