Sampling takes too much time, can use GPU?
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 (https://github.com/poseidonchan/TAPE/blob/8ffb2f4600e1cbc689c6b1b1f428e1ddac773c6e/TAPE/simulation.py#L65). Maybe this debugging process can help you.
Regards, Yanshuo
Thank you so much for your kind help!
On Mon, 17 Jun 2024, 21:25 Yanshuo Chen, @.***> wrote:
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 ( https://github.com/poseidonchan/TAPE/blob/8ffb2f4600e1cbc689c6b1b1f428e1ddac773c6e/TAPE/simulation.py#L65). Maybe this debugging process can help you.
Regards, Yanshuo
— Reply to this email directly, view it on GitHub https://github.com/poseidonchan/TAPE/issues/16#issuecomment-2173708226, or unsubscribe https://github.com/notifications/unsubscribe-auth/BB3AEYJL2NIV3T4CBWG4J3DZH35VXAVCNFSM6AAAAABJI64OMGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZTG4YDQMRSGY . You are receiving this because you authored the thread.Message ID: @.***>