poseidonchan / TAPE

Deep learning-based tissue compositions and cell-type-specific gene expression analysis with tissue-adaptive autoencoder (TAPE)

Home Page:https://sctape.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sampling takes too much time, can use GPU?

abrarrahmanabir opened this issue · comments

I am working with the GSE87544. It has 14k cells approx. The sampling is taking more than couple of hours. how to use GPU to accelerate this? I am unable to find any option such as device to select.
'''
print('Sampling cells to compose pseudo-bulk data')
for i, sample_prop in tqdm(enumerate(cell_num)):
for j, celltype in enumerate(celltype_groups.keys()):
select_indices = torch.multinomial(input=sc_data_tensor[celltype_groups[celltype]], num_samples=sample_prop[j], replacement=True)
sample[i] += sc_data_tensor[select_indices].sum(0)

'''
this is the part where it takes huge time.
please help .

Hi,

Actually I met this problem when I first developed the code, the sampling process was very slow. At that time I examine all the operations I used and found that one "indexing" operation is the slowest one. Then my friend Mengyue helped me solve this problem by changing the way how the array is stored in the memory (

# use ndarray to accelerate
). Maybe this debugging process can help you.

Regards,
Yanshuo